iOS Developer Library — Prerelease

Developer

MKRoute Class Reference

Options
Deployment Target:

On This Page

MKRoute

The MKRoute class defines a single route that the user can follow between a requested start and end point. The route object defines the geometry for the route and includes information you can display to the user in association with that route, such as the name of the route, its distance, and the expected travel time.

You do not create instances of this class directly. Instead, you receive route objects when you request directions from the Maps app. For more information about requesting directions, see MKDirections Class Reference.

  • The detailed route geometry. (read-only)

    Declaration

    @property (nonatomic, readonly) MKPolyline *polyline

    Discussion

    The polyline object in this property reflects the complete path of the route, including all of its steps. You can use the polyline object as an overlay in a map view.

  • The array of steps that comprise the overall route. (read-only)

    Declaration

    @property (nonatomic, readonly) NSArray *steps

    Discussion

    The array contains one or more MKRouteStep objects representing distinct portions of the route. Each step corresponds to a single direction that must be followed along the route.

  • The name assigned to the route. (read-only)

    Declaration

    @property (nonatomic, readonly) NSString *name

    Discussion

    The string in this property is localized according to the user’s language preferences. You can display this string to the user from your app’s user interface so that the user can distinguish one route from another.

    The string itself describes the route using one of the route’s significant features. For example, a route that uses a major highway for a significant portion of the route might use that highway for its name.

  • An array of advisory notice strings for the route. (read-only)

    Declaration

    @property (nonatomic, readonly) NSArray *advisoryNotices

    Discussion

    This property contains an array of NSString objects. Each string is localized according to the user’s language preferences. The strings contain additional information that is important for the user to know about the route. For example, a string might note that a portion of the route is closed during the winter or after big storms.

  • The route distance in meters. (read-only)

    Declaration

    @property (nonatomic, readonly) CLLocationDistance distance

    Discussion

    This property reflects the distance that the user covers while traversing the path of the route. It is not a direct distance between the start and end points of the route.

  • The expected travel time in seconds. (read-only)

    Declaration

    @property (nonatomic, readonly) NSTimeInterval expectedTravelTime

    Discussion

    This expected travel time reflects the time it takes to traverse the route under ideal conditions. The actual amount of time may vary based on conditions.

  • The overall route transport type. (read-only)

    Declaration

    @property (nonatomic, readonly) MKDirectionsTransportType transportType

    Discussion

    This property reflects the primary transport type used for the route. Individual steps of the route might use different transport types.