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 `init(_:)` and `coordinate` functions.

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

## Topics

### Creating a Map Point

`init(x: Double, y: Double)`

Creates a new `MKMapPoint` structure from the specified values.

`init(CLLocationCoordinate2D)`

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

### Getting the Point 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.

`var coordinate: CLLocationCoordinate2D`

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

### Comparing Map Points

`func MKMapPointEqualToPoint(MKMapPoint, MKMapPoint) -> Bool`

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

### Getting the Distance Between Points

`func distance(to: MKMapPoint) -> CLLocationDistance`

Returns the number of meters between two map points.

`func MKMetersPerMapPointAtLatitude(CLLocationDegrees) -> CLLocationDistance`

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

`func MKMapPointsPerMeterAtLatitude(CLLocationDegrees) -> Double`

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

### Getting a Description of the Point

`func MKStringFromMapPoint(MKMapPoint) -> String`

Returns a formatted string for the specified map point.

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