SFGeometryUtils

Objective-C

@interface SFGeometryUtils : NSObject

Swift

class SFGeometryUtils : NSObject

Utilities for Geometry objects

  • Get the dimension of the Geometry, 0 for points, 1 for curves, 2 for surfaces. If a collection, the largest dimension is returned.

    Declaration

    Objective-C

    + (int)dimensionOfGeometry:(SFGeometry *)geometry;

    Swift

    class func dimension(of geometry: SFGeometry!) -> Int32

    Parameters

    geometry

    geometry object

    Return Value

    dimension (0, 1, or 2)

  • Get the Pythagorean theorem distance between two points

    Declaration

    Objective-C

    + (double)distanceBetweenPoint1:(SFPoint *)point1 andPoint2:(SFPoint *)point2;

    Swift

    class func distanceBetweenPoint1(_ point1: SFPoint!, andPoint2 point2: SFPoint!) -> Double

    Parameters

    point1

    point 1

    point2

    point 2

    Return Value

    distance

  • Get the Pythagorean theorem distance between the line end points

    Declaration

    Objective-C

    + (double)distanceOfLine:(SFLine *)line;

    Swift

    class func distance(of line: SFLine!) -> Double

    Parameters

    line

    line

    Return Value

    distance

  • Get the bearing heading in degrees between two points in degrees

    Declaration

    Objective-C

    + (double)bearingBetweenPoint1:(SFPoint *)point1 andPoint2:(SFPoint *)point2;

    Swift

    class func bearingBetweenPoint1(_ point1: SFPoint!, andPoint2 point2: SFPoint!) -> Double

    Parameters

    point1

    point 1

    point2

    point 2

    Return Value

    bearing angle in degrees between 0 and 360

  • Get the bearing heading in degrees between line end points in degrees

    Declaration

    Objective-C

    + (double)bearingOfLine:(SFLine *)line;

    Swift

    class func bearing(of line: SFLine!) -> Double

    Parameters

    line

    line

    Return Value

    bearing angle in degrees between 0 inclusively and 360 exclusively

  • Determine if the bearing is in any north direction

    Declaration

    Objective-C

    + (BOOL)isNorthBearing:(double)bearing;

    Swift

    class func isNorthBearing(_ bearing: Double) -> Bool

    Parameters

    bearing

    bearing angle in degrees

    Return Value

    true if north bearing

  • Determine if the bearing is in any east direction

    Declaration

    Objective-C

    + (BOOL)isEastBearing:(double)bearing;

    Swift

    class func isEastBearing(_ bearing: Double) -> Bool

    Parameters

    bearing

    bearing angle in degrees

    Return Value

    true if east bearing

  • Determine if the bearing is in any south direction

    Declaration

    Objective-C

    + (BOOL)isSouthBearing:(double)bearing;

    Swift

    class func isSouthBearing(_ bearing: Double) -> Bool

    Parameters

    bearing

    bearing angle in degrees

    Return Value

    true if south bearing

  • Determine if the bearing is in any west direction

    Declaration

    Objective-C

    + (BOOL)isWestBearing:(double)bearing;

    Swift

    class func isWestBearing(_ bearing: Double) -> Bool

    Parameters

    bearing

    bearing angle in degrees

    Return Value

    true if west bearing

  • Convert degrees to radians

    Declaration

    Objective-C

    + (double)degreesToRadians:(double)degrees;

    Swift

    class func degrees(toRadians degrees: Double) -> Double

    Parameters

    degrees

    degrees

    Return Value

    radians

  • Convert radians to degrees

    Declaration

    Objective-C

    + (double)radiansToDegrees:(double)radians;

    Swift

    class func radians(toDegrees radians: Double) -> Double

    Parameters

    radians

    radians

    Return Value

    degrees

  • Get the centroid point of a 2 dimensional representation of the Geometry (balancing point of a 2d cutout of the geometry). Only the x and y coordinate of the resulting point are calculated and populated. The resulting SFPoint.z and SFPoint.m values will always be nil.

    Declaration

    Objective-C

    + (SFPoint *)centroidOfGeometry:(SFGeometry *)geometry;

    Swift

    class func centroid(of geometry: SFGeometry!) -> SFPoint!

    Parameters

    geometry

    geometry object

    Return Value

    centroid point

  • Get the geographic centroid point of a 2 dimensional representation of the degree unit Geometry. Only the x and y coordinate of the resulting point are calculated and populated. The resulting SFPoint.z and SFPoint.m values will always be nil.

    Declaration

    Objective-C

    + (SFPoint *)degreesCentroidOfGeometry:(SFGeometry *)geometry;

    Swift

    class func degreesCentroid(of geometry: SFGeometry!) -> SFPoint!

    Parameters

    geometry

    geometry object

    Return Value

    centroid point

  • Minimize the WGS84 geometry using the shortest x distance between each connected set of points. Resulting x values will be in the range: -540.0 <= x <= 540.0

    Declaration

    Objective-C

    + (void)minimizeWGS84Geometry:(SFGeometry *)geometry;

    Swift

    class func minimizeWGS84Geometry(_ geometry: SFGeometry!)

    Parameters

    geometry

    geometry

  • Minimize the Web Mercator geometry using the shortest x distance between each connected set of points. Resulting x values will be in the range: -60112525.028367732 <= x <= 60112525.028367732

    Declaration

    Objective-C

    + (void)minimizeWebMercatorGeometry:(SFGeometry *)geometry;

    Swift

    class func minimizeWebMercatorGeometry(_ geometry: SFGeometry!)

    Parameters

    geometry

    geometry

  • Minimize the geometry using the shortest x distance between each connected set of points. The resulting geometry point x values will be in the range: (3 * min value <= x <= 3 * max value

    Example: For WGS84 provide a max x of SF_WGS84_HALF_WORLD_LON_WIDTH. Resulting x values will be in the range: -540.0 <= x <= 540.0

    Example: For web mercator provide a world width of SF_WEB_MERCATOR_HALF_WORLD_WIDTH. Resulting x values will be in the range: -60112525.028367732 <= x <= 60112525.028367732

    Declaration

    Objective-C

    + (void)minimizeGeometry:(SFGeometry *)geometry withMaxX:(double)maxX;

    Swift

    class func minimizeGeometry(_ geometry: SFGeometry!, withMaxX maxX: Double)

    Parameters

    geometry

    geometry

    maxX

    max positive x value in the geometry projection

  • Normalize the WGS84 geometry using the shortest x distance between each connected set of points. Resulting x values will be in the range: -180.0 <= x <= 180.0

    Declaration

    Objective-C

    + (void)normalizeWGS84Geometry:(SFGeometry *)geometry;

    Swift

    class func normalizeWGS84Geometry(_ geometry: SFGeometry!)

    Parameters

    geometry

    geometry

  • Normalize the Web Mercator geometry using the shortest x distance between each connected set of points. Resulting x values will be in the range: -20037508.342789244 <= x <= 20037508.342789244

    Declaration

    Objective-C

    + (void)normalizeWebMercatorGeometry:(SFGeometry *)geometry;

    Swift

    class func normalizeWebMercatorGeometry(_ geometry: SFGeometry!)

    Parameters

    geometry

    geometry

  • Normalize the geometry so all points outside of the min and max value range are adjusted to fall within the range.

    Example: For WGS84 provide a max x of SF_WGS84_HALF_WORLD_LON_WIDTH. Resulting x values will be in the range: -180.0 <= x <= 180.0

    Example: For web mercator provide a world width of SF_WEB_MERCATOR_HALF_WORLD_WIDTH. Resulting x values will be in the range: -20037508.342789244 <= x <= 20037508.342789244

    Declaration

    Objective-C

    + (void)normalizeGeometry:(SFGeometry *)geometry withMaxX:(double)maxX;

    Swift

    class func normalize(_ geometry: SFGeometry!, withMaxX maxX: Double)

    Parameters

    geometry

    geometry

    maxX

    max positive x value in the geometry projection

  • Simplify the ordered points (representing a line, polygon, etc) using the Douglas Peucker algorithm to create a similar curve with fewer points. Points should be in a meters unit type projection. The tolerance is the minimum tolerated distance between consecutive points.

    Declaration

    Objective-C

    + (NSArray<SFPoint *> *)simplifyPoints:(NSArray<SFPoint *> *)points
                             withTolerance:(double)tolerance;

    Swift

    class func simplifyPoints(_ points: [SFPoint]!, withTolerance tolerance: Double) -> [SFPoint]!

    Parameters

    points

    geometry points

    tolerance

    minimum tolerance in meters for consecutive points

    Return Value

    simplified points

  • Calculate the perpendicular distance between the point and the line represented by the start and end points. Points should be in a meters unit type projection.

    Declaration

    Objective-C

    + (double)perpendicularDistanceBetweenPoint:(SFPoint *)point
                                      lineStart:(SFPoint *)lineStart
                                        lineEnd:(SFPoint *)lineEnd;

    Swift

    class func perpendicularDistanceBetweenPoint(_ point: SFPoint!, lineStart: SFPoint!, lineEnd: SFPoint!) -> Double

    Parameters

    point

    point

    lineStart

    point representing the line start

    lineEnd

    point representing the line end

    Return Value

    distance in meters

  • Check if the point is in the polygon

    Declaration

    Objective-C

    + (BOOL)point:(SFPoint *)point inPolygon:(SFPolygon *)polygon;

    Swift

    class func point(_ point: SFPoint!, in polygon: SFPolygon!) -> Bool

    Parameters

    point

    point

    polygon

    polygon

    Return Value

    true if in the polygon

  • Check if the point is in the polygon

    Declaration

    Objective-C

    + (BOOL)point:(SFPoint *)point
          inPolygon:(SFPolygon *)polygon
        withEpsilon:(double)epsilon;

    Swift

    class func point(_ point: SFPoint!, in polygon: SFPolygon!, withEpsilon epsilon: Double) -> Bool

    Parameters

    point

    point

    polygon

    polygon

    epsilon

    epsilon line tolerance

    Return Value

    true if in the polygon

  • Check if the point is in the polygon ring

    Declaration

    Objective-C

    + (BOOL)point:(SFPoint *)point inPolygonRing:(SFLineString *)ring;

    Swift

    class func point(_ point: SFPoint!, inPolygonRing ring: SFLineString!) -> Bool

    Parameters

    point

    point

    ring

    polygon ring

    Return Value

    true if in the polygon

  • Check if the point is in the polygon ring

    Declaration

    Objective-C

    + (BOOL)point:(SFPoint *)point
        inPolygonRing:(SFLineString *)ring
          withEpsilon:(double)epsilon;

    Swift

    class func point(_ point: SFPoint!, inPolygonRing ring: SFLineString!, withEpsilon epsilon: Double) -> Bool

    Parameters

    point

    point

    ring

    polygon ring

    epsilon

    epsilon line tolerance

    Return Value

    true if in the polygon

  • Check if the point is in the polygon points

    Declaration

    Objective-C

    + (BOOL)point:(SFPoint *)point inPolygonPoints:(NSArray<SFPoint *> *)points;

    Swift

    class func point(_ point: SFPoint!, inPolygonPoints points: [SFPoint]!) -> Bool

    Parameters

    point

    point

    points

    polygon points

    Return Value

    true if in the polygon

  • Check if the point is in the polygon points

    Declaration

    Objective-C

    + (BOOL)point:(SFPoint *)point
        inPolygonPoints:(NSArray<SFPoint *> *)points
            withEpsilon:(double)epsilon;

    Swift

    class func point(_ point: SFPoint!, inPolygonPoints points: [SFPoint]!, withEpsilon epsilon: Double) -> Bool

    Parameters

    point

    point

    points

    polygon points

    epsilon

    epsilon line tolerance

    Return Value

    true if in the polygon

  • Check if the point is on the polygon edge

    Declaration

    Objective-C

    + (BOOL)point:(SFPoint *)point onPolygonEdge:(SFPolygon *)polygon;

    Swift

    class func point(_ point: SFPoint!, onPolygonEdge polygon: SFPolygon!) -> Bool

    Parameters

    point

    point

    polygon

    polygon

    Return Value

    true if on the polygon edge

  • Check if the point is on the polygon edge

    Declaration

    Objective-C

    + (BOOL)point:(SFPoint *)point
        onPolygonEdge:(SFPolygon *)polygon
          withEpsilon:(double)epsilon;

    Swift

    class func point(_ point: SFPoint!, onPolygonEdge polygon: SFPolygon!, withEpsilon epsilon: Double) -> Bool

    Parameters

    point

    point

    polygon

    polygon

    epsilon

    epsilon line tolerance

    Return Value

    true if on the polygon edge

  • Check if the point is on the polygon ring edge

    Declaration

    Objective-C

    + (BOOL)point:(SFPoint *)point onPolygonRingEdge:(SFLineString *)ring;

    Swift

    class func point(_ point: SFPoint!, onPolygonRingEdge ring: SFLineString!) -> Bool

    Parameters

    point

    point

    ring

    polygon ring

    Return Value

    true if on the polygon edge

  • Check if the point is on the polygon ring edge

    Declaration

    Objective-C

    + (BOOL)point:(SFPoint *)point
        onPolygonRingEdge:(SFLineString *)ring
              withEpsilon:(double)epsilon;

    Swift

    class func point(_ point: SFPoint!, onPolygonRingEdge ring: SFLineString!, withEpsilon epsilon: Double) -> Bool

    Parameters

    point

    point

    ring

    polygon ring

    epsilon

    epsilon line tolerance

    Return Value

    true if on the polygon edge

  • Check if the point is on the polygon ring edge points

    Declaration

    Objective-C

    + (BOOL)point:(SFPoint *)point onPolygonPointsEdge:(NSArray<SFPoint *> *)points;

    Swift

    class func point(_ point: SFPoint!, onPolygonPointsEdge points: [SFPoint]!) -> Bool

    Parameters

    point

    point

    points

    polygon points

    Return Value

    true if on the polygon edge

  • Check if the point is on the polygon ring edge points

    Declaration

    Objective-C

    + (BOOL)point:(SFPoint *)point
        onPolygonPointsEdge:(NSArray<SFPoint *> *)points
                withEpsilon:(double)epsilon;

    Swift

    class func point(_ point: SFPoint!, onPolygonPointsEdge points: [SFPoint]!, withEpsilon epsilon: Double) -> Bool

    Parameters

    point

    point

    points

    polygon points

    epsilon

    epsilon line tolerance

    Return Value

    true if on the polygon edge

  • Check if the polygon outer ring is explicitly closed, where the first and last point are the same

    Declaration

    Objective-C

    + (BOOL)closedPolygon:(SFPolygon *)polygon;

    Swift

    class func closedPolygon(_ polygon: SFPolygon!) -> Bool

    Parameters

    polygon

    polygon

    Return Value

    true if the first and last points are the same

  • Check if the polygon ring is explicitly closed, where the first and last point are the same

    Declaration

    Objective-C

    + (BOOL)closedPolygonRing:(SFLineString *)ring;

    Swift

    class func closedPolygonRing(_ ring: SFLineString!) -> Bool

    Parameters

    ring

    polygon ring

    Return Value

    true if the first and last points are the same

  • Check if the polygon ring points are explicitly closed, where the first and last point are the same

    Declaration

    Objective-C

    + (BOOL)closedPolygonPoints:(NSArray<SFPoint *> *)points;

    Swift

    class func closedPolygonPoints(_ points: [SFPoint]!) -> Bool

    Parameters

    points

    polygon ring points

    Return Value

    true if the first and last points are the same

  • Check if the point is on the line

    Declaration

    Objective-C

    + (BOOL)point:(SFPoint *)point onLine:(SFLineString *)line;

    Swift

    class func point(_ point: SFPoint!, onLine line: SFLineString!) -> Bool

    Parameters

    point

    point

    line

    line

    Return Value

    true if on the line

  • Check if the point is on the line

    Declaration

    Objective-C

    + (BOOL)point:(SFPoint *)point
             onLine:(SFLineString *)line
        withEpsilon:(double)epsilon;

    Swift

    class func point(_ point: SFPoint!, onLine line: SFLineString!, withEpsilon epsilon: Double) -> Bool

    Parameters

    point

    point

    line

    line

    epsilon

    epsilon line tolerance

    Return Value

    true if on the line

  • Check if the point is on the line represented by the points

    Declaration

    Objective-C

    + (BOOL)point:(SFPoint *)point onLinePoints:(NSArray<SFPoint *> *)points;

    Swift

    class func point(_ point: SFPoint!, onLinePoints points: [SFPoint]!) -> Bool

    Parameters

    point

    point

    points

    line points

    Return Value

    true if on the line

  • Check if the point is on the line represented by the points

    Declaration

    Objective-C

    + (BOOL)point:(SFPoint *)point
        onLinePoints:(NSArray<SFPoint *> *)points
         withEpsilon:(double)epsilon;

    Swift

    class func point(_ point: SFPoint!, onLinePoints points: [SFPoint]!, withEpsilon epsilon: Double) -> Bool

    Parameters

    point

    point

    points

    line points

    epsilon

    epsilon line tolerance

    Return Value

    true if on the line

  • Check if the point is on the path between point 1 and point 2

    Declaration

    Objective-C

    + (BOOL)point:(SFPoint *)point
        onPathPoint1:(SFPoint *)point1
           andPoint2:(SFPoint *)point2;

    Swift

    class func point(_ point: SFPoint!, onPathPoint1 point1: SFPoint!, andPoint2 point2: SFPoint!) -> Bool

    Parameters

    point

    point

    point1

    path point 1

    point2

    path point 2

    Return Value

    true if on the path

  • Check if the point is on the path between point 1 and point 2

    Declaration

    Objective-C

    + (BOOL)point:(SFPoint *)point
        onPathPoint1:(SFPoint *)point1
           andPoint2:(SFPoint *)point2
         withEpsilon:(double)epsilon;

    Swift

    class func point(_ point: SFPoint!, onPathPoint1 point1: SFPoint!, andPoint2 point2: SFPoint!, withEpsilon epsilon: Double) -> Bool

    Parameters

    point

    point

    point1

    path point 1

    point2

    path point 2

    epsilon

    epsilon line tolerance

    Return Value

    true if on the path

  • Get the point intersection between two lines

    Declaration

    Objective-C

    + (SFPoint *)intersectionBetweenLine1:(SFLine *)line1 andLine2:(SFLine *)line2;

    Swift

    class func intersectionBetweenLine1(_ line1: SFLine!, andLine2 line2: SFLine!) -> SFPoint!

    Parameters

    line1

    first line

    line2

    second line

    Return Value

    intersection point or null if no intersection

  • Get the point intersection between end points of two lines

    Declaration

    Objective-C

    + (SFPoint *)intersectionBetweenLine1Point1:(SFPoint *)line1Point1
                                 andLine1Point2:(SFPoint *)line1Point2
                                 andLine2Point1:(SFPoint *)line2Point1
                                 andLine2Point2:(SFPoint *)line2Point2;

    Swift

    class func intersectionBetweenLine1Point1(_ line1Point1: SFPoint!, andLine1Point2 line1Point2: SFPoint!, andLine2Point1 line2Point1: SFPoint!, andLine2Point2 line2Point2: SFPoint!) -> SFPoint!

    Parameters

    line1Point1

    first point of the first line

    line1Point2

    second point of the first line

    line2Point1

    first point of the second line

    line2Point2

    second point of the second line

    Return Value

    intersection point or null if no intersection

  • Convert a geometry in degrees to a geometry in meters

    Declaration

    Objective-C

    + (SFGeometry *)degreesToMetersWithGeometry:(SFGeometry *)geometry;

    Swift

    class func degreesToMeters(with geometry: SFGeometry!) -> SFGeometry!

    Parameters

    geometry

    geometry in degrees

    Return Value

    geometry in meters

  • Convert a point in degrees to a point in meters

    Declaration

    Objective-C

    + (SFPoint *)degreesToMetersWithPoint:(SFPoint *)point;

    Swift

    class func degreesToMeters(with point: SFPoint!) -> SFPoint!

    Parameters

    point

    point in degrees

    Return Value

    point in meters

  • Convert a coordinate in degrees to a point in meters

    Declaration

    Objective-C

    + (SFPoint *)degreesToMetersWithX:(double)x andY:(double)y;

    Swift

    class func degreesToMetersWith(x: Double, andY y: Double) -> SFPoint!

    Parameters

    x

    x value in degrees

    y

    y value in degrees

    Return Value

    point in meters

  • Convert a multi point in degrees to a multi point in meters

    Declaration

    Objective-C

    + (SFMultiPoint *)degreesToMetersWithMultiPoint:(SFMultiPoint *)multiPoint;

    Swift

    class func degreesToMeters(with multiPoint: SFMultiPoint!) -> SFMultiPoint!

    Parameters

    multiPoint

    multi point in degrees

    Return Value

    multi point in meters

  • Convert a line string in degrees to a line string in meters

    Declaration

    Objective-C

    + (SFLineString *)degreesToMetersWithLineString:(SFLineString *)lineString;

    Swift

    class func degreesToMeters(with lineString: SFLineString!) -> SFLineString!

    Parameters

    lineString

    line string in degrees

    Return Value

    line string in meters

  • Convert a line in degrees to a line in meters

    Declaration

    Objective-C

    + (SFLine *)degreesToMetersWithLine:(SFLine *)line;

    Swift

    class func degreesToMeters(with line: SFLine!) -> SFLine!

    Parameters

    line

    line in degrees

    Return Value

    line in meters

  • Convert a multi line string in degrees to a multi line string in meters

    Declaration

    Objective-C

    + (SFMultiLineString *)degreesToMetersWithMultiLineString:
        (SFMultiLineString *)multiLineString;

    Swift

    class func degreesToMeters(with multiLineString: SFMultiLineString!) -> SFMultiLineString!

    Parameters

    multiLineString

    multi line string in degrees

    Return Value

    multi line string in meters

  • Convert a polygon in degrees to a polygon in meters

    Declaration

    Objective-C

    + (SFPolygon *)degreesToMetersWithPolygon:(SFPolygon *)polygon;

    Swift

    class func degreesToMeters(with polygon: SFPolygon!) -> SFPolygon!

    Parameters

    polygon

    polygon in degrees

    Return Value

    polygon in meters

  • Convert a multi polygon in degrees to a multi polygon in meters

    Declaration

    Objective-C

    + (SFMultiPolygon *)degreesToMetersWithMultiPolygon:
        (SFMultiPolygon *)multiPolygon;

    Swift

    class func degreesToMeters(with multiPolygon: SFMultiPolygon!) -> SFMultiPolygon!

    Parameters

    multiPolygon

    multi polygon in degrees

    Return Value

    multi polygon in meters

  • Convert a circular string in degrees to a circular string in meters

    Declaration

    Objective-C

    + (SFCircularString *)degreesToMetersWithCircularString:
        (SFCircularString *)circularString;

    Swift

    class func degreesToMeters(with circularString: SFCircularString!) -> SFCircularString!

    Parameters

    circularString

    circular string in degrees

    Return Value

    circular string in meters

  • Convert a compound curve in degrees to a compound curve in meters

    Declaration

    Objective-C

    + (SFCompoundCurve *)degreesToMetersWithCompoundCurve:
        (SFCompoundCurve *)compoundCurve;

    Swift

    class func degreesToMeters(with compoundCurve: SFCompoundCurve!) -> SFCompoundCurve!

    Parameters

    compoundCurve

    compound curve in degrees

    Return Value

    compound curve in meters

  • Convert a curve polygon in degrees to a curve polygon in meters

    Declaration

    Objective-C

    + (SFCurvePolygon *)degreesToMetersWithCurvePolygon:
        (SFCurvePolygon *)curvePolygon;

    Swift

    class func degreesToMeters(with curvePolygon: SFCurvePolygon!) -> SFCurvePolygon!

    Parameters

    curvePolygon

    curve polygon in degrees

    Return Value

    curve polygon in meters

  • Convert a polyhedral surface in degrees to a polyhedral surface in meters

    Declaration

    Objective-C

    + (SFPolyhedralSurface *)degreesToMetersWithPolyhedralSurface:
        (SFPolyhedralSurface *)polyhedralSurface;

    Swift

    class func degreesToMeters(with polyhedralSurface: SFPolyhedralSurface!) -> SFPolyhedralSurface!

    Parameters

    polyhedralSurface

    polyhedral surface in degrees

    Return Value

    polyhedral surface in meters

  • Convert a TIN in degrees to a TIN in meters

    Declaration

    Objective-C

    + (SFTIN *)degreesToMetersWithTIN:(SFTIN *)tin;

    Swift

    class func degreesToMeters(with tin: SFTIN!) -> SFTIN!

    Parameters

    tin

    TIN in degrees

    Return Value

    TIN in meters

  • Convert a triangle in degrees to a triangle in meters

    Declaration

    Objective-C

    + (SFTriangle *)degreesToMetersWithTriangle:(SFTriangle *)triangle;

    Swift

    class func degreesToMeters(with triangle: SFTriangle!) -> SFTriangle!

    Parameters

    triangle

    triangle in degrees

    Return Value

    triangle in meters

  • Convert a geometry in meters to a geometry in degrees

    Declaration

    Objective-C

    + (SFGeometry *)metersToDegreesWithGeometry:(SFGeometry *)geometry;

    Swift

    class func metersToDegrees(with geometry: SFGeometry!) -> SFGeometry!

    Parameters

    geometry

    geometry in meters

    Return Value

    geometry in degrees

  • Convert a point in meters to a point in degrees

    Declaration

    Objective-C

    + (SFPoint *)metersToDegreesWithPoint:(SFPoint *)point;

    Swift

    class func metersToDegrees(with point: SFPoint!) -> SFPoint!

    Parameters

    point

    point in meters

    Return Value

    point in degrees

  • Convert a coordinate in meters to a point in degrees

    Declaration

    Objective-C

    + (SFPoint *)metersToDegreesWithX:(double)x andY:(double)y;

    Swift

    class func metersToDegreesWith(x: Double, andY y: Double) -> SFPoint!

    Parameters

    x

    x value in meters

    y

    y value in meters

    Return Value

    point in degrees

  • Convert a multi point in meters to a multi point in degrees

    Declaration

    Objective-C

    + (SFMultiPoint *)metersToDegreesWithMultiPoint:(SFMultiPoint *)multiPoint;

    Swift

    class func metersToDegrees(with multiPoint: SFMultiPoint!) -> SFMultiPoint!

    Parameters

    multiPoint

    multi point in meters

    Return Value

    multi point in degrees

  • Convert a line string in meters to a line string in degrees

    Declaration

    Objective-C

    + (SFLineString *)metersToDegreesWithLineString:(SFLineString *)lineString;

    Swift

    class func metersToDegrees(with lineString: SFLineString!) -> SFLineString!

    Parameters

    lineString

    line string in meters

    Return Value

    line string in degrees

  • Convert a line in meters to a line in degrees

    Declaration

    Objective-C

    + (SFLine *)metersToDegreesWithLine:(SFLine *)line;

    Swift

    class func metersToDegrees(with line: SFLine!) -> SFLine!

    Parameters

    line

    line in meters

    Return Value

    line in degrees

  • Convert a multi line string in meters to a multi line string in degrees

    Declaration

    Objective-C

    + (SFMultiLineString *)metersToDegreesWithMultiLineString:
        (SFMultiLineString *)multiLineString;

    Swift

    class func metersToDegrees(with multiLineString: SFMultiLineString!) -> SFMultiLineString!

    Parameters

    multiLineString

    multi line string in meters

    Return Value

    multi line string in degrees

  • Convert a polygon in meters to a polygon in degrees

    Declaration

    Objective-C

    + (SFPolygon *)metersToDegreesWithPolygon:(SFPolygon *)polygon;

    Swift

    class func metersToDegrees(with polygon: SFPolygon!) -> SFPolygon!

    Parameters

    polygon

    polygon in meters

    Return Value

    polygon in degrees

  • Convert a multi polygon in meters to a multi polygon in degrees

    Declaration

    Objective-C

    + (SFMultiPolygon *)metersToDegreesWithMultiPolygon:
        (SFMultiPolygon *)multiPolygon;

    Swift

    class func metersToDegrees(with multiPolygon: SFMultiPolygon!) -> SFMultiPolygon!

    Parameters

    multiPolygon

    multi polygon in meters

    Return Value

    multi polygon in degrees

  • Convert a circular string in meters to a circular string in degrees

    Declaration

    Objective-C

    + (SFCircularString *)metersToDegreesWithCircularString:
        (SFCircularString *)circularString;

    Swift

    class func metersToDegrees(with circularString: SFCircularString!) -> SFCircularString!

    Parameters

    circularString

    circular string in meters

    Return Value

    circular string in degrees

  • Convert a compound curve in meters to a compound curve in degrees

    Declaration

    Objective-C

    + (SFCompoundCurve *)metersToDegreesWithCompoundCurve:
        (SFCompoundCurve *)compoundCurve;

    Swift

    class func metersToDegrees(with compoundCurve: SFCompoundCurve!) -> SFCompoundCurve!

    Parameters

    compoundCurve

    compound curve in meters

    Return Value

    compound curve in degrees

  • Convert a curve polygon in meters to a curve polygon in degrees

    Declaration

    Objective-C

    + (SFCurvePolygon *)metersToDegreesWithCurvePolygon:
        (SFCurvePolygon *)curvePolygon;

    Swift

    class func metersToDegrees(with curvePolygon: SFCurvePolygon!) -> SFCurvePolygon!

    Parameters

    curvePolygon

    curve polygon in meters

    Return Value

    curve polygon in degrees

  • Convert a polyhedral surface in meters to a polyhedral surface in degrees

    Declaration

    Objective-C

    + (SFPolyhedralSurface *)metersToDegreesWithPolyhedralSurface:
        (SFPolyhedralSurface *)polyhedralSurface;

    Swift

    class func metersToDegrees(with polyhedralSurface: SFPolyhedralSurface!) -> SFPolyhedralSurface!

    Parameters

    polyhedralSurface

    polyhedral surface in meters

    Return Value

    polyhedral surface in degrees

  • Convert a TIN in meters to a TIN in degrees

    Declaration

    Objective-C

    + (SFTIN *)metersToDegreesWithTIN:(SFTIN *)tin;

    Swift

    class func metersToDegrees(with tin: SFTIN!) -> SFTIN!

    Parameters

    tin

    TIN in meters

    Return Value

    TIN in degrees

  • Convert a triangle in meters to a triangle in degrees

    Declaration

    Objective-C

    + (SFTriangle *)metersToDegreesWithTriangle:(SFTriangle *)triangle;

    Swift

    class func metersToDegrees(with triangle: SFTriangle!) -> SFTriangle!

    Parameters

    triangle

    triangle in meters

    Return Value

    triangle in degrees

  • Get a WGS84 bounded geometry envelope

    Declaration

    Objective-C

    + (SFGeometryEnvelope *)wgs84Envelope;

    Swift

    class func wgs84Envelope() -> SFGeometryEnvelope!

    Return Value

    geometry envelope

  • Get a WGS84 bounded geometry envelope used for projection transformations (degrees to meters)

    Declaration

    Objective-C

    + (SFGeometryEnvelope *)wgs84TransformableEnvelope;

    Swift

    class func wgs84TransformableEnvelope() -> SFGeometryEnvelope!

    Return Value

    geometry envelope

  • Get a Web Mercator bounded geometry envelope

    Declaration

    Objective-C

    + (SFGeometryEnvelope *)webMercatorEnvelope;

    Swift

    class func webMercatorEnvelope() -> SFGeometryEnvelope!

    Return Value

    geometry envelope

  • Get a WGS84 geometry envelope with Web Mercator bounds

    Declaration

    Objective-C

    + (SFGeometryEnvelope *)wgs84EnvelopeWithWebMercator;

    Swift

    class func wgs84EnvelopeWithWebMercator() -> SFGeometryEnvelope!

    Return Value

    geometry envelope

  • Crop the geometry in meters by web mercator world bounds. Cropping removes points outside the envelope and creates new points on the line intersections with the envelope.

    Declaration

    Objective-C

    + (SFGeometry *)cropWebMercatorGeometry:(SFGeometry *)geometry;

    Swift

    class func cropWebMercatorGeometry(_ geometry: SFGeometry!) -> SFGeometry!

    Parameters

    geometry

    geometry in meters

    Return Value

    cropped geometry in meters or null

  • Crop the geometry in meters by the envelope bounds in meters. Cropping removes points outside the envelope and creates new points on the line intersections with the envelope.

    Declaration

    Objective-C

    + (SFGeometry *)cropGeometry:(SFGeometry *)geometry
                    withEnvelope:(SFGeometryEnvelope *)envelope;

    Swift

    class func cropGeometry(_ geometry: SFGeometry!, with envelope: SFGeometryEnvelope!) -> SFGeometry!

    Parameters

    geometry

    geometry in meters

    envelope

    envelope in meters

    Return Value

    cropped geometry in meters or null

  • Crop the point by the envelope bounds.

    Declaration

    Objective-C

    + (SFPoint *)cropPoint:(SFPoint *)point
              withEnvelope:(SFGeometryEnvelope *)envelope;

    Swift

    class func cropPoint(_ point: SFPoint!, with envelope: SFGeometryEnvelope!) -> SFPoint!

    Parameters

    point

    point

    envelope

    envelope

    Return Value

    cropped point or null

  • Crop the list of consecutive points in meters by the envelope bounds in meters. Cropping removes points outside the envelope and creates new points on the line intersections with the envelope.

    Declaration

    Objective-C

    + (NSMutableArray<SFPoint *> *)cropPoints:(NSArray<SFPoint *> *)points
                                 withEnvelope:(SFGeometryEnvelope *)envelope;

    Swift

    class func cropPoints(_ points: [SFPoint]!, with envelope: SFGeometryEnvelope!) -> NSMutableArray!

    Parameters

    points

    consecutive points

    envelope

    envelope in meters

    Return Value

    cropped points in meters or null

  • Crop the multi point by the envelope bounds.

    Declaration

    Objective-C

    + (SFMultiPoint *)cropMultiPoint:(SFMultiPoint *)multiPoint
                        withEnvelope:(SFGeometryEnvelope *)envelope;

    Swift

    class func cropMultiPoint(_ multiPoint: SFMultiPoint!, with envelope: SFGeometryEnvelope!) -> SFMultiPoint!

    Parameters

    multiPoint

    multi point

    envelope

    envelope

    Return Value

    cropped multi point or null

  • Crop the line string in meters by the envelope bounds in meters. Cropping removes points outside the envelope and creates new points on the line intersections with the envelope.

    Declaration

    Objective-C

    + (SFLineString *)cropLineString:(SFLineString *)lineString
                        withEnvelope:(SFGeometryEnvelope *)envelope;

    Swift

    class func cropLineString(_ lineString: SFLineString!, with envelope: SFGeometryEnvelope!) -> SFLineString!

    Parameters

    lineString

    line string in meters

    envelope

    envelope in meters

    Return Value

    cropped line string in meters or null

  • Crop the line in meters by the envelope bounds in meters. Cropping removes points outside the envelope and creates new points on the line intersections with the envelope.

    Declaration

    Objective-C

    + (SFLine *)cropLine:(SFLine *)line withEnvelope:(SFGeometryEnvelope *)envelope;

    Swift

    class func cropLine(_ line: SFLine!, with envelope: SFGeometryEnvelope!) -> SFLine!

    Parameters

    line

    line in meters

    envelope

    envelope in meters

    Return Value

    cropped line in meters or null

  • Crop the multi line string in meters by the envelope bounds in meters. Cropping removes points outside the envelope and creates new points on the line intersections with the envelope.

    Declaration

    Objective-C

    + (SFMultiLineString *)cropMultiLineString:(SFMultiLineString *)multiLineString
                                  withEnvelope:(SFGeometryEnvelope *)envelope;

    Swift

    class func cropMultiLineString(_ multiLineString: SFMultiLineString!, with envelope: SFGeometryEnvelope!) -> SFMultiLineString!

    Parameters

    multiLineString

    multi line string in meters

    envelope

    envelope in meters

    Return Value

    cropped multi line string in meters or null

  • Crop the polygon in meters by the envelope bounds in meters. Cropping removes points outside the envelope and creates new points on the line intersections with the envelope.

    Declaration

    Objective-C

    + (SFPolygon *)cropPolygon:(SFPolygon *)polygon
                  withEnvelope:(SFGeometryEnvelope *)envelope;

    Swift

    class func cropPolygon(_ polygon: SFPolygon!, with envelope: SFGeometryEnvelope!) -> SFPolygon!

    Parameters

    polygon

    polygon in meters

    envelope

    envelope in meters

    Return Value

    cropped polygon in meters or null

  • Crop the multi polygon in meters by the envelope bounds in meters. Cropping removes points outside the envelope and creates new points on the line intersections with the envelope.

    Declaration

    Objective-C

    + (SFMultiPolygon *)cropMultiPolygon:(SFMultiPolygon *)multiPolygon
                            withEnvelope:(SFGeometryEnvelope *)envelope;

    Swift

    class func cropMultiPolygon(_ multiPolygon: SFMultiPolygon!, with envelope: SFGeometryEnvelope!) -> SFMultiPolygon!

    Parameters

    multiPolygon

    multi polygon in meters

    envelope

    envelope in meters

    Return Value

    cropped multi polygon in meters or null

  • Crop the circular string in meters by the envelope bounds in meters. Cropping removes points outside the envelope and creates new points on the line intersections with the envelope.

    Declaration

    Objective-C

    + (SFCircularString *)cropCircularString:(SFCircularString *)circularString
                                withEnvelope:(SFGeometryEnvelope *)envelope;

    Swift

    class func cropCircularString(_ circularString: SFCircularString!, with envelope: SFGeometryEnvelope!) -> SFCircularString!

    Parameters

    circularString

    circular string in meters

    envelope

    envelope in meters

    Return Value

    cropped circular string in meters or null

  • Crop the compound curve in meters by the envelope bounds in meters. Cropping removes points outside the envelope and creates new points on the line intersections with the envelope.

    Declaration

    Objective-C

    + (SFCompoundCurve *)cropCompoundCurve:(SFCompoundCurve *)compoundCurve
                              withEnvelope:(SFGeometryEnvelope *)envelope;

    Swift

    class func cropCompoundCurve(_ compoundCurve: SFCompoundCurve!, with envelope: SFGeometryEnvelope!) -> SFCompoundCurve!

    Parameters

    compoundCurve

    compound curve in meters

    envelope

    envelope in meters

    Return Value

    cropped compound curve in meters or null

  • Crop the curve polygon in meters by the envelope bounds in meters. Cropping removes points outside the envelope and creates new points on the line intersections with the envelope.

    Declaration

    Objective-C

    + (SFCurvePolygon *)cropCurvePolygon:(SFCurvePolygon *)curvePolygon
                            withEnvelope:(SFGeometryEnvelope *)envelope;

    Swift

    class func cropCurvePolygon(_ curvePolygon: SFCurvePolygon!, with envelope: SFGeometryEnvelope!) -> SFCurvePolygon!

    Parameters

    curvePolygon

    curve polygon in meters

    envelope

    envelope in meters

    Return Value

    cropped curve polygon in meters or null

  • Crop the polyhedral surface in meters by the envelope bounds in meters. Cropping removes points outside the envelope and creates new points on the line intersections with the envelope.

    Declaration

    Objective-C

    + (SFPolyhedralSurface *)cropPolyhedralSurface:
                                 (SFPolyhedralSurface *)polyhedralSurface
                                      withEnvelope:(SFGeometryEnvelope *)envelope;

    Swift

    class func cropPolyhedralSurface(_ polyhedralSurface: SFPolyhedralSurface!, with envelope: SFGeometryEnvelope!) -> SFPolyhedralSurface!

    Parameters

    polyhedralSurface

    polyhedral surface in meters

    envelope

    envelope in meters

    Return Value

    cropped polyhedral surface in meters or null

  • Crop the TIN in meters by the envelope bounds in meters. Cropping removes points outside the envelope and creates new points on the line intersections with the envelope.

    Declaration

    Objective-C

    + (SFTIN *)cropTIN:(SFTIN *)tin withEnvelope:(SFGeometryEnvelope *)envelope;

    Swift

    class func cropTIN(_ tin: SFTIN!, with envelope: SFGeometryEnvelope!) -> SFTIN!

    Parameters

    tin

    TIN in meters

    envelope

    envelope in meters

    Return Value

    cropped TIN in meters or null

  • Crop the triangle in meters by the envelope bounds in meters. Cropping removes points outside the envelope and creates new points on the line intersections with the envelope.

    Declaration

    Objective-C

    + (SFTriangle *)cropTriangle:(SFTriangle *)triangle
                    withEnvelope:(SFGeometryEnvelope *)envelope;

    Swift

    class func cropTriangle(_ triangle: SFTriangle!, with envelope: SFGeometryEnvelope!) -> SFTriangle!

    Parameters

    triangle

    triangle in meters

    envelope

    envelope in meters

    Return Value

    cropped triangle in meters or null

  • Determine if the points are equal within the default tolerance of SF_DEFAULT_EQUAL_EPSILON. For exact equality, use SFPoint.isEqual(id).

    Declaration

    Objective-C

    + (BOOL)isEqualWithPoint1:(SFPoint *)point1 andPoint2:(SFPoint *)point2;

    Swift

    class func isEqual(withPoint1 point1: SFPoint!, andPoint2 point2: SFPoint!) -> Bool

    Parameters

    point1

    point 1

    point2

    point 2

    Return Value

    true if equal

  • Determine if the points are equal within the tolerance. For exact equality, use SFPoint.isEqual(id).

    Declaration

    Objective-C

    + (BOOL)isEqualWithPoint1:(SFPoint *)point1
                    andPoint2:(SFPoint *)point2
                   andEpsilon:(double)epsilon;

    Swift

    class func isEqual(withPoint1 point1: SFPoint!, andPoint2 point2: SFPoint!, andEpsilon epsilon: Double) -> Bool

    Parameters

    point1

    point 1

    point2

    point 2

    epsilon

    epsilon equality tolerance

    Return Value

    true if equal

  • Determine if the envelope contains the point within the default tolerance of SF_DEFAULT_EQUAL_EPSILON. For exact equality, use SFGeometryEnvelope.containsPoint(SFPoint).

    Declaration

    Objective-C

    + (BOOL)containsPoint:(SFPoint *)point
           withinEnvelope:(SFGeometryEnvelope *)envelope;

    Swift

    class func contains(_ point: SFPoint!, within envelope: SFGeometryEnvelope!) -> Bool

    Parameters

    envelope

    envelope

    point

    point

    Return Value

    true if contains

  • Determine if envelope 1 contains the envelope 2 within the default tolerance of SF_DEFAULT_EQUAL_EPSILON. For exact equality, use SFGeometryEnvelope.containsEnvelope(SFGeometryEnvelope).

    Declaration

    Objective-C

    + (BOOL)containsEnvelope:(SFGeometryEnvelope *)envelope2
              withinEnvelope:(SFGeometryEnvelope *)envelope1;

    Swift

    class func contains(_ envelope2: SFGeometryEnvelope!, within envelope1: SFGeometryEnvelope!) -> Bool

    Parameters

    envelope1

    envelope 1

    envelope2

    envelope 2

    Return Value

    true if contains

  • Bound all points in the geometry to be within WGS84 limits.

    To perform a geometry crop using line intersections, see degreesToMetersWithGeometry(SFGeometry) and cropGeometry(SFGeometry)withEnvelope:(SFGeometryEnvelope).

    Declaration

    Objective-C

    + (void)boundWGS84Geometry:(SFGeometry *)geometry;

    Swift

    class func boundWGS84Geometry(_ geometry: SFGeometry!)

    Parameters

    geometry

    geometry

  • Bound all points in the geometry to be within WGS84 projection transformable (degrees to meters) limits.

    To perform a geometry crop using line intersections, see degreesToMetersWithGeometry(SFGeometry) and cropGeometry(SFGeometry)withEnvelope:(SFGeometryEnvelope).

    Declaration

    Objective-C

    + (void)boundWGS84TransformableGeometry:(SFGeometry *)geometry;

    Swift

    class func boundWGS84TransformableGeometry(_ geometry: SFGeometry!)

    Parameters

    geometry

    geometry

  • Bound all points in the geometry to be within Web Mercator limits.

    To perform a geometry crop using line intersections, see cropWebMercatorGeometry(SFGeometry).

    Declaration

    Objective-C

    + (void)boundWebMercatorGeometry:(SFGeometry *)geometry;

    Swift

    class func boundWebMercatorGeometry(_ geometry: SFGeometry!)

    Parameters

    geometry

    geometry

  • Bound all points in the WGS84 geometry to be within degree Web Mercator limits.

    To perform a geometry crop using line intersections, see degreesToMetersWithGeometry(SFGeometry) and cropWebMercatorGeometry(SFGeometry).

    Declaration

    Objective-C

    + (void)boundWGS84WithWebMercatorGeometry:(SFGeometry *)geometry;

    Swift

    class func boundWGS84(withWebMercatorGeometry geometry: SFGeometry!)

    Parameters

    geometry

    geometry

  • Bound all points in the geometry to be within the geometry envelope. Point x and y values are bounded by the min and max envelope values.

    To perform a geometry crop using line intersections, see cropGeometry(SFGeometry)withEnvelope:(SFGeometryEnvelope) (requires geometry in meters).

    Declaration

    Objective-C

    + (void)boundGeometry:(SFGeometry *)geometry
             withEnvelope:(SFGeometryEnvelope *)envelope;

    Swift

    class func boundGeometry(_ geometry: SFGeometry!, with envelope: SFGeometryEnvelope!)

    Parameters

    geometry

    geometry

    envelope

    geometry envelope

  • Determine if the geometries contain a Z value

    Declaration

    Objective-C

    + (BOOL)hasZ:(NSArray<SFGeometry *> *)geometries;

    Swift

    class func hasZ(_ geometries: [SFGeometry]!) -> Bool

    Parameters

    geometries

    list of geometries

    Return Value

    true if has z

  • Determine if the geometries contain a M value

    Declaration

    Objective-C

    + (BOOL)hasM:(NSArray<SFGeometry *> *)geometries;

    Swift

    class func hasM(_ geometries: [SFGeometry]!) -> Bool

    Parameters

    geometries

    list of geometries

    Return Value

    true if has m

  • Get the parent type hierarchy of the provided geometry type starting with the immediate parent. If the argument is GEOMETRY, an empty list is returned, else the final type in the list will be GEOMETRY.

    Declaration

    Objective-C

    + (NSArray<NSNumber *> *)parentHierarchyOfType:
        (enum SFGeometryType)geometryType;

    Swift

    class func parentHierarchy(of geometryType: SFGeometryType) -> [NSNumber]!

    Parameters

    geometryType

    geometry type

    Return Value

    list of increasing parent types

  • Get the parent Geometry Type of the provided geometry type

    Declaration

    Objective-C

    + (enum SFGeometryType)parentTypeOfType:(enum SFGeometryType)geometryType;

    Swift

    class func parentType(of geometryType: SFGeometryType) -> SFGeometryType

    Parameters

    geometryType

    geometry type

    Return Value

    parent geometry type or null if argument is GEOMETRY (no parent type)

  • Get the child type hierarchy of the provided geometry type.

    Declaration

    Objective-C

    + (NSDictionary<NSNumber *, NSDictionary *> *)childHierarchyOfType:
        (enum SFGeometryType)geometryType;

    Swift

    class func childHierarchy(of geometryType: SFGeometryType) -> [NSNumber : [AnyHashable : Any]]!

    Parameters

    geometryType

    geometry type

    Return Value

    child type hierarchy, null if no children

  • Get the immediate child Geometry Types of the provided geometry type

    Declaration

    Objective-C

    + (NSArray<NSNumber *> *)childTypesOfType:(enum SFGeometryType)geometryType;

    Swift

    class func childTypes(of geometryType: SFGeometryType) -> [NSNumber]!

    Parameters

    geometryType

    geometry type

    Return Value

    child geometry types, empty list if no child types

  • Encode the geometry to data

    Declaration

    Objective-C

    + (NSData *)encodeGeometry:(SFGeometry *)geometry;

    Swift

    class func encode(_ geometry: SFGeometry!) -> Data!

    Parameters

    geometry

    geometry

    Return Value

    encoded dta

  • Decode the data into a geometry

    Declaration

    Objective-C

    + (SFGeometry *)decodeGeometry:(NSData *)data;

    Swift

    class func decodeGeometry(_ data: Data!) -> SFGeometry!

    Parameters

    data

    encoded data

    Return Value

    geometry