GPKGGeometryUtils

Objective-C

@interface GPKGGeometryUtils : NSObject

Swift

class GPKGGeometryUtils : NSObject

Geometry Utilities

  • Returns the area of a closed path on Earth.

    Written from the Android SphericalUtil implementation.

    Declaration

    Objective-C

    + (double)computeAreaOfDegreesPath:(NSArray<SFPoint *> *)path;

    Swift

    class func computeArea(ofDegreesPath path: [SFPoint]!) -> Double

    Parameters

    path

    A closed path in degree units.

    Return Value

    The path’s area in square meters.

  • Returns the signed area of a closed path on Earth. The sign of the area may be used to determine the orientation of the path. “inside” is the surface that does not contain the South Pole.

    Written from the Android SphericalUtil implementation.

    Declaration

    Objective-C

    + (double)computeSignedAreaOfDegreesPath:(NSArray<SFPoint *> *)path;

    Swift

    class func computeSignedArea(ofDegreesPath path: [SFPoint]!) -> Double

    Parameters

    path

    A closed path in degree units.

    Return Value

    The loop’s area in square meters.

  • Check if the polygon points create a closed polygon with the first and last points at the same location

    Declaration

    Objective-C

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

    Swift

    class func isClosedPolygon(with points: [SFPoint]!) -> Bool

    Parameters

    points

    polygon points

    Return Value

    true if points create a closed polygon

  • Convert degrees to radians

    Declaration

    Objective-C

    + (double)toRadiansWithDegrees:(double)degrees;

    Swift

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

    Parameters

    degrees

    value in degrees

    Return Value

    radians

  • Convert radians to degrees

    Declaration

    Objective-C

    + (double)toDegreesWithRadians:(double)radians;

    Swift

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

    Parameters

    radians

    value in radians

    Return Value

    degrees