Instructions for display
To obtain structured information about the actions needed to complete the route, specify return=polyline,actions when requesting a route.
This may be useful when providing user interface elements such as the position or icon for an action.
You can specify return=polyline,actions,instructions to include instructions with the actions when requesting the route.
Instructions provide a textual description of the action that is appropriate for end users.
curl -gX GET 'https://router.hereapi.com/v8/routes?'\
'transportMode=car&'\
'origin=52.5308,13.3847&'\
'destination=52.5323,13.3789&'\
'return=polyline,actions,instructions&'\
'apiKey=YOUR_API_KEY'{
"routes": [
{
"id": "054ea907-d02b-4b77-b1b4-2af511291eaf",
"sections": [
{
"actions": [
{
"action": "depart",
"duration": 18,
"instruction": "Head toward Chausseestraße on Invalidenstraße. Go for 113 m.",
"offset": 0
},
{
"action": "turn",
"duration": 53,
"instruction": "Turn right onto Chausseestraße. Go for 320 m.",
"offset": 8
},
{
"action": "turn",
"duration": 15,
"instruction": "Turn left onto Habersaathstraße. Go for 105 m.",
"offset": 27
},
{
"action": "arrive",
"duration": 0,
"instruction": "Arrive at Habersaathstraße. Your destination is on the left.",
"offset": 33
}
],
...
}
]
}
]
}Specify units of measurement for instructions
Specify units of measurement for instructions with the units parameter — metric (default) or imperial.
Other attributes, such as those in summary or travelSummary, always use meters and seconds, regardless of units, since they're meant for machine-to-machine communication rather than display to users.
curl -gX GET 'https://router.hereapi.com/v8/routes?'\
'transportMode=car&'\
'origin=52.509739,13.380260&'\
'destination=52.508419,13.385007&'\
'units=metric&'\
'return=polyline,actions,instructions&'\
'apiKey=YOUR_API_KEY'{
"routes": [
{
"id": "8db0de88-157d-43ac-8ebd-5319d0bea975",
"sections": [
{
"id": "196a68a2-db65-4151-9fad-64036e935fef",
"type": "vehicle",
"actions": [
{
"action": "depart",
"duration": 38,
"instruction": "Head toward Wilhelmstraße on Leipziger Straße (B1). Go for 269 m.",
"offset": 0
},
{
"action": "turn",
"duration": 20,
"instruction": "Turn right onto Platz des Volksaufstandes von 1953 toward Tempelhof/Kreuzberg. Go for 184 m.",
"offset": 5,
"direction": "right",
"severity": "quite"
},
{
"action": "arrive",
"duration": 0,
"instruction": "Arrive at Wilhelmstraße.",
"offset": 10
}
],
...
}
]
}
]
}curl -gX GET 'https://router.hereapi.com/v8/routes?'\
'transportMode=car&'\
'origin=52.509739,13.380260&'\
'destination=52.508419,13.385007&'\
'units=imperial&'\
'return=polyline,actions,instructions&'\
'apiKey=YOUR_API_KEY'{
"routes": [
{
"id": "cb55a003-d8fe-43fe-a202-55b55f541d17",
"sections": [
{
"id": "0c70753e-9861-4442-98df-aaf4e44aaa68",
"type": "vehicle",
"actions": [
{
"action": "depart",
"duration": 38,
"instruction": "Head toward Wilhelmstraße on Leipziger Straße (B1). Go for 0.2 mi.",
"offset": 0
},
{
"action": "turn",
"duration": 20,
"instruction": "Turn right onto Platz des Volksaufstandes von 1953 toward Tempelhof/Kreuzberg. Go for 0.1 mi.",
"offset": 5,
"direction": "right",
"severity": "quite"
},
{
"action": "arrive",
"duration": 0,
"instruction": "Arrive at Wilhelmstraße.",
"offset": 10
}
],
...
}
]
}
]
}Related content
Updated 20 days ago