iOS Developer Library

Developer

MapKit Framework Reference MapKit Data Types Reference

Options
Deployment Target:

On This Page
Language:

MapKit Data Types Reference

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Swift

import MapKit

Objective-C

@import MapKit;

This document describes the data types found in the Map Kit framework.

Data Types

  • A structure that defines the area spanned by a map region.

    Declaration

    Swift

    struct MKCoordinateSpan { var latitudeDelta: CLLocationDegrees var longitudeDelta: CLLocationDegrees init() init(latitudeDelta latitudeDelta: CLLocationDegrees, longitudeDelta longitudeDelta: CLLocationDegrees) }

    Objective-C

    typedef struct { CLLocationDegrees latitudeDelta; CLLocationDegrees longitudeDelta; } MKCoordinateSpan;

    Fields

    latitudeDelta

    The amount of north-to-south distance (measured in degrees) to display on the map. Unlike longitudinal distances, which vary based on the latitude, one degree of latitude is always approximately 111 kilometers (69 miles).

    longitudeDelta

    The amount of east-to-west distance (measured in degrees) to display for the map region. The number of kilometers spanned by a longitude range varies based on the current latitude. For example, one degree of longitude spans a distance of approximately 111 kilometers (69 miles) at the equator but shrinks to 0 kilometers at the poles.

    Discussion

    You use the delta values in this structure to indicate the desired zoom level of the map, with smaller delta values corresponding to a higher zoom level.

    Availability

    Available in iOS 3.0 and later.

  • A structure that defines which portion of the map to display.

    Declaration

    Swift

    struct MKCoordinateRegion { var center: CLLocationCoordinate2D var span: MKCoordinateSpan init() init(center center: CLLocationCoordinate2D, span span: MKCoordinateSpan) }

    Objective-C

    typedef struct { CLLocationCoordinate2D center; MKCoordinateSpan span; } MKCoordinateRegion;

    Fields

    center

    The center point of the region.

    span

    The horizontal and vertical span representing the amount of map to display. The span also defines the current zoom level used by the map view object.

    Availability

    Available in iOS 3.0 and later.

  • A point on a two-dimensional map projection.

    Declaration

    Swift

    struct MKMapPoint { var x: Double var y: Double init() init(x x: Double, y y: Double) }

    Objective-C

    typedef struct { double x; double y; } MKMapPoint;

    Fields

    x

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

    y

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

    Discussion

    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.

    Availability

    Available in iOS 4.0 and later.

  • Size information as measured on a two-dimensional map projection.

    Declaration

    Swift

    struct MKMapSize { var width: Double var height: Double init() init(width width: Double, height height: Double) }

    Objective-C

    typedef struct { double width; double height; } MKMapSize;

    Fields

    width

    The width value. The units of this value are map points.

    height

    The height value. The units of this value are map points.

    Discussion

    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 MKMapSize data structure represents a horizontal and vertical distance as measured on this two-dimensional map.

    Availability

    Available in iOS 4.0 and later.

  • A rectangular area as measured on a two-dimensional map projection.

    Declaration

    Swift

    struct MKMapRect { var origin: MKMapPoint var size: MKMapSize init() init(origin origin: MKMapPoint, size size: MKMapSize) }

    Objective-C

    typedef struct { MKMapPoint origin; MKMapSize size; } MKMapRect;

    Fields

    origin

    The origin point of the rectangle.

    size

    The width and height of the rectangle, starting from the origin point.

    Discussion

    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 MKMapRect data structure represents a rectangular area as seen on this two-dimensional map.

    Availability

    Available in iOS 4.0 and later.

  • A scale factor being used in conjunction with a map.

    Declaration

    Swift

    typealias MKZoomScale = CGFloat

    Objective-C

    typedef CGFloat MKZoomScale;

    Import Statement

    Objective-C

    @import MapKit;

    Swift

    import MapKit

    Availability

    Available in iOS 4.0 and later.