Projection

public final class Projection

Undocumented

  • Undocumented

    Declaration

    Swift

    public static let latitudeMax: CLLocationDegrees
  • Undocumented

    Declaration

    Swift

    public static let latitudeMin: CLLocationDegrees
  • Calculate distance spanned by one pixel at the specified latitude and zoom level.

    Declaration

    Swift

    public static func metersPerPoint(for latitude: CLLocationDegrees, zoom: CGFloat) -> Double

    Parameters

    latitude

    The latitude for which to return the value

    zoom

    The zoom level

    Return Value

    Meters

  • Calculate Spherical Mercator ProjectedMeters coordinates.

    Declaration

    Swift

    public static func projectedMeters(for coordinate: CLLocationCoordinate2D) -> ProjectedMeters

    Parameters

    coordinate

    Coordinate at which to calculate the projected meters

    Return Value

    Spherical Mercator ProjectedMeters coordinates

  • Calculate a coordinate for a Spherical Mercator projected meters.

    Declaration

    Swift

    public static func coordinate(for projectedMeters: ProjectedMeters) -> CLLocationCoordinate2D

    Parameters

    projectedMeters

    Spherical Mercator ProjectedMeters coordinates

    Return Value

    A coordinate

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

    Note

    Coordinate latitudes will be clamped to [Projection.latitudeMin, Projection.latitudeMax]

    Declaration

    Swift

    public static func project(_ coordinate: CLLocationCoordinate2D, zoomScale: CGFloat) -> MercatorCoordinate

    Parameters

    coordinate

    The coordinate for which to return the value.

    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 points.

    Return Value

    Mercator coordinate

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

    Declaration

    Swift

    public static func unproject(_ mercatorCoordinate: MercatorCoordinate, zoomScale: CGFloat) -> CLLocationCoordinate2D

    Parameters

    mercatorCoordinate

    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 points.

    Return Value

    Unprojected coordinate