# MaplyCoordinateSystem

Objective-C

``@interface MaplyCoordinateSystem : NSObject``

Swift

``class MaplyCoordinateSystem : NSObject``

Coordinate system for tiling systems and data sources and such.

This object represents the spatial reference system and bounding box for objects like the MaplyTileSource or vectors or other things. Not all data is in lat/lon geographic (actually MaplyPlateCaree) nor is it always in MaplySphericalMercator. Sometimes it’s in one or the other, or a bit of both.

We use this base class to express the coordinate system and we threw in the bounding box, which we will surely come to regret. Oh well, it’s in there.

This object gets passed around to tell us what coordinate system data is in or how we’re displaying things. Right now only MaplySphericalMercator and MaplyPlateCarree are represented. In the future, there will be more.

• ``` -setBounds: ```

Set the bounding box in the local coordinate system.

This is the bounding box, for things like display coordinates. If the extents would normally be in degrees, use radians. Otherwise, the values are in the local system.

#### Declaration

Objective-C

``- (void)setBounds:(MaplyBoundingBox)bounds;``

Swift

``func setBounds(_ bounds: MaplyBoundingBox)``
• ``` -setBoundsD: ```

Set the bounding box in the local coordinate system.

This is the bounding box, for things like display coordinates. If the extents would normally be in degrees, use radians. Otherwise, the values are in the local system.

#### Declaration

Objective-C

``- (void)setBoundsD:(MaplyBoundingBoxD)boundsD;``

Swift

``func setBoundsD(_ boundsD: MaplyBoundingBoxD)``
• ``` -setBoundsLL:ur: ```

Set the bounding box in the local coordinate system.

This is the bounding box, for things like display coordinates. If the extents would normally be in degrees, use radians. Otherwise, the values are in the local system.

#### Declaration

Objective-C

``````- (void)setBoundsLL:(MaplyCoordinate *_Nonnull)ll
ur:(MaplyCoordinate *_Nonnull)ll;``````

Swift

``func setBoundsLL(_ ll: UnsafeMutablePointer<MaplyCoordinate>, ur ll: UnsafeMutablePointer<MaplyCoordinate>)``
• ``` -getBounds ```

Return the bounding box in local coordinates.

This is the bounding box in local coordinates, or if the extents would normally be expressed in degrees, it’s radians.

#### Declaration

Objective-C

``- (MaplyBoundingBox)getBounds;``

Swift

``func getBounds() -> MaplyBoundingBox``
• ``` -getBoundsLL:ur: ```

Return the bounding box in local coordinates.

This is the bounding box in local coordinates, or if the extents would normally be expressed in degrees, it’s radians.

#### Declaration

Objective-C

``````- (void)getBoundsLL:(MaplyCoordinate *_Nonnull)ret_ll
ur:(MaplyCoordinate *_Nonnull)ret_ur;``````

Swift

``func getBoundsLL(_ ret_ll: UnsafeMutablePointer<MaplyCoordinate>, ur ret_ur: UnsafeMutablePointer<MaplyCoordinate>)``
• ``` -geoToLocal: ```

Convert a coordinate from geographic to the local coordinate system.

Take a geo coordinate (lon/lat in radians) and convert to the local space.

#### Declaration

Objective-C

``- (MaplyCoordinate)geoToLocal:(MaplyCoordinate)coord;``

Swift

``func geo(toLocal coord: MaplyCoordinate) -> MaplyCoordinate``
• ``` -localToGeo: ```

Convert a coordinate from the local space to geographic.

This takes a coordinate in this coordinate system and converts it to geographic (lat/lon in radians).

#### Declaration

Objective-C

``- (MaplyCoordinate)localToGeo:(MaplyCoordinate)coord;``

Swift

``func local(toGeo coord: MaplyCoordinate) -> MaplyCoordinate``
• ``` -localToGeocentric: ```

Convert a 3D coordinate from the local space to geocentric.

This takes a 3D coordinate (including height) and converts it to geocentric in WGS84.

#### Declaration

Objective-C

``- (MaplyCoordinate3dD)localToGeocentric:(MaplyCoordinate3dD)coord;``

Swift

``func local(toGeocentric coord: MaplyCoordinate3dD) -> MaplyCoordinate3dD``
• ``` -geocentricToLocal: ```

Convert a 3D coordinate from geocentric to the local space.

This takes a 3D geocentric coordinate (WGS84) and converts it to the local space, including height;

#### Declaration

Objective-C

``- (MaplyCoordinate3dD)geocentricToLocal:(MaplyCoordinate3dD)coord;``

Swift

``func geocentric(toLocal coord: MaplyCoordinate3dD) -> MaplyCoordinate3dD``
• ``` -getSRS ```

Express the coordinate system in an SRS compatible string.

#### Declaration

Objective-C

``- (NSString *_Nonnull)getSRS;``

Swift

``func getSRS() -> String``
• ``` -canBeDegrees ```

Can this coordinate system be expressed in degrees?

This is set for coordinate systems that express their extents in degrees. This is useful for cases where we need to construct some metadata to go along with the system and you’d normally expect it to be in degrees rather than radians.

#### Declaration

Objective-C

``- (_Bool)canBeDegrees;``

Swift

``func canBeDegrees() -> Bool``