MBMProjection


@interface MBMProjection : NSObject

Collection of Spherical Mercator projection methods.

  • Unavailable

    Undocumented

    Declaration

    Objective-C

    - (nonnull instancetype)init NS_UNAVAILABLE;
  • Unavailable

    Undocumented

    Declaration

    Objective-C

    + (nonnull instancetype)new NS_UNAVAILABLE;
  • Calculate distance spanned by one pixel at the specified latitude and zoom level.

    Declaration

    Objective-C

    + (double)getMetersPerPixelAtLatitudeForLatitude:(double)latitude
                                                zoom:(double)zoom;

    Swift

    class func getMetersPerPixelAtLatitude(forLatitude latitude: Double, zoom: Double) -> Double

    Parameters

    latitude

    The latitude for which to return the value.

    zoom

    The zoom level.

    Return Value

    Returns the distance measured in meters.

  • Calculate Spherical Mercator ProjectedMeters coordinates.

    Declaration

    Objective-C

    + (nonnull MBMProjectedMeters *)projectedMetersForCoordinateForCoordinate:
        (CLLocationCoordinate2D)coordinate;

    Swift

    class func projectedMetersForCoordinate(for coordinate: CLLocationCoordinate2D) -> MBMProjectedMeters

    Parameters

    coordinate

    A longitude-latitude pair for which to calculate projected meters coordinates.

    Return Value

    Returns Spherical Mercator ProjectedMeters coordinates.

  • Calculate a longitude-latitude pair for a Spherical Mercator projected meters.

    Declaration

    Objective-C

    + (CLLocationCoordinate2D)coordinateForProjectedMetersForProjectedMeters:
        (nonnull MBMProjectedMeters *)projectedMeters;

    Swift

    class func coordinateForProjectedMeters(for projectedMeters: MBMProjectedMeters) -> CLLocationCoordinate2D

    Parameters

    projectedMeters

    Spherical Mercator ProjectedMeters coordinates for which to calculate a longitude-latitude pair.

    Return Value

    Returns a longitude-latitude pair.

  • Calculate a point on the map in Mercator Projection for a given coordinate at the specified zoom scale.

    Declaration

    Objective-C

    + (nonnull MBMMercatorCoordinate *)projectForCoordinate:
                                           (CLLocationCoordinate2D)coordinate
                                                  zoomScale:(double)zoomScale;

    Swift

    class func project(for coordinate: CLLocationCoordinate2D, zoomScale: Double) -> MBMMercatorCoordinate

    Parameters

    coordinate

    The longitude-latitude pair for which to return the value.

    zoomScale

    The current zoom factor (2 ^ Zoom level) applied on the map, is used to calculate the world size as tileSize * zoomScale (i.e., 512 * 2 ^ Zoom level) where tileSize is the width of a tile in pixels.

    Return Value

    Returns a point on the map in Mercator projection.

  • Calculate a coordinate for a given point on the map in Mercator Projection.

    Declaration

    Objective-C

    + (CLLocationCoordinate2D)unprojectForCoordinate:
                                  (nonnull MBMMercatorCoordinate *)coordinate
                                           zoomScale:(double)zoomScale;

    Swift

    class func unproject(for coordinate: MBMMercatorCoordinate, zoomScale: Double) -> CLLocationCoordinate2D

    Parameters

    coordinate

    Point on the map in Mercator projection.

    zoomScale

    The current zoom factor applied on the map, is used to calculate the world size as tileSize * zoomScale (i.e., 512 * 2 ^ Zoom level) where tileSize is the width of a tile in pixels.

    Return Value

    Returns a coordinate.