Request instructions with different types of units
Units of measurement for guidance instructions could be specified as a part of request.
Supported units are metric and imperial. Default value is metric.
This parameter doesn't affect any other units besides ones used in the actions instructions (specified as return=actions,instructions).
All other units (for example, in summary, travelSummary) are intended for machine-to-machine communication and not for direct user display. That is why single measurement system is used there. It's less error prone.
However, there is an option to change units in the instruction string, because it's meant to be exposed to a user directly (for example, in a list of actions on a website).
Example with metric units
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
}
],
...
}
]
}
]
}Example with imperial units
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
}
],
...
}
]
}
]
}Updated last month