Turn-by-turn instructions
Planning a route for turn-by-turn navigation requires that specific parameters be included in the request. An example of routing options that can be used for this purpose is as follows:
let amsterdamCoordinate = CLLocationCoordinate2DMake(52.3764527, 4.9062047)let berlinCoordinate = CLLocationCoordinate2DMake(52.5069751, 13.3631919)
let itinerary = Itinerary( origin: ItineraryPoint(coordinate: amsterdamCoordinate), destination: ItineraryPoint(coordinate: berlinCoordinate))
let options: RoutePlanningOptionsdo { options = try RoutePlanningOptions( itinerary: itinerary, guidanceOptions: GuidanceOptions( language: Locale(identifier: "en-GB"), phoneticsType: .IPA ) )} catch { print("Invalid planning options: \(error.localizedDescription)")}The most important parameters are summarized below.
Instructions
To obtain guidance instructions, RoutePlanningOptions.guidanceOptions needs to be set.
Road shield references
The GuidanceOptions.roadShieldReferences parameter specifies whether to include road shield references into the external road shields atlas. Possible values are:
-
RoadShieldReferences.none: Do not include instruction road shield references. -
RoadShieldReferences.all: Include instructions for road shield references.
If the GuidanceOptions.roadShieldReferences parameter is not set, instructions will not include any road shield references.
Phonetics
The GuidanceOptions.phoneticsType parameter specifies whether to include phonetic transcriptions of street names, signpost texts, and road numbers in the instructions. In areas where phonetic information is not available, the result will not be returned. Possible values are:
-
InstructionPhoneticsType.none: Do not include phonetic transcriptions in the response. -
InstructionPhoneticsType.LHP: Return phonetic transcriptions in the L&H+ format from Cerence Inc. -
InstructionPhoneticsType.IPA: Return phonetic transcriptions in the IPA (International Phonetic Alphabet).
If the GuidanceOptions.phoneticsType parameter is not set, instructions will return phonetic transcriptions in the IPA (International Phonetic Alphabet).
Vehicle heading
When driving, it’s important to request a route in a specific direction. For that purpose, the ItineraryPoint.heading parameter should be used. It describes the directional heading of the vehicle, in degrees starting at true North and continuing in a clockwise direction:
- North is 0 degrees.
- East is 90 degrees.
- South is 180 degrees.
- West is 270 degrees.
Route sections
Per default, all sections except for lanes and roadshields are included in the response. If you want to include these two as well, specify ExtendedSections.all with GuidanceOptions.extendedSections .
More details about available route sections can be found in the Sections document.
Next steps
Since you have learned how to work with turn-by-turn instructions, here are recommendations for the next steps: