Structure

MKMapPoint

A point on a two-dimensional map projection.

Overview

If you project the curved surface of the globe onto a flat surface, what you get is a two-dimensional version of a map where longitude lines appear to be parallel. Such maps are often used to show the entire surface of the globe all at once. An MKMapPoint data structure represents a point on this two-dimensional map.

The actual units of a map point are tied to the underlying units used to draw the contents of an MKMapView, but you should never need to worry about these units directly. You use map points primarily to simplify computations that would be complex to do using coordinate values on a curved surface. By converting to map points, you can perform those calculations on a flat surface, which is generally much simpler, and then convert back as needed. You can map between coordinate values and map points using the MKMapPointForCoordinate(_:) and MKCoordinateForMapPoint(_:) functions.

When saving map-related data to a file, you should always save coordinate values (latitude and longitude) and not map points.

Topics

Coordinates

var x: Double

The location of the point along the x-axis of the map.

var y: Double

The location of the point along the y-axis of the map.

Creation

func MKMapPointMake(Double, Double)

Creates a new MKMapPoint structure from the specified values.

Conversion

func MKMapPointForCoordinate(CLLocationCoordinate2D)

Returns the map point data structure that corresponds to the specified coordinate.

func MKCoordinateForMapPoint(MKMapPoint)

Returns the latitude and longitude that corresponds to the specified map point.

func MKStringFromMapPoint(MKMapPoint)

Returns a formatted string for the specified map point.

Comparison

func MKMapPointEqualToPoint(MKMapPoint, MKMapPoint)

Returns a Boolean value indicating whether the two map points are equal.

Distances

func MKMetersBetweenMapPoints(MKMapPoint, MKMapPoint)

Returns the number of meters between two map points.

func MKMetersPerMapPointAtLatitude(CLLocationDegrees)

Returns the distance spanned by one map point at the specified latitude.

func MKMapPointsPerMeterAtLatitude(CLLocationDegrees)

Returns the number of map points that represent one meter at the given latitude.

See Also

Map Coordinates

struct MKCoordinateRegion

A rectangular geographic region centered around a specific latitude and longitude.

struct MKCoordinateSpan

The width and height of a map region.

struct MKMapRect

A rectangular area on a two-dimensional map projection.

struct MKMapSize

Width and height information on a two-dimensional map projection.

class MKDistanceFormatter

A utility object that converts between a geographic distance and a string-based expression of that distance.