Functions
The following functions are available globally.
-
Undocumented
Declaration
Objective-C
void NSDictionaryStyleDummyFunc(void)
Swift
func NSDictionaryStyleDummyFunc()
-
Convert a MaplyTileID to an NSString
Declaration
Objective-C
NSString *_Nonnull MaplyTileIDString(MaplyTileID tileID)
Swift
func MaplyTileIDString(_ tileID: MaplyTileID) -> String
-
Construct a MaplyCoordiante with longitude and latitude values in radians.
MaplyCoordinate’s are in radians when they represent lon/lat values. This constructs one with radians as input.
Declaration
Objective-C
MaplyCoordinate MaplyCoordinateMake(float radLon, float radLat)
Swift
func MaplyCoordinateMake(_ radLon: Float, _ radLat: Float) -> MaplyCoordinate
Return Value
A 2D MaplyCoordinate in radians (if representing a lon/lat value).
-
Construct a MaplyCoordianteD with longitude and latitude values in radians.
MaplyCoordinate’s are in radians when they represent lon/lat values. This constructs one with radians as input.
Declaration
Objective-C
MaplyCoordinateD MaplyCoordinateDMake(double radLon, double radLat)
Swift
func MaplyCoordinateDMake(_ radLon: Double, _ radLat: Double) -> MaplyCoordinateD
Return Value
A 2D MaplyCoordinateD in radians (if representing a lon/lat value).
-
Construct a MaplyGeoCoordinate with longitude and latitude values in degrees.
MaplyCoordinate’s are in radians when they represent lon/lat values. This function does that conversion for you.
Declaration
Objective-C
MaplyCoordinate MaplyCoordinateMakeWithDegrees(float degLon, float degLat)
Swift
func MaplyCoordinateMakeWithDegrees(_ degLon: Float, _ degLat: Float) -> MaplyCoordinate
Parameters
degLon
The longitude value (east to west) in degrees.
degLat
The latitude value (north to south) in degrees.
Return Value
A 2D MaplyCoordinate in radians (if representing a lon/lat value).
-
Construct a MaplyGeoCoordinate with longitude and latitude values in degrees.
MaplyCoordinate’s are in radians when they represent lon/lat values. This function does that conversion for you.
Declaration
Objective-C
MaplyCoordinateD MaplyCoordinateDMakeWithDegrees(double degLon, double degLat)
Swift
func MaplyCoordinateDMakeWithDegrees(_ degLon: Double, _ degLat: Double) -> MaplyCoordinateD
Parameters
degLon
The longitude value (east to west) in degrees.
degLat
The latitude value (north to south) in degrees.
Return Value
A 2D MaplyCoordinate in radians (if representing a lon/lat value).
-
Construct a MaplyCoordinateD with a MaplyCoordinate.
This function constructs a MaplyCoordinateD with the component values of the input MaplyCoordinate.
Declaration
Objective-C
MaplyCoordinateD MaplyCoordinateDMakeWithMaplyCoordinate(MaplyCoordinate c)
Swift
func MaplyCoordinateDMakeWithMaplyCoordinate(_ c: MaplyCoordinate) -> MaplyCoordinateD
Parameters
c
The input MaplyCoordinate value.
Return Value
A 2D MaplyCoordinateD in radians (if representing a lon/lat value).
-
Construct a MaplyCoordinat3d from the values given.
Declaration
Objective-C
MaplyCoordinate3d MaplyCoordinate3dMake(float x, float y, float z)
Swift
func MaplyCoordinate3dMake(_ x: Float, _ y: Float, _ z: Float) -> MaplyCoordinate3d
Parameters
x
The x value, or longitude in radians if we’re making geo coordinates.
y
The y value, or latitude in radians if we’re making geo coordinates.
z
The z value, sometimes this is display coordinates (radius == 1.0 for a sphere) and sometimes this is meters. It depends on how you’re using it.
Return Value
A 3D MaplyCoordinate3d in radians + other (if representing a lon/lat value).
-
Construct a MaplyCoordinat3d from the values given.
Declaration
Objective-C
MaplyCoordinate3dD MaplyCoordinate3dDMake(double x, double y, double z)
Swift
func MaplyCoordinate3dDMake(_ x: Double, _ y: Double, _ z: Double) -> MaplyCoordinate3dD
Parameters
x
The x value, or longitude in radians if we’re making geo coordinates.
y
The y value, or latitude in radians if we’re making geo coordinates.
z
The z value, sometimes this is display coordinates (radius == 1.0 for a sphere) and sometimes this is meters. It depends on how you’re using it.
Return Value
A 3D MaplyCoordinate3d in radians + other (if representing a lon/lat value).
-
Construct a MaplyBoundingBox from the values given.
The inputs are in degrees and the order is longitude then latitude.
Declaration
Objective-C
MaplyBoundingBox MaplyBoundingBoxMakeWithDegrees(float degLon0, float degLat0, float degLon1, float degLat1)
Swift
func MaplyBoundingBoxMakeWithDegrees(_ degLon0: Float, _ degLat0: Float, _ degLon1: Float, _ degLat1: Float) -> MaplyBoundingBox
Parameters
degLon0
The left side of the bounding box in degrees.
degLat0
The bottom of the bounding box in degrees.
degLon1
The right side of the bounding box in degrees.
degLat1
The top of the bounding box in degrees.
Return Value
A MaplyBoundingBox in radians.
-
Double version of MaplyBoundingBoxMakeWithDegrees
Declaration
Objective-C
MaplyBoundingBoxD MaplyBoundingBoxDMakeWithDegrees(double degLon0, double degLat0, double degLon1, double degLat1)
Swift
func MaplyBoundingBoxDMakeWithDegrees(_ degLon0: Double, _ degLat0: Double, _ degLon1: Double, _ degLat1: Double) -> MaplyBoundingBoxD
-
Check if two bounding boxes overlap.
Declaration
Objective-C
_Bool MaplyBoundingBoxesOverlap(MaplyBoundingBox bbox0, MaplyBoundingBox bbox1)
Swift
func MaplyBoundingBoxesOverlap(_ bbox0: MaplyBoundingBox, _ bbox1: MaplyBoundingBox) -> Bool
Return Value
Returns true if they did overlap, false otherwise.
-
Check if a bounding contains a given coordinate.
Declaration
Objective-C
_Bool MaplyBoundingBoxContains(MaplyBoundingBox bbox, MaplyCoordinate c)
Swift
func MaplyBoundingBoxContains(_ bbox: MaplyBoundingBox, _ c: MaplyCoordinate) -> Bool
Return Value
Returns true if the bounding box contains the coordinate.
-
Set up a bounding box from a list of 2D locations.
Declaration
Objective-C
MaplyBoundingBox MaplyBoundingBoxFromLocations(const CLLocationCoordinate2D locs[], unsigned int numLocs)
Swift
func MaplyBoundingBoxFromLocations(_ locs: UnsafePointer<CLLocationCoordinate2D>!, _ numLocs: UInt32) -> MaplyBoundingBox
-
Return the intersection of two bounding boxes.
Declaration
Objective-C
MaplyBoundingBox MaplyBoundingBoxIntersection(MaplyBoundingBox bbox0, MaplyBoundingBox bbox1)
Swift
func MaplyBoundingBoxIntersection(_ bbox0: MaplyBoundingBox, _ bbox1: MaplyBoundingBox) -> MaplyBoundingBox
-
Expands a bounding box by a given fraction of its size.
Declaration
Objective-C
MaplyBoundingBox MaplyBoundingBoxExpandByFraction(MaplyBoundingBox bbox, float buffer)
Swift
func MaplyBoundingBoxExpandByFraction(_ bbox: MaplyBoundingBox, _ buffer: Float) -> MaplyBoundingBox
Return Value
Returns the expanded bounding box.
-
Calculate the great circle distance between two geo coordinates.
This calculates the distance on a sphere between one point and another.
Declaration
Objective-C
double MaplyGreatCircleDistance(MaplyCoordinate p0, MaplyCoordinate p1)
Swift
func MaplyGreatCircleDistance(_ p0: MaplyCoordinate, _ p1: MaplyCoordinate) -> Double
Parameters
p0
The starting point, lon/lat in radians.
p1
The end point, lon/lat in radians.
Return Value
The distance between p0 and p1 in meters.
-
Generate the correct coordinate system from a standard EPSG.
This returns the correct coordinate system from a standard EPSG string.
The list of available coordinate systems is very short.
Declaration
Objective-C
MaplyCoordinateSystem *_Nullable MaplyCoordinateSystemFromEPSG( NSString *_Nonnull crs)
Swift
func MaplyCoordinateSystemFromEPSG(_ crs: String) -> MaplyCoordinateSystem?
-
Use a style delegate to interpret vector data.
Run the style delegate against the given vectors. The resulting features are added to the given view controller using the thread mode specified.
Declaration
Objective-C
NSArray *_Nonnull AddMaplyVectorsUsingStyle( NSArray *_Nonnull vecObjs, NSObject<MaplyVectorStyleDelegate> *_Nonnull styleDelegate, NSObject<MaplyRenderControllerProtocol> *_Nonnull viewC, MaplyThreadMode threadMode)
Swift
func AddMaplyVectorsUsingStyle(_ vecObjs: [Any], _ styleDelegate: MaplyVectorStyleDelegate, _ viewC: NSObjectProtocol & MaplyRenderControllerProtocol, _ threadMode: MaplyThreadMode) -> [Any]
Parameters
vecObjs
An array of MaplyVectorObject.
styleDelegate
The style delegate that controls how the vectors will look.
viewC
View controller to add the geometry to.
threadMode
MaplyThreadCurrent will block until all the features are added. MaplyThreadAny will do some of the work on another thread.