Calculate Route
Service version: 1.0
Last edit: 2019.11.28
On this page
Purpose
The Calculate Route service calculates a route between an origin and a destination, passing through waypoints if they are specified.
- The route will take into account factors such as current traffic and the typical road speeds on the requested day of the week and time of day.
- Information returned includes the distance, estimated travel time, and a representation of the route geometry.
- Additional routing information such as optimized waypoint order or turn by turn instructions is also available, depending on the options selected.
Run this endpoint
You can easily run this and other endpoints.
- Go to the TomTom API Explorer page.
-
Click an endpoint.
- Click Try it out.
- Enter/select all required parameter values and any optional parameter values.
- At the bottom of the form, click Execute.
- Review the Response.
Request data
HTTPS method: GETPOST
Generic Request format
The following Request URL contains all of this endpoint's respective parameters. For their details, please see the Common Routing Parameters page.
For ease of viewing and identification:
- Required constants and parameters are shown in bold text.
- Optional parameters are shown in plain text.
https://baseURL/routing/versionNumber/calculateRoute/locations/contentType?key=*****
&callback=callback
&maxAlternatives=alternativeRoutes
&alternativeType=alternativeType
&minDeviationDistance=integer
&minDeviationTime=integer
&instructionsType=instructionsType
&language=language
&computeBestOrder=boolean
&routeRepresentation=routeRepresentation
&computeTravelTimeFor=trafficTypes
&vehicleHeading=integer
§ionType=sectionType
&report=effectiveSettings
&departAt=time
&arriveAt=time
&routeType=routeType
&traffic=boolean
&avoid=avoidType
&travelMode=travelMode
&hilliness=hilliness
&windingness=windingness
&vehicleMaxSpeed=vehicleMaxSpeed
&vehicleWeight=vehicleWeight
&vehicleAxleWeight=vehicleAxleWeight
&vehicleLength=vehicleLength
&vehicleWidth=vehicleWidth
&vehicleHeight=vehicleHeight
&vehicleCommercial=boolean
&vehicleLoadType=vehicleLoadType
&vehicleEngineType=vehicleEngineType
&constantSpeedConsumptionInLitersPerHundredkm=CombustionConstantSpeedConsumptionPairs
¤tFuelInLiters=float
&auxiliaryPowerInLitersPerHour=float
&fuelEnergyDensityInMJoulesPerLiter=float
&accelerationEfficiency=float
&decelerationEfficiency=float
&uphillEfficiency=float
&downhillEfficiency=float
&constantSpeedConsumptionInkWhPerHundredkm=ElectricConstantSpeedConsumptionPairs
¤tChargeInkWh=float
&maxChargeInkWh=float
&auxiliaryPowerInkW=float
GET URL example
Note: Linebreaks are designated by "\".
https://api.tomtom.com/routing/1/calculateRoute/\
52.50931,13.42936:52.50274,13.43872/json?\
instructionsType=text&language=en-US\
&vehicleHeading=90§ionType=traffic\
&report=effectiveSettings&routeType=eco\
&traffic=true&avoid=unpavedRoads\
&travelMode=car&vehicleMaxSpeed=120\
&vehicleCommercial=false&vehicleEngineType=combustion\
&key=*****
GET curl command
Note: Linebreaks are designated by "\".
curl -X GET "https://api.tomtom.com/routing/1/calculateRoute/\
52.50931,13.42936:52.50274,13.43872/json?\
instructionsType=text&language=en-US&vehicleHeading=90\
§ionType=traffic&report=effectiveSettings\
&routeType=eco&traffic=true&avoid=unpavedRoads\
&travelMode=car&vehicleMaxSpeed=120&vehicleCommercial=false\
&vehicleEngineType=combustion&key=*****" -H "accept:*/*"
POST URL example
For ease of viewing and identification:
- Required constants and parameters are shown in bold text.
- Optional parameters are shown in plain text.
https://api.tomtom.com/routing/1/calculateRoute/52.50931,13.42936:52.50274,13.43872/json?key=*****
POST curl command
curl -X POST "https://api.tomtom.com/routing/1/calculateRoute/52.50931,13.42936:52.50274,13.43872/json?key=*****"\
-H "Content-type:application/json" -d\
'{
"supportingPoints":[
{
"latitude": 52.50930, "longitude": 13.42936
},
{
"latitude":52.50844, "longitude": 13.42859
}
],
"avoidVignette": [
"AUS","CHE"
]
}'
Types
- The following data table describes a subset of the types that can be used in the Calculate Route service; the remaining types are listed on the Common Routing Parameters page.
-
Type Description circle
A circle with a center point and a radius (in meters). The radius must be a positive integer with the maximum value of 135000.
Example:circle(52.37245,4.89406,10000)
location
A point or a circle.
Example:52.37245,4.89406
circle(52.37245,4.89406,10000)
Headers
There currently are no additional headers specific to the Calculate Route service. The common headers are listed on the Common Routing Parameters page.
Base path parameters
The following table describes a subset of the parameters that can be used in the Calculate Route service. The remaining parameters are listed on the Common Routing Parameters page.
- Required parameters must be used or the call will fail.
- The order of the required parameters is important and must be followed.
- There are no optional parameters.
Required parameters: Base path | |
---|---|
Parameter | Description |
versionNumber integer |
The service version number. Value: The current value is 1 .
|
locations string |
Locations through which the route is calculated. The following constraints apply:
Values: Colon-delimited locations |
Request parameters
The following table describes a subset of the parameters that can be used in the Calculate Route service; the remaining parameters are listed on the Common routing parameters page.
- There are no required parameters. All of the following parameters are optional.
- If there is a default value that will be assumed when an optional parameter is not used, it is shown in the table.
- The order of these optional Request parameters is not important.
Optional parameters | |
---|---|
Parameter | Description |
maxAlternatives integer |
Number of desired alternative routes to be calculated. The value provided:
Default value: |
alternativeType string |
When maxAlternatives is greater than 0 , allows to specify the objective of computing alternative routes: finding routes that are significantly different than the reference route, or finding routes that are better than the reference route. Possible values are:
Note: This optional parameter can only be used when reconstructing a route. |
minDeviationDistance integer |
All alternative routes returned will follow the reference route (see the POST Requests section) from the origin point of the calculateRoute request for at least this number of meters.
Default value: |
minDeviationTime integer |
All alternative routes returned will follow the reference route (see the POST Requests section) from the origin point of the calculateRoute request for at least this number of seconds.
Default value: |
instructionsType string |
If specified, guidance instructions will be returned (if available). Possible values are:
Values:
|
language string |
The language parameter determines the language of the guidance messages.
Default value: |
computeBestOrder boolean |
Re-orders the route waypoints with a fast heuristic algorithm to reduce the overall route length. Yields best results when used in conjunction with routeType shortest.Possible boolean values are:
Default value: |
routeRepresentation string |
Specifies the representation of the set of routes provided as a Response. Possible values are:
Default value:
|
computeTravelTimeFor string |
Specifies whether to return additional travel times using different types of traffic information (none, historic, live) as well as the default best-estimate travel time. Possible values are:
Default value: |
vehicleHeading integer |
The directional heading of the vehicle, in degrees starting at true North and continuing in a clockwise direction.
Maximum value: |
sectionType string |
Specifies which of the section types is reported in the route Response. It can be specified multiple times.
Default value:
|
Further parameters not contained in the preceding table can be specified. A complete list is located in the Common Routing Parameters page. This page also includes the parameters used to define a detailed vehicle consumption model.
Using the detailed consumption model has two consequences for a calculateRoute
Request:
- When the parameter
routeType
is set toeco
, then the Consumption Model will be taken into account for route planning. - When
constantSpeedConsumption*
is specified, the response will include eitherfuelConsumptionInLiters
orbatteryConsumptionInkWh
(forvehicleEngineType
set tocombustion
orelectric
, respectively) as an additional field in eachsummary
element.
POST data parameters
The <supportingPoints>
XML element is used for reconstructing a route and for calculating zero or more alternative routes to this reference route.
- The provided sequence of supporting points is used as input for route reconstruction.
- The alternative routes are calculated between the origin and destination points specified in the base path parameter locations.
- If both
minDeviationDistance
andminDeviationTime
are set to zero, then these origin and destination points are expected to be at (or very near) the beginning and end of the reference route, respectively. - Intermediate locations (
waypoints
) are not supported when using<supportingPoints>
. - The reference route may contain traffic incidents of type
ROAD_CLOSURE
, which are ignored for the calculation of the reference route's travel time and traffic delay.
Setting at least one of minDeviationDistance
or minDeviationTime
to a value greater than zero has the following consequences:
-
The origin point of the
calculateRoute
Request must be on (or very near) the input reference route.- If this is not the case, an error is returned.
- However, the origin point does not need to be at the beginning of the input reference route (it can be thought of as the current vehicle position on the reference route).
- The reference route, returned as the first route in the
calculateRoute
Response, will start at the origin point specified in thecalculateRoute
Request. The initial part of the input reference route up until the origin point will be excluded from the Response. - The values of
minDeviationDistance
andminDeviationTime
determine how far alternative routes will be guaranteed to follow the reference route from the origin point onwards. - The route must use
departAt
. - The
vehicleHeading
is ignored.
The following table describes a subset of the parameters that can be used in the Calculate Route service; the remaining parameters are listed on the Common Routing Parameters page.
Parameter | Description |
---|---|
<supportingPoints> |
A list of base route points defined as <supportingPoint>, to be used as input for route reconstruction. |
<supportingPoint> |
A base route point defined as a latitude longitude pair, to be used as input for route reconstruction. |
XML Request content example
<postData>
<supportingPoints>
<supportingPoint latitude="52.50930" longitude="13.42936"/>
<supportingPoint latitude="52.50844" longitude="13.42859"/>
</supportingPoints>
<avoidVignette>
AUS,CHE
</avoidVignette>
</postData>
The <postData>
XML element may be omitted if only supportingPoints
are specified, so the following example continues to be supported for backward compatibility:
<supportingPoints>
<supportingPoint latitude="52.50930" longitude="13.42936"/>
<supportingPoint latitude="52.50844" longitude="13.42859"/>
</supportingPoints>
JSON Request content example
{
"supportingPoints": [
{"latitude": 52.50930, "longitude": 13.42936},
{"latitude": 52.50844, "longitude": 13.42859}
],
"avoidVignette": [
"AUS",
"CHE"
]
}
Response data
Response headers
There currently are no additional Response headers specific to the Calculate Route service; the common Response headers are listed on the Common Routing Parameters page.
Response codes
There currently are no additional Response codes specific to the Calculate Route service; the common Response codes are listed on the Common Routing Parameters page.
Example of a successful Response
The routes in a successful Response are listed in order of decreasing optimality. In case the Request includes the supporting points <supportingPoint>
XML element, the Response will specify the reconstructed route before any alternative routes.
In the following XML and JSON Response examples, note that the fields <deviationDistance>
, <deviationTime>
and <deviationPoint>
cannot occur if there is more than one leg. This is because because waypoints and supporting points are mutually exclusive.
An XML Response could look like this: (Note: Comments are in italics.)
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<calculateRouteResponse xmlns="http://api.tomtom.com/routing" formatVersion="0.0.12">
<route>
<summary>
<lengthInMeters>1147</lengthInMeters>
<travelTimeInSeconds>157</travelTimeInSeconds>
<trafficDelayInSeconds>0</trafficDelayInSeconds>
<departureTime>2015-04-02T14:58:40+02:00</departureTime>
<arrivalTime>2015-04-02T15:01:17+02:00</arrivalTime>
<noTrafficTravelTimeInSeconds>120</noTrafficTravelTimeInSeconds>
<historicTrafficTravelTimeInSeconds>157</historicTrafficTravelTimeInSeconds>
<liveTrafficIncidentsTravelTimeInSeconds>161</liveTrafficIncidentsTravelTimeInSeconds>
<fuelConsumptionInLiters>0.0155</fuelConsumptionInLiters>
<deviationDistance>1735</deviationDistance>
<deviationTime>127</deviationTime>
<deviationPoint latitude="52.50904" longitude="13.42912"/>
</summary>
<leg>
<summary>
<lengthInMeters>108</lengthInMeters>
<travelTimeInSeconds>11</travelTimeInSeconds>
<trafficDelayInSeconds>0</trafficDelayInSeconds>
<departureTime>2015-04-02T14:58:40+02:00</departureTime>
<arrivalTime>2015-04-02T14:58:50+02:00</arrivalTime>
<noTrafficTravelTimeInSeconds>10</noTrafficTravelTimeInSeconds>
<historicTrafficTravelTimeInSeconds>11</historicTrafficTravelTimeInSeconds>
<liveTrafficIncidentsTravelTimeInSeconds>13</liveTrafficIncidentsTravelTimeInSeconds>
<fuelConsumptionInLiters>0.01</fuelConsumptionInLiters>
</summary>
<points>
<point latitude="52.50931" longitude="13.42937"/>
<point latitude="52.50904" longitude="13.42912"/>
...further points...
</points>
</leg>
...further legs...
<sections>
<section>
<startPointIndex>0</startPointIndex>
<endPointIndex>3</endPointIndex>
<sectionType>TRAVEL_MODE</sectionType>
<travelMode>other</travelMode>
</section>
<section>
<startPointIndex>3</startPointIndex>
<endPointIndex>7</endPointIndex>
<sectionType>TRAVEL_MODE</sectionType>
<travelMode>car</travelMode>
</section>
<section>
<startPointIndex>2</startPointIndex>
<endPointIndex>5</endPointIndex>
<sectionType>TOLL_ROAD</sectionType>
</section>
<section>
<startPointIndex>3</startPointIndex>
<endPointIndex>4</endPointIndex>
<sectionType>TUNNEL</sectionType>
</section>
<section>
<startPointIndex>0</startPointIndex>
<endPointIndex>1</endPointIndex>
<sectionType>PEDESTRIAN</sectionType>
</section>
<section>
<startPointIndex>3</startPointIndex>
<endPointIndex>4</endPointIndex>
<sectionType>TRAFFIC</sectionType>
<simpleCategory>JAM</simpleCategory>
<effectiveSpeedInKmh>40</effectiveSpeedInKmh>
<delayInSeconds>158</delayInSeconds>
<magnitudeOfDelay>1</magnitudeOfDelay>
<tec>
<effectCode>4</effectCode>
<causes>
<cause>
<mainCauseCode>1</mainCauseCode>
</cause>
<cause>
<mainCauseCode>26</mainCauseCode>
<subCauseCode>2</subCauseCode>
</cause>
</causes>
</tec>
</section>
...further sections...
</sections>
<guidance>
<instructions>
<instruction>
<routeOffsetInMeters>0</routeOffsetInMeters>
<travelTimeInSeconds>0</travelTimeInSeconds>
<point latitude="52.50931" longitude="13.42937"/>
<instructionType>LOCATION_DEPARTURE</instructionType>
<street>An der Schillingbrücke</street>
<countryCode>DEU</countryCode>
<possibleCombineWithNext>false</possibleCombineWithNext>
<drivingSide>RIGHT</drivingSide>
<maneuver>DEPART</maneuver>
<message>Leave from An der Schillingbrücke</message>
</instruction>
...further instructions...
</instructions>
<instructionGroups>
<instructionGroup firstInstructionIndex="0" lastInstructionIndex="5">
<groupLengthInMeters>4567</groupLengthInMeters>
<groupMessage>Leave from An der Schillingbrücke and continue to A1/E35</groupMessage>
</instructionGroup>
...further instruction groups...
</instructionGroups>
</guidance>
</route>
...further routes...
<optimizedWaypoints>
<waypoint providedIndex="0" optimizedIndex="1"/>
<waypoint providedIndex="1" optimizedIndex="0"/>
...further optimized waypoints...
</optimizedWaypoints>
<report>
<effectiveSettings>
<setting key="avoid" value="motorways"/>
<setting key="computeBestOrder" value="true"/>
...further settings...
</effectiveSettings>
</report>
</calculateRouteResponse>
A JSON Response could look like this: (Note: Comments are in italics.)
{
"formatVersion": "0.0.12",
"routes": [
{
"summary": {
"lengthInMeters": 1147,
"travelTimeInSeconds": 157,
"trafficDelayInSeconds": 0,
"departureTime": "2015-04-02T15:01:57+02:00",
"arrivalTime": "2015-04-02T15:04:34+02:00",
"noTrafficTravelTimeInSeconds": 120,
"historicTrafficTravelTimeInSeconds": 157,
"liveTrafficIncidentsTravelTimeInSeconds": 161,
"fuelConsumptionInLiters": 0.0155,
"deviationDistance": 1735,
"deviationTime": 127,
"deviationPoint": {
"latitude": 52.50904,
"longitude": 13.42912
}
},
"legs": [
{
"summary": {
"lengthInMeters": 108,
"travelTimeInSeconds": 11,
"trafficDelayInSeconds": 0,
"departureTime": "2015-04-02T15:01:57+02:00",
"arrivalTime": "2015-04-02T15:02:07+02:00",
"noTrafficTravelTimeInSeconds": 10,
"historicTrafficTravelTimeInSeconds": 11,
"liveTrafficIncidentsTravelTimeInSeconds": 13,
"fuelConsumptionInLiters": 0.01
},
"points": [
{
"latitude": 52.50931,
"longitude": 13.42937
},
{
"latitude": 52.50904,
"longitude": 13.42912
},
...further points...
]
},
...further legs...
],
"sections": [
{
"startPointIndex": 0,
"endPointIndex": 3,
"sectionType": "TRAVEL_MODE"
"travelMode": "other"
},
{
"startPointIndex": 3,
"endPointIndex": 7,
"sectionType": "TRAVEL_MODE"
"travelMode": "car"
},
{
"startPointIndex": 2,
"endPointIndex": 5,
"sectionType": "TOLL_ROAD"
},
{
"startPointIndex": 3,
"endPointIndex": 4,
"sectionType": "TUNNEL"
},
{
"startPointIndex": 0,
"endPointIndex": 1,
"sectionType": "PEDESTRIAN"
},
{
"startPointIndex": 3,
"endPointIndex": 4,
"sectionType": "TRAFFIC",
"simpleCategory": "JAM",
"effectiveSpeedInKmh": 40,
"delayInSeconds": 158,
"magnitudeOfDelay": 1,
"tec": {
"effectCode": 4,
"causes": [
{
"mainCauseCode": 1
},
{
"mainCauseCode": 26,
"subCauseCode": 2
}
]
}
},
...further sections...
],
"guidance": {
"instructions": [
{
"routeOffsetInMeters": 0,
"travelTimeInSeconds": 0,
"point": {
"latitude": 52.50931,
"longitude": 13.42937
},
"instructionType": "LOCATION_DEPARTURE",
"street": "An der Schillingbrücke",
"countryCode":"DEU",
"possibleCombineWithNext": false,
"drivingSide": "RIGHT",
"maneuver": "DEPART",
"message": "Leave from An der Schillingbrücke"
},
...further instructions...
],
"instructionGroups": [
{
"firstInstructionIndex": 0,
"lastInstructionIndex": 5,
"groupLengthInMeters": 4567,
"groupMessage": "Leave from An der Schillingbrücke and continue to A1/E35"
},
...further instruction groups...
]
}
}
...further routes...
],
"optimizedWaypoints": [
{
"providedIndex": 0,
"optimizedIndex": 1
},
{
"providedIndex": 1,
"optimizedIndex": 0
}
...further optimized waypoints...
],
"report": {
"effectiveSettings": [
{
"key": "avoid",
"value": "motorways"
},
{
"key": "computeBestOrder",
"value": "true"
},
...further settings...
]
}
}
Example of an error Response
If an error occurs, the Response contains the description of the error. The XML error Response would look like this:
<?xml version="1.0" encoding="utf-8"?>
<calculateRouteResponse xmlns="http://api.tomtom.com/routing" formatVersion="0.0.12">
<error description="Error description"/>
</calculateRouteResponse>
The equivalent JSON error Response would look like this:
{
"formatVersion":"0.0.12",
"error":{
"description":"Error description"
}
}
Special behaviour for content type jsonp
(JSON with Padding)
When the contentType=jsonp
, the returned HTTP status code is always OK (200
).
- This ensures that the
jsonp
callback will be invoked on the client side regardless of the outcome of the Request. - In order to provide the client with the actual status of the Request, a field called
statusCode
is added to the Response body.
Currently, the preceding statement is not true for certain types of errors (authentication errors, Request quota related errors, etc.).
- For those errors the HTTP status code is returned as normal (
400
,500
, ...) and the Response content type istext/xml
. - Note: This imperfection should not cause problems during normal use of the API.
Structure of a successful Response (XML elements)
XML field element | Description |
---|---|
<calculateRouteResponse> |
The main response element. |
<route> |
A description of a route comprised of a list of legs. |
<summary> |
A summary of a route, or a route leg. |
<leg> |
A description of a part of a route, comprised of a list of points. Each additional waypoint provided in the request will result in an additional leg in the returned route. |
<points> |
A list of XML <point> elements. |
<point> |
A location on the surface of the globe defined as a latitude longitude pair. |
<sections> |
Available inside XML <route> elements.
|
<startPointIndex> |
Index of the first point (offset 0 ) in the route this section applies to (only included for a routeRepresentation polyline ). |
<endPointIndex> |
Index of the last point (offset 0 ) in the route this section applies to (only included for a routeRepresentation polyline ). |
<countryCode> |
A 3-character ISO 3166-1 alpha-3 country code. |
<simpleCategory> |
Type of the incident.
|
<effectiveSpeedInKmh> |
The effective speed of the incident in km/h, averaged over its entire length. |
<delayInSeconds> |
The delay in seconds caused by the incident. |
<magnitudeOfDelay> |
The magnitude of delay caused by the incident. Possible values:
These values correspond to the values of the Response field |
<tec> |
Details of the traffic event.
|
<effectCode> |
The effect on the traffic flow.
|
<causes> |
A list of <cause> elements. |
<cause> |
The cause of the traffic event.
|
<mainCauseCode> |
The main cause of the traffic event. Contains a value in the tec002:CauseCode table, as defined in the TPEG2-TEC standard. |
<subCauseCode> |
The subcause of the traffic event. Contains a value in the sub cause table defined by the mainCauseCode , as defined in the TPEG2-TEC standard. |
<lengthInMeters> |
The route or leg length in meters. |
<travelTimeInSeconds> |
The estimated travel time in seconds. Note that even when traffic=false , travelTimeInSeconds still includes the delay due to traffic. |
<trafficDelayInSeconds> |
The delay in seconds compared to free-flow conditions according to real-time traffic information. |
<noTrafficTravelTimeInSeconds> |
The estimated travel time in seconds calculated as if there are no delays on the route due to traffic conditions (e.g., congestion). Included if requested using the computeTravelTimeFor parameter. |
<historicTrafficTravelTimeInSeconds> |
The estimated travel time in seconds calculated using time-dependent historic traffic data. Included if requested using the computeTravelTimeFor parameter. |
<liveTrafficIncidentsTravelTimeInSeconds> |
The estimated travel time in seconds calculated using real-time speed data. Included if requested using the computeTravelTimeFor parameter. |
<deviationDistance> |
The distance (in meters) from the origin point of the calculateRoute Request to the first point where this route forks off from the reference route.
|
<deviationTime> |
The travel time (in seconds) from the origin point of the <calculateRoute> Request to the first point where this route forks off from the reference route.
|
<deviationPoint> |
The coordinates of the first point following the origin point of the <calculateRoute> Request where this route forks off from the reference route.
|
<fuelConsumptionInLiters> |
The estimated fuel consumption in liters using the Combustion Consumption Model. Included if:
|
<batteryConsumptionInkWh> |
The estimated electric energy consumption in kilowatt hours (kWh) using the Electric Consumption Model.
|
<optimizedWaypoints> |
An optimized sequence of waypoints.
|
<waypoint> |
This is each element in the list of <optimizedWaypoints> . It contains the indices for that waypoint in the provided and optimized list. |
<departureTime> |
The estimated departure time for the route or leg. Specified as a dateTime . |
<arrivalTime> |
The estimated arrival time for the route or leg. Specified as a dateTime . |
<guidance> |
This contains guidance related elements. This field is present only when guidance was requested and is available. |
<instruction> |
A set of attributes describing a maneuver, e.g., "Turn right", "Keep left", "Take the ferry", "Take the motorway", "Arrive". |
<instructionGroup> |
This groups a sequence of instruction elements which are related to each other.
|
<effectiveSettings> |
The effective parameters or data used when calling the Calculate Route API. |
<statusCode> |
The original HTTP status code as listed in the Response codes (note: included for content type jsonp only). |
Structure of an instruction
Guidance instruction deprecation policy:
As part of the continuous improvement of the Routing API, we also extend our guidance instructions with new features.
In many cases, this requires the introduction of new maneuver codes for new types of instructions. Hence we cannot guarantee the same deprecation policy for guidance instructions as compared to the rest of the Routing API.
In particular, clients are expected to be forward compatible, and we reserve the right to extend all enums defined below with new values. This includes completely new maneuver codes for new types of instructions.
At the same time we reserve the right to retire enum values for instructions that are superseded by their improved counterparts no longer generated by the internal Guidance component. The same rules for forward-/backward-compatibility apply to fields for guidance instructions.
For the retirement of instructions that are no longer relevant, we give a deprecation period of 4 months. After this period we reserve the right to remove deprecated values at our convenience.
XML field element | Description | ||||
---|---|---|---|---|---|
<routeOffsetInMeters>
|
The distance from the start of the route to the point of the instruction. | ||||
<travelTimeInSeconds>
|
The estimated travel time up to the point corresponding to routeOffsetInMeters . |
||||
<point>
|
A location of the maneuver defined as a latitude longitude pair. Example:
|
||||
<instructionType>
|
The type of instruction, e.g., a turn or a change of road form. Possible values:
|
||||
<roadNumbers>
|
An aggregate for <roadNumber> elements. Example:
|
||||
<roadNumber>
|
The road number of the next significant road segment after the maneuver, or of the road that has to be followed. | ||||
<exitNumber>
|
The number(s) of a highway exit taken by the current maneuver. If an exit has multiple exit numbers, they will be separated by "," and possibly aggregated by "-", e.g., "10, 13-15". | ||||
<street>
|
The street name of the next significant road segment after the maneuver, or of the street that should be followed. | ||||
<signpostText>
|
The text on a signpost which is most relevant to the maneuver, or to the direction that should be followed. | ||||
<countryCode>
|
The 3-character ISO 3166-1 alpha-3 country code. | ||||
<stateCode>
|
A subdivision (e.g., state) of the country, represented by the second part of an ISO 3166-2 code. This is only available for some countries like the US, Canada, and Mexico. | ||||
<junctionType>
|
The type of the junction where the maneuver takes place. For larger roundabouts, two separate instructions are generated for entering and leaving the roundabout. Possible values:
|
||||
<turnAngleInDecimalDegrees>
|
Indicates the direction of an instruction. If junctionType indicates a turn instruction:
If
|
||||
<roundaboutExitNumber>
|
This indicates which exit to take at a roundabout. | ||||
<possibleCombineWithNext>
|
It is possible to optionally combine the instruction with the next one. This can be used to build messages like "Turn left and then turn right". Possible values:
|
||||
<drivingSide>
|
Indicates left-hand vs. right-hand side driving at the point of the maneuver. Possible values:
|
||||
<maneuver>
|
A code identifying the maneuver (e.g., "Turn right"). See the following Maneuver codes section. | ||||
<message>
|
A human-readable message for the maneuver. | ||||
<combinedMessage>
|
A human-readable message for the maneuver combined with the message from the next instruction. See the following "Example of a combined message" section. |
Maneuver codes
The following table describes the possible values of the <maneuver>
instruction field.
Maneuver value | Example translation |
---|---|
ARRIVE |
You have arrived. |
ARRIVE_LEFT |
You have arrived. Your destination is on the left. |
ARRIVE_RIGHT |
You have arrived. Your destination is on the right. |
DEPART |
Leave. |
STRAIGHT |
Keep straight on. |
KEEP_RIGHT |
Keep right. |
BEAR_RIGHT |
Bear right. |
TURN_RIGHT |
Turn right. |
SHARP_RIGHT |
Turn sharp right. |
KEEP_LEFT |
Keep left. |
BEAR_LEFT |
Bear left. |
TURN_LEFT |
Turn left. |
SHARP_LEFT |
Turn sharp left. |
MAKE_UTURN |
Make a U-turn. |
ENTER_MOTORWAY |
Take the motorway. |
ENTER_FREEWAY |
Take the freeway. |
ENTER_HIGHWAY |
Take the highway. |
TAKE_EXIT |
Take the exit. |
MOTORWAY_EXIT_LEFT |
Take the left exit. |
MOTORWAY_EXIT_RIGHT |
Take the right exit. |
TAKE_FERRY |
Take the ferry. |
ROUNDABOUT_CROSS |
Cross the roundabout. |
ROUNDABOUT_RIGHT |
At the roundabout take the exit on the right. |
ROUNDABOUT_LEFT |
At the roundabout take the exit on the left. |
ROUNDABOUT_BACK |
Go around the roundabout. |
TRY_MAKE_UTURN |
Try to make a U-turn. |
FOLLOW |
Follow. |
SWITCH_PARALLEL_ROAD |
Switch to the parallel road. |
SWITCH_MAIN_ROAD |
Switch to the main road. |
ENTRANCE_RAMP |
Take the ramp. |
WAYPOINT_LEFT |
You have reached the waypoint. It is on the left. |
WAYPOINT_RIGHT |
You have reached the waypoint. It is on the right. |
WAYPOINT_REACHED |
You have reached the waypoint. |
Example of a combined message
Sometimes it is possible to combine two successive instructions into a single instruction making it easier to follow. When this is the case the possibleCombineWithNext
flag will be true
. For example:
10. Turn left onto Einsteinweg/A10/E22 towards Ring Amsterdam
11. Follow Einsteinweg/A10/E22 towards Ring Amsterdam
The possibleCombineWithNext
flag on instruction 10 is true
. This indicates to the clients of coded guidance that it can be combined with instruction 11. The instructions will be combined automatically for clients requesting human-readable guidance. The combinedMessage
field contains the combined message:
Turn left onto Einsteinweg/A10/E22 towards Ring Amsterdam then follow Einsteinweg/A10/E22 towards Ring Amsterdam.
Tagged messages
A human-readable message is built up from repeatable identified elements. These are tagged to allow client applications to format them correctly. The following message components are tagged when instructionsType=tagged
:
Message component | Tag |
---|---|
Street or road name | street |
Road number | roadNumber |
Signpost text | signpostText |
Exit number - motorway | exitNumber |
Exit number - roundabout | roundaboutExitNumber |
Examples of tagged messages
Turn left message
Turn left onto <roadNumber>A4</roadNumber>/<roadNumber>E19</roadNumber> towards <signpostText>Den Haag</signpostText>
Take exit message
Take exit no. <exitNumber>1</exitNumber> onto <street>Anderlechtlaan</street> towards <signpostText>Amsterdam-Sloten</signpostText>
Follow message
Follow <street>Rijksweg A9</street>/<roadNumber>A9</roadNumber> towards <signpostText>Amstelveen</signpostText>
Structure of route sections
Field | Description | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
<section> |
Sections contain additional information about parts of a route. Each <section> contains at least the elements <startPointIndex> , <endPointIndex> , and <sectionType> . |
||||||||||||||||||||||
<sectionType> |
Contains the Response section type.
The A A
|
||||||||||||||||||||||
<travelMode> |
This attribute is either set to the value given to the request parameter travelMode , if this travel mode is possible, or to other which indicates that the given mode of transport is not possible in this section. This field can only be used within sections of type TRAVEL_MODE . |
Structure of an error Response
Field | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
<calculateRouteResponse> |
The main Response element. | ||||||||||
<error> |
Contains an error description field with a human readable error message.
The (non-complete) list of error codes is:
Example of a description string:
|
||||||||||
<statusCode> |
The original HTTP status code as listed in Response Codes (included for content type jsonp only). |
Supported languages
Language name | Language tag |
---|---|
Afrikaans (South Africa) | af-ZA |
Arabic | ar |
Bulgarian | bg-BG |
Chinese (Taiwan) | zh-TW |
Czech | cs-CZ |
Danish | da-DK |
Dutch | nl-NL |
English (Great Britain) | en-GB |
English (USA) | en-US |
Finnish | fi-FI |
French | fr-FR |
German | de-DE |
Greek | el-GR |
Hungarian | hu-HU |
Indonesian | id-ID |
Italian | it-IT |
Korean | ko-KR |
Lithuanian | lt-LT |
Malay | ms-MY |
Norwegian | nb-NO |
Polish | pl-PL |
Portuguese (Brazil) | pt-BR |
Portuguese (Portugal) | pt-PT |
Russian | ru-RU |
Slovak | sk-SK |
Slovenian | sl-SI |
Spanish (Castilian) | es-ES |
Spanish (Mexico) | es-MX |
Swedish | sv-SE |
Thai | th-TH |
Turkish | tr-TR |