MKRoute Class Reference

Inherits from
Conforms to
Availability
Available in iOS 7.0 and later.
Declared in
MKDirectionsResponse.h

Overview

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.

Tasks

Getting the Route Geometry

Getting Additional Route Details

Properties

advisoryNotices

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

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

Availability
  • Available in iOS 7.0 and later.
Declared In
MKDirectionsResponse.h

distance

The route distance in meters. (read-only)

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

Availability
  • Available in iOS 7.0 and later.
Declared In
MKDirectionsResponse.h

expectedTravelTime

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

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

Availability
  • Available in iOS 7.0 and later.
Declared In
MKDirectionsResponse.h

name

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

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

Availability
  • Available in iOS 7.0 and later.
Declared In
MKDirectionsResponse.h

polyline

The detailed route geometry. (read-only)

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

Availability
  • Available in iOS 7.0 and later.
Declared In
MKDirectionsResponse.h

steps

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

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

Availability
  • Available in iOS 7.0 and later.
Declared In
MKDirectionsResponse.h

transportType

The overall route transport type. (read-only)

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

Availability
  • Available in iOS 7.0 and later.
Declared In
MKDirectionsResponse.h