Calculate Route

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.

Please be aware that this document does not specify the complete request or response format. To maintain forward compatibility, you must be able to process responses with additional non-documented data fields. Our deprecation policy only covers the documented subset of these formats.

Run this endpoint

You can easily run this and other endpoints. Go to the TomTom API Explorer page and follow the directions.

Request data

HTTPS methods: GET POST

Constants and parameters enclosed in curly brackets { } must be replaced with their values.

Generic request format

The following request URL contains all of this endpoint’s respective parameters. For their details, please see the Request parameters section. In addition, this endpoint supports guidance functionality that is collectively described in the Guidance Instructions page.

get
Generic request example
https://{baseURL}/routing/{versionNumber}/calculateRoute/{routePlanningLocations}/{contentType}?key={Your_API_Key}
&callback={callback}
&maxAlternatives={alternativeRoutes}
&alternativeType={alternativeType}
&minDeviationDistance={integer}
&minDeviationTime={integer}
&supportingPointIndexOfOrigin={integer}
&computeBestOrder={boolean}
&routeRepresentation={routeRepresentation}
&computeTravelTimeFor={trafficTypes}
&vehicleHeading={integer}
&language={language}
&sectionType={sectionType}
&includeTollPaymentTypes={includeTollPaymentTypes}
&report={effectiveSettings}
&departAt={time}
&arriveAt={time}
&routeType={routeType}
&traffic={boolean}
&avoid={avoidType}
&travelMode={travelMode}
&hilliness={hilliness}
&windingness={windingness}
&vehicleMaxSpeed={vehicleMaxSpeed}
&vehicleWeight={vehicleWeight}
&vehicleAxleWeight={vehicleAxleWeight}
&vehicleNumberOfAxles={vehicleNumberOfAxles}
&vehicleLength={vehicleLength}
&vehicleWidth={vehicleWidth}
&vehicleHeight={vehicleHeight}
&vehicleCommercial={boolean}
&vehicleLoadType={vehicleLoadType}
&vehicleAdrTunnelRestrictionCode={vehicleAdrTunnelRestrictionCode}
&vehicleEngineType={vehicleEngineType}
&constantSpeedConsumptionInLitersPerHundredkm={CombustionConstantSpeedConsumptionPairs}
&currentFuelInLiters={float}
&auxiliaryPowerInLitersPerHour={float}
&fuelEnergyDensityInMJoulesPerLiter={float}
&accelerationEfficiency={float}
&decelerationEfficiency={float}
&uphillEfficiency={float}
&downhillEfficiency={float}
&consumptionInkWhPerkmAltitudeGain={float}
&recuperationInkWhPerkmAltitudeLoss={float}
&constantSpeedConsumptionInkWhPerHundredkm={ElectricConstantSpeedConsumptionPairs}
&currentChargeInkWh={float}
&maxChargeInkWh={float}
&auxiliaryPowerInkW={float}
&chargeMarginsInkWh={commaSeparatedFloats}
&extendedRouteRepresentation={extendedRouteRepresentation}

GET URL example

Note: Line breaks are designated by ”\”.

get
Request URL example
https://api.tomtom.com/routing/1/calculateRoute/\
52.50931,13.42936:52.50274,13.43872/json?\
vehicleHeading=90&sectionType=traffic\
&report=effectiveSettings&routeType=eco\
&traffic=true&avoid=unpavedRoads\
&travelMode=car&vehicleMaxSpeed=120\
&vehicleCommercial=false&vehicleEngineType=combustion\
&key={Your_API_Key}

GET curl command example

Note: Line breaks are designated by ”\”.

get
Request curl command example
curl -X GET "https://api.tomtom.com/routing/1/calculateRoute/\
52.50931,13.42936:52.50274,13.43872/json?\
vehicleHeading=90&sectionType=traffic\
&report=effectiveSettings\&routeType=eco\
&traffic=true&avoid=unpavedRoads&travelMode=car\
&vehicleMaxSpeed=120&vehicleCommercial=false\
&vehicleEngineType=combustion&key={Your_API_Key}" -H "accept:*/*"

POST URL example

post
Request URL example
https://api.tomtom.com/routing/1/calculateRoute/52.50931,13.42936:52.50274,13.43872/json?key={Your_API_Key}

POST curl command examples

post
Request curl command example
curl -X POST "https://api.tomtom.com/routing/1/calculateRoute/52.50931,13.42936:52.50274,13.43872/json?key={Your_API_Key}" -H "Content-type:application/json" -d \
'{
"supportingPoints": [
{
"latitude": 52.5093,
"longitude": 13.42936
},
{
"latitude": 52.50844,
"longitude": 13.42859
}
],
"avoidVignette": [
"AUS",
"CHE"
]
}'
post
Request curl command example with encoded polyline
curl -X POST "https://api.tomtom.com/routing/1/calculateRoute/52.50931,13.42936:52.50274,13.43872/json?key={Your_API_Key}" -H "Content-type:application/json" -d \
'{
"encodedPolyline": "cvn_Io|}pAjDxC",
"encodedPolylinePrecision": 5,
"avoidVignette": [
"AUS",
"CHE"
]
}'
post
Request curl command with per leg parameters example
curl -X POST "https://api.tomtom.com/routing/1/calculateRoute/52.50931,13.42936:52.511572,13.416830:52.521860,13.427642:52.50274,13.43872/json?key={Your_API_Key}" -H "Content-type:application/json" -d \
'{
"legs" : [
{
"routeType" : "eco",
"routeStop": {
"pauseTimeInSeconds": 610
}
},
{
"supportingPoints": [
{
"latitude": 52.5093,
"longitude": 13.42936
},
{
"latitude": 52.50844,
"longitude": 13.42859
}
]
},
{
"routeType": "thrilling",
"windingness": "low",
"hilliness": "high",
"avoids": [
{
"name": "tollRoads"
}
]
}
]
}'
post
Request curl command with encoded polyline in per leg parameters example
curl -X POST "https://api.tomtom.com/routing/1/calculateRoute/52.50931,13.42936:52.511572,13.416830:52.521860,13.427642:52.50274,13.43872/json?key={Your_API_Key}" -H "Content-type:application/json" -d \
'{
"legs" : [
{
"routeType" : "eco",
"routeStop": {
"pauseTimeInSeconds": 610
}
},
{
"encodedPolyline": "cvn_Io|}pAjDxC",
"encodedPolylinePrecision": 5
},
{
"routeType": "thrilling",
"windingness": "low",
"hilliness": "high"
}
]
}'
post
Request curl command with entry points
curl -X POST "https://api.tomtom.com/routing/1/calculateRoute/52.328416,13.626480:52.36428,13.508614/json?key={Your_API_Key}" -H "Content-type:application/json" -d \
'{
"legs" : [
{
"routeStop": {
"entryPoints": [
{
"latitude": 52.36443,
"longitude": 13.50929
},
{
"latitude": 52.38909,
"longitude": 13.51781
},
{
"latitude": 52.37038,
"longitude": 13.52149
},
{
"latitude": 52.36281,
"longitude": 13.51031
}
],
"preferredEntryPointIndex": 0
}
}
]
}'

Types

The following data table describes the types that can be used in the Calculate Route service.

TypeDescription

location
string

A latitude–longitude pair (in EPSG:4326 projection) with the following constraints:

  • Latitude values must be in the range [-90, +90].

  • Longitude values must be in the range [-180, +180].

Example: 52.37245,4.89406

point
object

A location represented as a JSON object. The object should contain two fields: latitude and longitude, each containing a number. Both values must use the same reference frame and follow the same constraints as the location type. Example: {“latitude”: 52.37245, “longitude”: 4.89406}

circle

A circle with a center point and a radius (in meters). The radius must be a positive integer, with a maximum value of 135000.
Note: If entryPoints are provided to the routeStop, the radius is ignored.
Example: circle(52.37245,4.89406,10000)

generalizedLocation

A location or a circle.
Examples:

  • 52.37245,4.89406
  • circle(52.37245,4.89406,10000)
commaSeparatedFloats

A comma-separated list of floats.
Example: 1.23,0

dateTime
string

A date and time specified in RFC 3339 format with an optional time zone offset.
Examples:

  • 2023-12-19T16:39:57
  • 2023-12-19T16:39:57-08:00

CombustionConstantSpeedConsumptionPair
string (contains a pair of two, comma-separated floats)

A comma-separated speedInkmh,consumptionInLitersPerHundredkm pair. Constraint: speedInkmh must be in the range [0.0, 255.0].
Example: 15.5,10.0

ElectricConstantSpeedConsumptionPair
string (contains a pair of two, comma-separated floats)

A comma-separated speedInkmh,consumptionInkWhPerHundredkm pair. Constraint: speedInkmh must be in the range [0.0, 255.0].
Example: 15.5,8.0

Avoid parameter possible values

Value

Description

tollRoads

Avoids toll roads.

motorways

Avoids motorways.

Note: Avoiding motorways for long routes of approximately 500km+ may result in computation timeouts of the primary route or path alternatives.

ferries

Avoids ferries.

unpavedRoads

Avoids unpaved roads.

carpools

Avoids routes that require use of carpool (HOV/High Occupancy Vehicle) lanes.

alreadyUsedRoads

Avoids using the same road multiple times.
Most useful in conjunction with routeType=thrilling.

borderCrossings

Avoids crossing country borders.

tunnels

Avoids tunnels.

carTrains

Avoids car trains.

lowEmissionZones

Avoids low-emission zones.

Request headers

The following table describes HTTP request headers that are particularly relevant for clients of the Calculate Route service.

  • Required headers must be used; otherwise, the call will fail.
  • Optional headers can be used to customize the request.
  • The order of request headers is not important.

Optional headers

Description

Accept-Encoding

Requests that the response be compressed.
Value: gzip

Content-Encoding

Specifies the compression used for the request body. Currently, only gzip is supported. If not specified, no compression is assumed. This is equal to specifying identity.

Note: This header is optional and can only be used for POST requests.

Values:

  • identity
  • gzip
Content-Type

Specifies the MIME type of the body of the request.

Note: This header is required for POST requests.

Value: application/json

Tracking-ID

Specifies an identifier for the request.

  • The value should be unique for each request.
  • The value must match the regular expression ’^[a-zA-Z0-9-_\.]{1,100}$’.

  • If specified, the same value is sent back in the similar-named response header. Otherwise, a generated value may be sent back.

Base path parameters

The following tables describe the parameters that can be used in the Calculate Route service.

  • Required parameters must be used; otherwise, the call will fail.
  • The order of the required parameters is important and must be followed.
  • Optional parameters can be used to customize the request.
Required parameters (Base path)Description

baseURL
string

The base URL used to call the API.
Values:

  • api.tomtom.com: The default global API endpoint.

  • kr-api.tomtom.com: The region-specific endpoint for South Korea. See the Region-specific content documentation.

versionNumber
integer

The service version number.
Value: The current value is 1.

routePlanningLocations
string

Locations through which the route is calculated. The following constraints apply:

  • At least two locations must be provided.
  • The first location in the sequence defines the origin and must be a location.

  • The last location in the sequence defines the destination and must be a location.

  • One or more optional intermediate generalizedLocations (known as waypoints in this context) may be provided:

    • The maximum allowed number of waypoints is 150.
    • A waypoint of type location results in an extra leg in the response whereas a waypoint of type circle does not.

    • Waypoints of type circle cannot be used when computeBestOrder is true.

Values: Colon-delimited generalizedLocations that follow the constraints mentioned above.

Optional parameters

Description

contentType
string

The content type of the response structure.
Possible values:

  • json
  • jsonp

Note: If the content type is jsonp, a callback method can be specified in the query parameters.

Request parameters

This section presents a set of loosely connected parameters that influence the operation of the routing algorithm. While some of them are associated, the majority can be used independently of the others.

  • Required parameters must be used; otherwise, the call will fail.
  • Optional parameters may be used.
  • The order of the request parameters is not important.

Required parameters

Description

key
string

The API key used to authorize requests to the Routing API.
Value: Your valid API Key.

Optional parametersDescription

callback
string

Specifies the jsonp callback method. Only used when contentType is jsonp.
Default value: callback

report
string

Specifies which data to report for diagnostic purposes. Possible value is: effectiveSettings.

  • Reports the effective parameters or data used when calling the API.

  • For defaulted parameters, the returned value reflects the default if the parameter was not specified.

Default value: effectiveSettings

departAt
string

The date and time of departure from the origin point.

  • Departure times other than now must be specified as a dateTime.

  • If no time zone offset is provided, the origin point’s time zone is assumed.

  • The departAt parameter cannot be used in conjunction with arriveAt.

Default value: now
Other value: dateTime

arriveAt
string

The date and time of arrival at the destination point.

  • It must be specified as a dateTime.

  • If no time zone offset is provided, the destination point’s time zone is assumed.

The arriveAt parameter cannot be used in conjunction with:

  • departAt
  • minDeviationDistance
  • minDeviationTime
  • supportingPointIndexOfOrigin

Value: dateTime

routeType
string

Specifies the type of optimization used when calculating routes.
Possible values:

  • fastest: Route calculation is optimized for travel time while keeping routes sensible. For example, the calculation may avoid shortcuts along inconvenient side roads or long detours that save very little time.

  • shortest: Route calculation is optimized for travel distance while keeping the routes sensible. For example, straight routes are preferred over those with many turns.

    • Use shortest only for short to medium-distance routes. It explores a much larger search space than fastest, so on long-distance routes — especially when combined with waypoints or avoid options — it can exceed the server’s compute time limit and the request will fail with a timeout. For long-distance planning, use fastest instead. See the FAQ entry How can I reduce the response time? for the full list of parameters that increase compute time.

  • short: Route calculation aims to strike a good balance between shorter travel time and shorter travel distance.

  • eco: Route calculation aims to strike a good balance between shorter travel time and lower fuel or energy consumption.

  • thrilling: Route calculation is optimized to include interesting or challenging roads and to use as few motorways as possible.

    • You can configure the level of turns and the degree of hilliness.

    • Use the hilliness and windingness parameters to set this.

    • There is a limit of 900 km on routes planned with routeType=thrilling.

Default value: fastest

traffic
boolean

Possible values are:

  • true: Use all available traffic information during routing.

  • false: Ignore current traffic data during routing. Note that although the current traffic data is ignored during routing, the effect of historic traffic on effective road speeds is still incorporated.

Depending on availability, the Routing API takes road closures and road works into account up to 60 days in the future.
Default value: true

avoid
string

Specifies something that the route calculation should try to avoid when determining the route. The avoid parameter can be specified multiple times (e.g., …&avoid=motorways&avoid=ferries&…).
Possible values are listed under Avoid parameter possible values.

travelMode
string

The mode of travel for the requested route.

  • Note that the requested travelMode may not be available for the entire route.

  • If the requested travelMode is not available for a particular section, the travelMode field for that section in the response will be set to “other”.

Note that travel modes bus, motorcycle, taxi, and van are in BETA functionality.

  • Full restriction data is not available in all areas.

Default value: car
Other values:

  • truck
  • taxi
  • bus
  • van
  • motorcycle
  • bicycle
  • pedestrian

hilliness
string

Degree of hilliness for a thrilling route.
Note: This parameter can only be used in conjunction with routeType=thrilling.
Default value: normal
Other values:

  • low
  • high

windingness
string

Level of turns for a thrilling route.
Note: This parameter can only be used in conjunction with routeType=thrilling.
Default value: normal
Other values:

  • low
  • high

vehicleMaxSpeed
integer

Maximum speed of the vehicle in kilometers/hour.

  • Must have a value in the range [0, 250].

  • A value of 0 means that an appropriate value for the vehicle will be determined and applied during route planning.

Default value: 0

vehicleWeight
integer

Weight of the vehicle in kilograms.

  • If a detailed Consumption model is specified, refer to the following Consumption model parameters section for the documentation of vehicleWeight.

  • If a detailed Consumption model is not specified, and the value of vehicleWeight is non-zero, then weight restrictions are considered.

  • In all other cases, this parameter is ignored.

Default value: 0

vehicleAxleWeight
integer

Weight per axle of the vehicle in kilograms. A value of 0 means that weight restrictions per axle are not considered.
Default value: 0

vehicleNumberOfAxles
integer

Number of axles of the vehicle. A value of 0 means that the number of axles restrictions is not considered.
Default value: 0

vehicleLength
float

Length of the vehicle in meters, including the length of any additional equipment, e.g., trailers, bike racks, etc. A value of 0 means that length restrictions are not considered. Fractional digits are rounded to the closest centimeter while rounding up on a tie.
Default value: 0

vehicleWidth
float

Width of the vehicle in meters. A value of 0 means that width restrictions are not considered. Fractional digits are rounded to the closest centimeter while rounding up on a tie.
Default value: 0

vehicleHeight
float

Height of the vehicle in meters. A value of 0 means that height restrictions are not considered. Fractional digits are rounded to the closest centimeter while rounding up on a tie.
Default value: 0

vehicleCommercial
boolean

Vehicle is used for commercial purposes and thus may not be allowed to drive on some roads.
Default value: false

vehicleLoadType
string

Specifies types of cargo that may be classified as hazardous materials and are restricted from some roads. The vehicleLoadType parameter can be specified multiple times (e.g.,

…&vehicleLoadType=USHazmatClass1&vehicleLoadType=USHazmatClass2&vehicleLoadType=USHazmatClass3&…

or

…&vehicleLoadType=otherHazmatExplosive&vehicleLoadType=otherHazmatHarmfulToWater&…

).
Available values are:

  • US Hazmat classes 1 through 9
  • Generic classifications for use in other countries.

Use these values for routing in the USA:

  • USHazmatClass1: Explosives

  • USHazmatClass2: Compressed gas

  • USHazmatClass3: Flammable liquids

  • USHazmatClass4: Flammable solids

  • USHazmatClass5: Oxidizers

  • USHazmatClass6: Poisons

  • USHazmatClass7: Radioactive

  • USHazmatClass8: Corrosives

  • USHazmatClass9: Miscellaneous

Use these values for routing in all other countries:

  • otherHazmatExplosive: Explosives

  • otherHazmatGeneral: Miscellaneous

  • otherHazmatHarmfulToWater: Harmful to water

Notes:

  • If travelMode is pedestrian or bicycle,vehicleLoadType is not considered.

  • The vehicleLoadType and vehicleAdrTunnelRestrictionCode parameters are independent; please provide both if applicable.

vehicleAdrTunnelRestrictionCode
string

If vehicleAdrTunnelRestrictionCode is specified, the vehicle is subject to ADR tunnel restrictions.

  • Vehicles with code B are restricted from roads with ADR tunnel categories B, C, D, and E.

  • Vehicles with code C are restricted from roads with ADR tunnel categories C, D, and E.

  • Vehicles with code D are restricted from roads with ADR tunnel categories D and E.

  • Vehicles with code E are restricted from roads with ADR tunnel category E.

  • If vehicleAdrTunnelRestrictionCode is not specified, no ADR tunnel restrictions apply.

Notes:

  • If travelMode is pedestrian or bicycle, vehicleAdrTunnelRestrictionCode is not considered.

  • The vehicleAdrTunnelRestrictionCode and vehicleLoadType parameters are independent; please provide both if applicable.

Values (specify at most one):

  • B
  • C
  • D
  • E

Reference:

vehicleHasElectricTollCollectionTransponder string

Specifies whether the route calculation should try to avoid ETC-transponder-only toll roads if the vehicle does not have an ETC transponder. Possible values are:

  • all: Do not avoid ETC-transponder-only toll roads.
  • none: Avoids ETC-transponder-only toll roads.

Default value: all

coordinatePrecision
string

Specifies the precision of coordinates in the response.
Possible values are:

  • default: All coordinates are rounded to 5 digits after the decimal point. Default precision coordinates are targeted towards clients that are sensitive to response sizes. This should be sufficient for most applications.

  • full: All coordinates are rounded to 7 digits after the decimal point. Full precision coordinates are targeted towards applications that require precise polyline visualization at high zoom levels.

Default value: default
Other value: full

reconstructionMode
string

Specifies how to reconstruct a given polyline or individual legs. Note: This parameter can only be used when a route or legs are provided as part of the request by using a polyline representation format (see the Route geometry representation formats section).
For a description of the use of the given polyline, see the Post Data section of the Calculate Route document. Possible values are:

  • normal: Some leeway is allowed when the provided polyline doesn’t exactly match the road network, so that the most sensible route is reconstructed. Use this option in case the given polyline comes from a third party source such as a recorded track, a different routing service, or user input. Consider using the track mode, which is newer and gives better results.

  • strict: Reconstruct the given route as close as possible to the given polyline. This might mean that some driving restrictions are violated in order to closely match the original route. Use this option when reconstructing a route previously received from this service.

  • track: This mode provides flexibility when the provided route polyline does not align well with the road network, allowing the reconstruction of the most sensible route. The input polyline may have inconsistencies such as gaps and loops. When reconstructing the route using track mode, the algorithm will try to respect the driving restrictions and consider traffic conditions. Use this mode when the given polyline originates from a third-party source such as a recorded track, a different routing service, or user input.

  • update: Reconstruct the given route as close as possible to the provided route polyline, ignoring time-dependent driving and legal restrictions in order to keep the input polyline geometry stable. The input polyline is expected to be normalized, without any loops or gaps. Use this option to refresh dynamic data, as required during navigating along your route. Notice: The resulting reconstructed route tries to accurately follow the road network and might result in an illegal route due to potential violation of driving restrictions.

Note: In any of the modes, the algorithm might relax certain restrictions near the origin and destination to offer a more sensible route instead of a no-route-found. This ensures that routes planned with our service can be reconstructed.
Default value: normal
Other values:

  • strict
  • track
  • update


In short, this table summarizes the differences between the modes and restrictions:

Mode / Restrictiontrafficno-throughtime-dependent
normal✗✗✓
strict✓✓✓
track✓✓✓
update✓✗✗

arrivalSidePreference
string

Specifies the preferred roadside for arrival at waypoints and the destination. The stop must be positioned at least two meters on the preferred side of the road, otherwise the behavior will default to anySide. Possible values are:

  • anySide: Both sides of a road could be used to approach the waypoint and destination. When a vehicle arrives, the stop can be on either the left or right side of the road.

  • curbSide: Ensures a minimal number of road crossings at waypoints or the destination. When a vehicle arrives, a stop should be on the right for right-side driving roads or on the left for left-side driving roads.

Default value: anySide
Other value: curbSide

maxAlternatives
integer

Number of desired alternative routes to be calculated. The value provided:

  • Must be an integer in the range 0-5.
  • Using a value greater than 0 in conjunction with computeBestOrder set to true is not allowed.

  • Fewer alternative routes may be returned if either fewer alternatives exist, or the requested number of alternatives is larger than the service can calculate.

Default value: 0
Maximum value: 5

alternativeType
string

When maxAlternatives is greater than 0, it allows the definition of computing alternative routes: finding routes that are significantly different from the reference route, or finding routes that are better than the reference route. Possible values are:

  • anyRoute: returns alternative routes that are significantly different from the reference route.

  • betterRoute: only returns alternative routes that are better than the reference route, according to the given planning criteria (set by routeType). Additionally, there are rules in place ensuring that only routes providing meaningful improvement over the reference route will be proposed as better routes (e.g., a few seconds faster routes won’t be proposed). If there is a road block on the reference route, then any alternative that does not contain any blockages will be considered a better route. The summary in the route response will contain information (see the planningReason parameter) about the reason for the better alternative.

Note: The betterRoute value can only be used when reconstructing a reference route.

Default value: anyRoute
Other values: betterRoute

minDeviationDistance
integer

All alternative routes returned will follow the reference route (see the POST data parameters section) from the origin point of the calculateRoute request for at least this number of meters.

  • Can only be used when reconstructing a route.
  • The minDeviationDistance parameter cannot be used in conjunction with arriveAt.

Default value:0

minDeviationTime
integer

All alternative routes returned will follow the reference route (see the POST data parameters section) from the origin point of the calculateRoute request for at least this number of seconds.

  • Can only be used when reconstructing a route.
  • The minDeviationTime parameter cannot be used in conjunction with arriveAt.

Default value:0

supportingPointIndexOfOrigin
integer

Largest index in the given polyline per route or in the joined polyline per leg (see the POST data parameters section) for which element with the index supportingPointIndexOfOrigin lies on or before the origin point.
The Routing API uses this index as a hint to disambiguate situations where the points of the given polyline in the POST data are not planar, or where they come back close to the origin at a later point in the reconstructed route. In these cases, the supportingPointIndexOfOrigin can explicitly identify if the origin is meant to be on the later part of the route, or not.

  • Can only be used when reconstructing a route.
  • Cannot be used in conjunction with arriveAt.

Minimum value: 0
Maximum value: Size of the given polyline - 1.

computeBestOrder
boolean

Re-orders the route waypoints with a fast heuristic algorithm to reduce the overall route length. Note that based on the heuristic nature of the algorithm, optimality is not guaranteed. Yields the best results when used in conjunction with routeType shortest.
Possible boolean values are:

  • true: compute a better order, if possible

    • Not allowed to be used in conjunction with a maxAlternatives value greater than 0.

    • Not allowed to be used in conjunction with circle waypoints.

    The response will include the reordered waypoint indices in the field optimizedWaypoints.

  • false: use the locations in the given order.

    • Not allowed to be used in conjunction with routeRepresentation=none.

Default value:false

routeRepresentation
string

Specifies the representation of the set of routes provided as a response.
Possible values are:

  • polyline: includes routes in the response as polylines. The polylines are returned in the points fields in the response.

  • encodedPolyline: includes routes in the response in the encoded polyline format. The encoded polylines are returned in the encodedPolyline fields and their precisions in the encodedPolylinePrecision fields in the response.

  • summaryOnly: as per polyline, but excluding the points fields for the routes in the response.

  • none: only includes the optimized waypoint indices but does not include the routes in the response. This parameter value can only be used in conjunction with computeBestOrder=true.

Default value: polyline
Other values:

  • encodedPolyline
  • summaryOnly
  • none

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:

  • none: do not compute additional travel times.

  • all: compute travel times for all types of traffic information, specifying all results in the fields:

    • noTrafficTravelTimeInSeconds
    • historicTrafficTravelTimeInSeconds
    • liveTrafficIncidentsTravelTimeInSeconds

    being included in the summaries in the route response.

Default value: none
Other value: all

vehicleHeading
integer

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.

Maximum value: 359
Other values: 0-359
Note: The vehicle heading is ignored when doing the base route reconstruction if reconstructionMode is set to strict or update.

sectionType
string

Specifies which of the section types is reported in the route response. sectionType can be specified multiple times (e.g., …&sectionType=tollRoad&sectionType=tollVignette&…).
Possible values are:

  • carTrain: sections of the route that are car trains.

  • ferry: sections of the route that are ferries.

  • tunnel: sections of the route that are tunnels.

  • motorway: sections of the route that are motorways.

  • pedestrian: sections of the route that are only suited for pedestrians.

  • tollRoad: sections of the route that require a toll to be paid.

  • toll: sections of the route with the usage-based toll collection system (i.e., distance-based tolls, toll bridges and tunnels, weight-based tolls).

  • tollVignette: sections of the route that require a toll vignette to be present.

  • country: sections indicating which countries the route is in.

  • travelMode: sections in relation to the request parameter travelMode.

  • traffic: sections of the route that contain traffic information.

  • carpool: sections of the route that require use of carpool (HOV/High Occupancy Vehicle) lanes.

  • urban: sections of the route that are located within urban areas.

  • unpaved: sections of the route that are unpaved.

  • lowEmissionZone: sections of the route that are located within low-emission zones.

  • roadShields: sections with road shield information. A road shield section contains:

    Notes: If this section type is requested, calculateRouteResponse contains the additional field roadShieldAtlasReference.
    Please refer to the notes about the road shield atlas for further information.
    The road shields are only available in these supported countries.

  • speedLimit: Sections with legal speed limit information. maxSpeedLimitInKmh: The maximum legal speed limit in kilometers/hour. This can be time-dependent and/or vehicle-dependent.

    • Time can be set by either the departAt or arriveAt request parameter. In the case of a time-dependent speed limit, the section will contain the speed limit effective at the time the planned route would enter this section.

    • Vehicle information can be set by adjusting the travelMode and vehicle* request parameters.

    • Requesting legal speed limits is only valid if travelMode is adjusted to be a motorized vehicle ( car, truck, taxi, bus, van, or motorcycle).

  • importantRoadStretch: Sections with important stretches of road information. importantRoadStretch provides a set of street names and/or a set of road numbers that allow the driver to identify and distinguish the course of the route (from other potential routes).

Default value: travelMode
Other values:

  • carTrain
  • country
  • ferry
  • motorway
  • pedestrian
  • tollRoad
  • toll
  • tollVignette
  • traffic
  • tunnel
  • carpool
  • urban
  • unpaved
  • lowEmissionZone
  • roadShields
  • speedLimit
  • importantRoadStretch

includeTollPaymentTypes string

Include toll payment types in the toll section. If a toll section has different toll payment types in its subsections, this toll section is split into multiple toll sections with the toll payment types. Possible values:

  • all Include toll payment types in the toll section.
  • none Do not include toll payment types in the toll section.

The value all must be used together with sectionType=toll.


Default value: none

chargeMarginsInkWh
comma-separated floats

Specifies a list of margins in kilowatt-hours (kWh) for computing reachableRouteOffsets.

  • Can only be used when all of constantSpeedConsumptionInkWhPerHundredkm, maxChargeInkWh, and currentChargeInkWh are specified.

  • The items in the list must be in strictly decreasing order.
  • The list is restricted to exactly one item.

Minimum value: 0
Maximum value: 0

extendedRouteRepresentation
string

Specifies the extended representation of the set of routes provided as a response. <extendedRouteRepresentation> can be specified multiple times (e.g., …&extendedRouteRepresentation=distance&extendedRouteRepresentation=travelTime&extendedRouteRepresentation=consumption&… ). <extendedRouteRepresentation> can only be specified when contentType is json and routeRepresentation is polyline or encodedPolyline.
Possible values are:

  • distance: Includes distances to route polyline points in the response.

  • travelTime: Includes travel times to route polyline points in the response.

  • consumption: Includes consumption values dependent on the vehicleEngineType to route polyline points in the response.

    • Can only be used when the vehicleEngineType is set to electric and the constantSpeedConsumptionInkWhPerHundredkm is specified.

Values:
  • distance
  • travelTime
  • consumption

language
string

The language parameter determines the language of the returned names of places in general and also of the messages and phonetic translations in guidance.

  • Proper nouns (the names of streets, plazas, etc.) are returned in the specified language, or if that is not available, they are returned in an available language that is close to it.

  • The currently supported languages are listed on the Supported Languages page. The allowed values for the language parameter are the IETF language tags (or abbreviations in some cases) provided there.

Default value:en-GB

Deprecation notice

March 15, 2024

  • Value tollRoad for the input parameter sectionType as well as the respective response section type TOLL_ROAD have been deprecated.
  • This section will be withdrawn following a 12-month deprecation period.
  • The planned withdrawal date is March 15, 2025.
  • Following withdrawal, requests for the toll road section may result in an HTTP 400 error in the response.

We recommend using the toll and toll vignette section types instead.

Consumption model parameters

Routing provides a set of parameters for describing a vehicle-specific Consumption model in detail. These parameters can be specified in a calculateRoute request.

Depending on the value of vehicleEngineType, we support two principal Consumption models:

  • Combustion consumption model
  • Electric consumption model

Note:

  • Specifying parameters that belong to different models in the same request is an error.
  • A Consumption model cannot be used with the travelMode values of bicycle and pedestrian.

Using the detailed consumption model has two consequences for a calculateRoute request:

  • When the parameter routeType is set to eco, then the Consumption Model will be taken into account for route planning.
  • When constantSpeedConsumption* is specified, the response will include either fuelConsumptionInLiters or batteryConsumptionInkWh (for vehicleEngineType set to combustion or electric, respectively) as an additional field in each summary element.

Parameter constraints

In both Consumption models, explicitly specifying some parameters requires specifying some others as well. In addition, some parameters are mutually exclusive. These are the constraints:

  1. All parameters require constantSpeedConsumption* to be specified by the user.
    • It is an error to specify any other Consumption model parameter (with the exception of vehicleWeight) if constantSpeedConsumption* is not specified.
  2. accelerationEfficiency and decelerationEfficiency must always be specified as a pair (i.e., both or none).
    • If accelerationEfficiency and decelerationEfficiency are specified, the product of their values must not be greater than 1 (to prevent perpetual motion).
  3. uphillEfficiency and downhillEfficiency must always be specified as a pair (i.e., both or none).
    • If uphillEfficiency and downhillEfficiency are specified, the product of their values must not be greater than 1 (to prevent perpetual motion).
  4. consumptionInkWhPerkmAltitudeGain and recuperationInkWhPerkmAltitudeLoss must always be specified as a pair (i.e., both or none).
    • If they are specified, recuperationInkWhPerkmAltitudeLoss must not be greater than consumptionInkWhPerkmAltitudeGain (to prevent perpetual motion).
  5. If *Efficiency parameters are specified by the user, then vehicleWeight must also be specified.
    • When vehicleEngineType is combustion, fuelEnergyDensityInMJoulesPerLiter must be specified as well.
  6. If *Efficiency parameters are specified by the user, then consumptionInkWhPerkmAltitudeGain and recuperationInkWhPerkmAltitudeLoss cannot be specified.
  7. maxChargeInkWh and currentChargeInkWh must always be specified as a pair (i.e., both or none).

Note that if only constantSpeedConsumption* is specified, no other consumption aspects are taken into account, i.e., slopes and vehicle acceleration are not considered for consumption computations.

Selecting the Consumption model

There are two available Consumption models: Combustion and Electric.

  • A model is selected by specifying the corresponding constantSpeedConsumption* parameter and possibly further parameters that belong to the same model.
  • The chosen model must match the value of the vehicleEngineType parameter.

Optional parameter

Description

vehicleEngineType
string

The engine type of the vehicle. When a detailed Consumption model is specified, it must be consistent with the value of vehicleEngineType.
Default value: combustion
Other value: electric

The Combustion consumption model

The Combustion consumption model is used when the vehicleEngineType value is set to combustion. The following data table describes all of the parameters that can be specified in a request using the Combustion model.

  • Required parameters must be used or the call will fail.
  • Optional parameters may be used.
  • The order of parameters in a request is not important.

Required parameters

Description

constantSpeedConsumptionInLitersPerHundredkm
Colon-delimited list of CombustionConstantSpeedConsumptionPair

Specifies the speed-dependent component of consumption.

  • Provided as an unordered list of speed/consumption rate pairs.

  • The list defines points on a consumption curve.

Consumption rates for speeds not in the list are found as follows:

  • By linear interpolation, if the given speed lies in between two speeds in the list.

  • By linear extrapolation otherwise, assuming a constant (ΔConsumption/ΔSpeed) determined by the nearest two points in the list.

The list must contain between 1 and 25 points (inclusive), and may not contain duplicate points for the same speed.

  • If it only contains a single point, then the consumption rate of that point is used without further processing.

Consumption specified for the largest speed must be greater than or equal to that of the penultimate largest speed.

  • This ensures that extrapolation does not lead to negative consumption rates.

  • Similarly, consumption values specified for the two smallest speeds in the list cannot lead to a negative consumption rate for any smaller speed.

  • The minimum and maximum values described here refer to the valid range for the consumption values (expressed in l/100km).

Minimum value: 0.01
Maximum value: 100000.0

Optional parameters

Description

vehicleWeight
integer

Weight of the vehicle in kilograms.
Note: It is mandatory if any of the Efficiency parameters are set.

  • This is the same parameter as documented in the Request parameters section.

  • It must be strictly positive when used in the context of the Consumption model.

  • Weight restrictions are considered.

Minimum value: 1

currentFuelInLiters
float

Specifies the current supply of fuel in liters.
Minimum value: 0.0

auxiliaryPowerInLitersPerHour
float

Specifies the amount of fuel consumed for sustaining auxiliary systems of the vehicle, in liters per hour. It can be used to specify consumption due to devices and systems such as AC systems, radio, heating, etc.
Minimum value: 0.0

fuelEnergyDensityInMJoulesPerLiter
float

Specifies the amount of chemical energy stored in one liter of fuel in megajoules (MJ).

  • It is used in conjunction with the Efficiency parameters for conversions between saved or consumed energy and fuel.

  • For example, energy density is 34.2 MJ/l for gasoline and 35.8 MJ/l for diesel fuel.

  • This parameter must be used/required if any *Efficiency parameter is set.

Minimum value: 1.0

accelerationEfficiency
float

Note: This must be paired with decelerationEfficiency.

  • Specifies the efficiency of converting chemical energy stored in fuel to kinetic energy when the vehicle accelerates, (i.e., KineticEnergyGained/ChemicalEnergyConsumed).
  • ChemicalEnergyConsumed is obtained by converting consumed fuel to chemical energy using fuelEnergyDensityInMJoulesPerLiter.

Minimum value: 0.01
Maximum value: 1/decelerationEfficiency

decelerationEfficiency
float

Note: This must be paired with accelerationEfficiency.

  • Specifies the efficiency of converting kinetic energy to saved (not consumed) fuel when the vehicle decelerates (i.e., ChemicalEnergySaved/KineticEnergyLost).
  • ChemicalEnergySaved is obtained by converting saved (not consumed) fuel to energy using fuelEnergyDensityInMJoulesPerLiter.

Minimum value: 0.01
Maximum value: 1/accelerationEfficiency

uphillEfficiency
float

Note: This must be paired with downhillEfficiency.

  • Specifies the efficiency of converting chemical energy stored in fuel to potential energy when the vehicle gains elevation (i.e., PotentialEnergyGained/ChemicalEnergyConsumed).
  • ChemicalEnergyConsumed is obtained by converting consumed fuel to chemical energy using fuelEnergyDensityInMJoulesPerLiter.

Minimum value: 0.01
Maximum value: 1/downhillEfficiency

downhillEfficiency
float

Note: This must be paired with uphillEfficiency.

  • Specifies the efficiency of converting potential energy to saved (not consumed) fuel when the vehicle loses elevation (i.e., ChemicalEnergySaved/PotentialEnergyLost).
  • ChemicalEnergySaved is obtained by converting saved (not consumed) fuel to energy using fuelEnergyDensityInMJoulesPerLiter.

Minimum value: 0.01
Maximum value: 1/uphillEfficiency

The Electric Consumption model

The Electric Consumption model is used when vehicleEngineType is set to electric.

The following data table describes all parameters that can be specified in a request using the Electric model.

  • Required parameters must be used or the call will fail.
  • Optional parameters may be used.
  • The order of parameters in a request is not important.

Required parameters

Description

constantSpeedConsumptionInkWhPerHundredkm
Colon-delimited list of ElectricConstantSpeedConsumptionPair

Specifies the speed-dependent component of consumption.

  • Provided as an unordered list of speed/consumption-rate pairs.

  • The list defines points on a consumption curve.

Consumption rates for speeds not in the list are found as follows:

  • By linear interpolation, if the given speed lies between two speeds in the list.

  • Otherwise, by linear extrapolation using a constant (ΔConsumption/ΔSpeed) derived from the nearest two points in the list.

The list must contain between 1 and 25 points (inclusive), and may not contain duplicate points for the same speed.

  • If it only contains a single point, then the consumption rate of that point is used without further processing.

  • Consumption specified for the largest speed must be greater than or equal to that of the penultimate largest speed. This ensures that extrapolation does not lead to negative consumption rates.

  • Similarly, consumption values specified for the two smallest speeds in the list cannot lead to a negative consumption rate for any smaller speed. The minimum and maximum values described here refer to the valid range for the consumption values (expressed in kWh/100km).

Minimum value: 0.01
Maximum value: 100000.0

vehicleWeight
integer

Note: This is required only if any *Efficiency parameter is set.

  • This is the same parameter as documented in the Request parameters section.

  • It must be strictly positive when used in the context of the Consumption model.

  • Weight restrictions are considered.

Minimum value: 1

Optional parameters

Description

currentChargeInkWh
float

Specifies the current electric energy supply in kilowatt hours (kWh).
Note: Requires maxChargeInkWh to be set.
Minimum value: 0.0
Maximum value: maxChargeInkWh

maxChargeInkWh
float

Specifies the maximum electric energy supply in kilowatt hours (kWh) that may be stored in the vehicle’s battery.
Note: Requires currentChargeInkWh to be set.
Minimum value: currentChargeInkWh

auxiliaryPowerInkW
float

Specifies the amount of power consumed for sustaining auxiliary systems, in kilowatts (kW). It can be used to specify consumption due to devices and systems such as AC systems, radio, heating, etc.
Minimum value: 0.0

accelerationEfficiency
float

Specifies the efficiency of converting electric energy into kinetic energy when the vehicle accelerates (i.e., KineticEnergyGained/ ElectricEnergyConsumed).
Notes:

  • It must be paired with decelerationEfficiency.
  • It cannot be used with consumptionInkWhPerkmAltitudeGain or recuperationInkWhPerkmAltitudeLoss.

Minimum value: 0.01
Maximum value: 1.0

decelerationEfficiency
float

Specifies the efficiency of converting kinetic energy into electric energy when the vehicle decelerates (i.e., ElectricEnergyGained/ KineticEnergyLost).
Notes:

  • It must be paired with accelerationEfficiency.

  • It cannot be used with consumptionInkWhPerkmAltitudeGain or recuperationInkWhPerkmAltitudeLoss.

Minimum value: 0.01
Maximum value: 1/accelerationEfficiency

uphillEfficiency
float

Specifies the efficiency of converting electric energy into potential energy when the vehicle gains elevation (i.e., PotentialEnergyGained/ElectricEnergyConsumed).
Notes:

  • It must be paired with downhillEfficiency.

  • It cannot be used with consumptionInkWhPerkmAltitudeGain or recuperationInkWhPerkmAltitudeLoss.

Minimum value: 0.01
Maximum value: 1.0

downhillEfficiency
float

Specifies the efficiency of converting potential energy to electric energy when the vehicle loses elevation (i.e, ElectricEnergyGained/PotentialEnergyLost).
Notes:

  • It must be paired with uphillEfficiency.

  • It cannot be used with consumptionInkWhPerkmAltitudeGain or recuperationInkWhPerkmAltitudeLoss.

Minimum value: 0.01
Maximum value: 1/uphillEfficiency

consumptionInkWhPerkmAltitudeGain
float

Specifies the amount of electric energy, in kWh, consumed by the vehicle when gaining 1000 meters of elevation.
Notes:

  • It must be paired with recuperationInkWhPerkmAltitudeLoss.

  • It cannot be used with accelerationEfficiency, decelerationEfficiency, uphillEfficiency, or downhillEfficiency.

Minimum value: recuperationInkWhPerkmAltitudeLoss
Maximum value: 500.0

recuperationInkWhPerkmAltitudeLoss
float

Specifies the amount of electric energy, in kWh, gained by the vehicle when losing 1000 meters of elevation.
Notes:

  • It must be paired with consumptionInkWhPerkmAltitudeGain.

  • It cannot be used with accelerationEfficiency, decelerationEfficiency, uphillEfficiency or downhillEfficiency.

Minimum value: 0.0
Maximum value: consumptionInkWhPerkmAltitudeGain

Sensible values of consumption parameters

It is possible that a particular set of consumption parameters is rejected, even though it might fulfill all the explicit requirements specified above. This will happen when the value of a specific parameter, or a combination of values of several parameters, is deemed to lead to unreasonable magnitudes of consumption values.

If that happens, it most likely indicates an input error, as proper care is taken to accommodate all sensible values of consumption parameters. In case a particular set of consumption parameters is rejected, the accompanying error message will contain a textual explanation of the reason(s).

Example

To give the feeling of the magnitudes of reasonable parameter values, the following data table provides an example of sensible values for the Combustion and Electric models.

Parameter

Sensible values by model

constantSpeedConsumptionInLitersPerHundredkm
Colon-delimited list of CombustionConstantSpeedConsumptionPair

  • Combustion model: 50,6.3:130,11.5

  • Electric model: -

constantSpeedConsumptionInkWhPerHundredkm
Colon-delimited list of ElectricConstantSpeedConsumptionPair

  • Combustion model: -
  • Electric model: 50,8.2:130,21.3

vehicleWeight
integer

  • Combustion model: 1600

  • Electric model: 1900

currentFuelInLiters
integer

  • Combustion model: 55

  • Electric model: -

currentChargeInkWh
float

  • Combustion model: -
  • Electric model: 43

maxChargeInkWh
float

  • Combustion model: -
  • Electric model: 85

auxiliaryPowerInLitersPerHour
float

  • Combustion model: 0.2

  • Electric model: -

auxiliaryPowerInkW
float

  • Combustion model: -
  • Electric model: 1.7

fuelEnergyDensityInMJoulesPerLiter
float

  • Combustion model: 34.2

  • Electric model: -

accelerationEfficiency
float

  • Combustion model: 0.33

  • Electric model: 0.66

decelerationEfficiency
float

  • Combustion model: 0.83

  • Electric model: 0.91

uphillEfficiency
float

  • Combustion model: 0.27

  • Electric model: 0.74

downhillEfficiency
float

  • Combustion model: 0.51

  • Electric model: 0.73

consumptionInkWhPerkmAltitudeGain
float

  • Combustion model: -
  • Electric model: 7.0

recuperationInkWhPerkmAltitudeLoss
float

  • Combustion model: -
  • Electric model: 3.8

POST data parameters

Some parameters can be provided using the HTTP POST method.

  • The POST data should be in JSON format, see the Content-Type header.
  • All POST data parameters are optional.
  • It is an error to use the HTTP POST method if no POST data parameters are provided.

There is an upper limit on the total size of the POST data.

  • Exceeding this limit results in a response with the response code 413, indicating invalid POST data.
  • Clients must not rely on the exact value of this limit.
  • The current limit is 10 MB.

The supportingPoints and encodedPolyline fields, which represent a polyline using different route geometry formats, are used to reconstruct a route. This route is then used as a reference route for route reassessment, or to calculate zero or more alternative routes.
For more information on representing route geometry formats, see the Route geometry representation formats section.

  • There are two ways to pass these polyline representations: for the entire route or per leg.
  • The provided polyline is used as input for route reconstruction.
  • The pointWaypoints field is used to represent waypoints when reconstructing a route.
  • The alternative routes are calculated between the origin and destination points specified in the routePlanningLocations, passing through all intermediate locations specified in the pointWaypoints field.
  • If supportingPointIndexOfOrigin is not used, and both minDeviationDistance and minDeviationTime 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.
  • 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.

Using supportingPointIndexOfOrigin, or 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).
    • If used, supportingPointIndexOfOrigin must precisely indicate the location of the origin point in relation to the given polyline.
  • The reference route, returned as the first route in the calculateRoute response, will start at the origin point specified in the calculateRoute request. The initial part of the input reference route up until the origin point will be excluded from the response.
  • The values of minDeviationDistance and minDeviationTime determine how far alternative routes will be guaranteed to follow the reference route from the origin point onwards.
  • The vehicleHeading is ignored.

The following table describes the parameters that can be used in the Calculate Route service.

ParameterDescription

supportingPoints
array of point objects

An array of point objects, to be used as input for route reconstruction.
For more information on representing route geometry formats, see the Route geometry representation formats section.

encodedPolyline
string

A string in the encoded polyline format, representing the array of points to be used as input for route reconstruction.
The precision used to encode the polyline must be set in the encodedPolylinePrecision field.
For more information on representing route geometry formats, see the Route geometry representation formats section.

encodedPolylinePrecision
integer

The precision used to encode the polyline in the encodedPolyline field.
Must be 5 or 7.
Must be paired with encodedPolyline.

pointWaypoints

An array of pointWaypoint objects, to be used to represent waypoints when reconstructing a route.

  • If specified, the array must not be empty.

  • If specified, all location waypoints in the routePlanningLocations will be ignored.

pointWaypoint

Contains one waypointSourceType and one supportingPointIndex object.

waypointSourceType

Denotes the source of the waypoint. Possible values:

  • USER_DEFINED: a waypoint that was explicitly defined by the user.

supportingPointIndex

An index of an element of the given polyline that denotes the location of the waypoint on the reference route.
For more information on representing polylines, see the Route geometry representation formats section.

  • Must fall within the boundaries of the given polyline.

reassessmentParameterSets

An array of reassessmentParameterSet objects, to be used as input for route reassessment.

  • Route reassessment provides information on how some route properties would change based on different input values (note that reassessment does not affect the shape of the route). For example, route reassessment can be used to quantify the impact of air conditioning use on total power consumption.

  • If specified, the array must contain exactly one entry.
  • A reassessmentParameterSet object is a set of parameters used together to reassess the planned route. Such an object must contain at least one parameter; currently the only supported parameter is auxiliaryPowerInkW.

legs
array

An array of objects with the parameters for the computation of each leg. If the parameter is such that it is available for use in the query parameters, then its simultaneous use in the query parameters and in the POST data is prohibited, and such a request will be returned with an error.
If the legs field is present in the POST data, then the number of elements in the array must be equal to the number of waypoints + 1.
It is prohibited to use per leg parameters together with circle waypoints.
If there is no need to specify any parameters for some leg, then an empty object must be specified.
It may contain the following fields:

  • routeType: specifies the type of optimization used when calculating the leg. For the details, please see the Request parameters section.
    Default value: fastest

  • hilliness: specifies the degree of hilliness for a thrilling route. For the details, please see the Request parameters section.
    Default value: normal

  • windingness: specifies the level of turns for a thrilling route. For the details, please see the Request parameters section.
    Default value: normal

  • routeStop: an object of RouteStop type with additional parameters for the stop at the end of the current leg. It must be omitted if not needed.

  • supportingPoints: An array of point objects, to be used as input for leg reconstruction.
    supportingPoints cannot be used for the entire route and per leg simultaneously.
    supportingPoints per leg cannot be used in conjunction with pointWaypoints.
    When using minDeviationTime, minDeviationDistance, or supportingPointIndexOfOrigin, all legs must have non-empty supporting points.
    A supportingPoints array must cover the whole leg, and the itinerary points (an origin, a destination, or a waypoint) must be located at (or very near to) the first and last points.
    supportingPoints must be omitted if not needed.
    When supportingPoints is specified, it must have at least two elements.
    For more information on representing route geometry formats, see the Route geometry representation formats section.

  • encodedPolyline: A string in the encoded polyline format, representing the array of points to be used as input for leg reconstruction.
    The precision used to encode the polyline must be set in the encodedPolylinePrecision field.
    encodedPolyline must be omitted if not needed.
    For more information on representing route geometry formats, see the Route geometry representation formats section.

  • encodedPolylinePrecision: The precision used to encode the polyline in the encodedPolyline field.
    Must be 5 or 7.
    Must be paired with encodedPolyline.
    Must be omitted if not needed.

  • avoids: An array of objects of type Route avoid.
    Must be omitted if not needed.
    Must not be used together with avoid query parameter.

For an example that uses the legs field, please see the POST curl command examples section.

avoidVignette
array

This is an array of strings. Each string should be a 3-character, ISO 3166-1, alpha-3 country code.

  • The array describes the countries in which all toll roads with vignettes are to be avoided.

  • Toll roads with vignettes in countries not in the array are unaffected.

Note: It is an error to specify both avoidVignette and allowVignette.

allowVignette
array

This is an array of strings. Each string should be a 3-character, ISO 3166-1, alpha-3 country code.

  • The array describes the countries in which toll roads with vignettes are allowed.

  • Specifying allowVignette with an array of countries is equivalent to specifying avoidVignette with the array of all countries other than those specified in allowVignette.

  • Specifying allowVignette with an empty array is the same as avoiding all toll roads with vignettes.

Note: It is an error to specify both avoidVignette and allowVignette.

avoidAreas
object

Defines areas of certain shapes that should be avoided when planning routes. Supported shapes include rectangles. It can contain one of each supported shapes fields.

rectangles
array

This is an array of objects, with a maximum of ten elements. Each object describes an axis-aligned rectangle, defined using the fields southWestCorner and northEastCorner.

  • The maximum size of a rectangle is about 160x160 km.
  • A rectangle cannot cross the 180th meridian.
  • Each rectangle must lie between -80 and +80 degrees of latitude.

southWestCorner
object

The south-west corner of a rectangle. It is an object consisting of a latitude and a longitude field, each field containing the value in degrees as a number.

northEastCorner
object

The north-east corner of a rectangle. It is an object consisting of a latitude and a longitude field, each field containing the value in degrees as a number.

RouteStop

Optional parameters

Description

pauseTimeInSeconds
integer

Specifies the waiting time at route stops (including charging time). It must be 0 in the last leg (the destination).
Default value: 0

entryPoints
array of EntryPoint objects

Specifies the entry points for the stop at the end of the current leg. The route to the stop is calculated based on these entry points.

  • Entries with the same location are not allowed.

  • If specified, the array must not be empty.

preferredEntryPointIndex
integer

Specifies the index of the preferred entry point. An index of 0 denotes the first entry point. Selecting an entry point as preferred does not guarantee that it will be used as the destination.

  • Can only be specified if entryPoints are set.

  • Must be less than the number of entryPoints.

EntryPoint

Parameters

Description

latitude
float

The latitude of the entry point. Required.

longitude
float

The longitude of the entry point. Required.

Route avoid


The route calculation will try to avoid the specified road attribute for the leg that contains it.

ParametersDescription
namestring

Specifies the name of the road attribute for route calculation to try to avoid. Possible values are listed under Avoid parameter possible values.

post
Route avoid example
{
[...],
"legs":[
{
"avoids":[
{
"name":"motorways"
}
]
}
],
[...]
}

Avoiding roads with usage-based toll collection

There is special behavior where only roads with usage-based toll collection could be avoided.

Scenario 1:
  • avoid = tollRoad
  • "allowVignette": [value]

Result: Roads with usage-based toll collection are avoided. Toll roads requiring vignettes are also avoided, except in selected countries (marked as value above) where toll roads with vignettes are allowed. Note: In this scenario, avoidVignette has to be None.

Scenario 2:
  • avoid = tollRoad
  • "avoidVignette": [value]

Result: Roads with usage-based toll collection are avoided. Toll roads requiring vignettes are allowed, except in selected countries (marked as value above) where toll roads with vignettes are avoided. Note: In this scenario, allowVignette has to be None.

Vignette request content example
post
Vignette request content example
{
"avoidVignette": ["AUS", "CHE"],
"avoidAreas": {
"rectangles": [
{
"southWestCorner": {
"latitude": 48.81851,
"longitude": 2.26593
},
"northEastCorner": {
"latitude": 48.90309,
"longitude": 2.41115
}
}
]
}
}

Request content example

Note: For brevity, the following example may include fields that are incompatible with one another. In practice, only a subset of these fields will be used in a valid request.

post
Request content example
{
"supportingPoints": [
{"latitude": 52.50930, "longitude": 13.42936},
{"latitude": 52.50844, "longitude": 13.42859},
{"latitude": 52.50601, "longitude": 13.42742}
],
"encodedPolyline": "ogcph^_esc_GnxOf`Nvmn@fzU",
"encodedPolylinePrecision": 7,
"pointWaypoints": [
{
"waypointSourceType": "USER_DEFINED",
"supportingPointIndex": 0
},
{
"waypointSourceType": "USER_DEFINED",
"supportingPointIndex": 1
}
],
"avoidVignette": [
"AUS",
"CHE"
],
"reassessmentParameterSets": [
{
"auxiliaryPowerInkW": 0.3
}
],
"legs": [
{
"routeType": "eco",
"routeStop": {
"pauseTimeInSeconds": 610,
"entryPoints": [
{
"latitude": 52.50601,
"longitude": 13.42742
}
]
}
},
{
},
{
"routeType": "short"
}
]
}

Response data

Response headers

The following data table describes HTTP response headers of particular interest to Calculate Route service clients.

Header

Description

Access-Control-Expose-Headers

The service whitelists response headers that browsers are allowed to access.
Value: Content-Length

Access-Control-Allow-Origin

The service allows cross-origin resource sharing.
Value: * (wildcard)

Content-Encoding

The service supports HTTP compression, if requested by the client.
Value: gzip

Content-Type

The format of the response. The service supports specifying the desired response format. See the contentType parameter.
Values:

  • application/json; charset=utf-8
  • application/javascript; charset=utf-8
Cache-Control

The Cache-Control general-header field is used to specify directives that must be obeyed by all caching mechanisms along the request/response chain. It is supported by HTTP/1.1 clients. It may not be supported by HTTP/1.0 clients.
Values:

  • no-cache
  • no-transform
Pragma

The Pragma general-header field is used to specify directives that might apply to any recipient along the request/response chain. It is supported by HTTP/1.0 clients.
Value: no-cache

Tracking-ID

This is an identifier for the request. If Tracking-ID was specified in the request headers, it contains the same value. Otherwise, it may contain a generated value.

Warning

This may be sent for deprecated features.

Response codes

The following table describes HTTP response codes of particular interest to Calculate Route service clients.

Code

Meaning & possible causes

200

OK: A route or range was calculated and the body of the response contains the data for a successful response.

400

Bad request:

  • One or more parameters were incorrectly specified.
  • Some parameters are mutually exclusive.
  • The points in the route request are not connected by the road network.

  • The points in the request are not near enough to a road.
403

Permission or authentication issues:

  • Forbidden
  • Not authorized
  • Account inactive
404

Not Found: The requested resource could not be found, but it may be available again in the future.

405

Method Not Allowed: The client used an HTTP method other than GET or POST.

408

Request timeout: The client took too long to transmit the request.

414

The request URI is too long.

415

Unsupported media type.

429

Too Many Requests: Too many requests were sent in a given amount of time for the supplied API Key.

500

An error occurred while processing the request. Please try again later. This can also indicate that the request reached an internal computation time threshold and timed out.

502

Internal network connectivity issue.

503

Service currently unavailable.

504

Internal network connectivity issue.

596

Service not found.

Example of a successful response

The routes in a successful response are listed in the order of decreasing optimality. If the request includes the supportingPoints field, the response first returns the reconstructed route, followed by any alternative routes.

Note: For brevity, this example includes all fields described in this document. In practice, some fields may be incompatible with others, and only a subset of them will be present in the response, depending on the request parameters used.

A response could look like this: (Note: Comments are contained within ... ....)

Response body - JSON
{
"formatVersion": "0.0.12",
"routes": [
{
"summary": {
"lengthInMeters": 1147,
"travelTimeInSeconds": 161,
"trafficDelayInSeconds": 15,
"trafficLengthInMeters": 147,
"departureTime": "2015-04-02T15:01:57+02:00",
"arrivalTime": "2015-04-02T15:04:38+02:00",
"noTrafficTravelTimeInSeconds": 120,
"historicTrafficTravelTimeInSeconds": 157,
"liveTrafficIncidentsTravelTimeInSeconds": 161,
"batteryConsumptionInkWh": 0.155,
"deviationDistance": 1735,
"deviationTime": 127,
"deviationPoint": {
"latitude": 52.50904,
"longitude": 13.42912
},
"reachableRouteOffsets": [
{
"chargeMarginInkWh": 0.0,
"routeOffsetInMeters": 1147,
"point": {
"latitude": 52.51565,
"longitude": 13.43979
},
"pointIndex": 50
}
]
},
"routeReassessments": [
{
"batteryConsumptionInkWh": 0.2,
"reachableRouteOffsets": [
{
"chargeMarginInkWh": 0.0,
"routeOffsetInMeters": 1147,
"point": {
"latitude": 52.51565,
"longitude": 13.43979
},
"pointIndex": 50
}
]
}
],
"legs": [
{
"summary": {
"lengthInMeters": 108,
"travelTimeInSeconds": 11,
"trafficDelayInSeconds": 0,
"trafficLengthInMeters": 0,
"departureTime": "2015-04-02T15:01:57+02:00",
"arrivalTime": "2015-04-02T15:02:07+02:00",
"noTrafficTravelTimeInSeconds": 10,
"historicTrafficTravelTimeInSeconds": 11,
"liveTrafficIncidentsTravelTimeInSeconds": 11,
"batteryConsumptionInkWh": 0.1,
"originalWaypointIndexAtEndOfLeg": 0,
"userDefinedPauseTimeInSeconds": 1020,
"entryPointIndexAtEndOfLeg": 0
},
"points": [
{
"latitude": 52.50931,
"longitude": 13.42937
},
{
"latitude": 52.50904,
"longitude": 13.42912
},
...further points...
],
"encodedPolyline": "evn_Iq|}pAt@p@",
"encodedPolylinePrecision": 5
},
...further legs...
],
"progress": [
{
"pointIndex": 0,
"travelTimeInSeconds": 0,
"distanceInMeters": 0,
"batteryConsumptionInkWh": 0
},
{
"pointIndex": 5,
"travelTimeInSeconds": 7,
"distanceInMeters": 74,
"batteryConsumptionInkWh": 0.002
},
...further progresses...
{
"pointIndex": 87,
"travelTimeInSeconds": 161,
"distanceInMeters": 1147,
"batteryConsumptionInkWh": 0.155
}
],
"sections": [
{
"startPointIndex": 0,
"endPointIndex": 3,
"sectionType": "TRAVEL_MODE"
"travelMode": "other"
},
{
"startPointIndex": 3,
"endPointIndex": 7,
"sectionType": "TRAVEL_MODE"
"travelMode": "car"
},
{
"startPointIndex": 2,
"endPointIndex": 3,
"sectionType": "TOLL",
"tollPaymentTypes": [
"CREDIT_CARD",
"DEBIT_CARD"
]
},
{
"startPointIndex": 4,
"endPointIndex": 5,
"sectionType": "TOLL",
"tollPaymentTypes": [
"ETC_TRANSPONDER"
]
},
{
"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
}
]
}
},
{
"startPointIndex": 0,
"endPointIndex": 3,
"sectionType": "IMPORTANT_ROAD_STRETCH",
"importantRoadStretchIndex": 0,
"streetName": {
"text": "Sample Street"
}
},
{
"startPointIndex": 5,
"endPointIndex": 6,
"sectionType": "IMPORTANT_ROAD_STRETCH",
"importantRoadStretchIndex": 0,
"streetName": {
"text": "Sample Street"
}
},
{
"startPointIndex": 6,
"endPointIndex": 7,
"sectionType": "IMPORTANT_ROAD_STRETCH",
"importantRoadStretchIndex": 2,
"streetName": {
"text": "Another Street"
},
"roadNumbers": [
{
"text": "A10"
},
{
"text": "E10"
}
]
},
{
"startPointIndex": 8,
"endPointIndex": 9,
"sectionType": "IMPORTANT_ROAD_STRETCH",
"importantRoadStretchIndex": 1,
"roadNumbers": [
{
"text": "A10"
}
]
},
...further sections...
]
}
...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. An example error response is shown below:

Error response example - JSON
{
"formatVersion": "0.0.12",
"detailedError": {
"code": "<error code>",
"message": "Error message"
}
}

Special behavior for content type JSONP

When contentType=jsonp is used, the returned HTTP status code is always OK (200). Reference: JSONP - JSON with Padding

  • This ensures that the jsonp callback is always invoked on the client side, regardless of the request outcome.
  • In order to provide the client with the actual status of the request, the response body includes a statusCode field.

Currently, the preceding statement is not true for certain types of errors described below.

  • For those errors, the HTTP status code (400, 500, …) is returned as usual, and the response content type is text/xml, regardless of the request’s content type.
  • For those errors, the content does not follow the documented format for error responses.
  • Note: This limitation should not cause issues during normal use of the API.

Structure of a successful response

Note: Some names are implicitly defined. For example, the name leg describing legs as an array of leg objects.

JSON fieldDescription

formatVersion
string

The format version.

routes
array of route objects

The request may return more than one route.
Each object has at least a summary field and a legs field. It may contain other fields depending on the request parameters.

summary
summary object

The summary of a route, or of a route leg.
The summary object may be extended with new fields in the future; clients should ignore fields they do not recognize.

routeReassessments
array of objects

  • Included if reassessmentParameterSets is specified.

  • Each object in the array corresponds to the entry with the same index in reassessmentParameterSets (see the POST data parameters) and contains the results of a reassessment using the corresponding reassessmentParameterSet.

  • The objects describe particular aspects of the route as a whole. Their values may differ from those reported in the route summary.

  • If the reassessmentParameterSet contains auxiliaryPowerInkW, then the corresponding object may contain the following fields (see individual field descriptions for details):

    • batteryConsumptionInkWh
    • reachableRouteOffsets
  • The objects in this array may be extended with new fields in the future; clients should ignore fields they do not recognize.

legs
array of leg objects

A description of a part of a route, comprised of an array of points.

  • Contains the summary field and may contain the points, encodedPolyline, and encodedPolylinePrecision fields.

  • Each additional waypoint provided in the request will result in an additional leg in the returned route.

points
array of objects

Each object in the array is a location on the surface of the globe defined by its latitude and longitude fields.
For more information on representing route geometry formats, see the Route geometry representation formats section.

encodedPolyline
string

A string in the encoded polyline format, representing the array of points describing a part of a route.
The precision used to encode the polyline is set in the encodedPolylinePrecision field. The precision reflects the selected coordinatePrecision, i.e., the precision is 5 with default, and 7 with full.
For more information on representing route geometry formats, see the Route geometry representation formats section.

encodedPolylinePrecision
integer

The precision used to encode the polyline in the encodedPolyline field.

sections
array of section objects

This array is available inside routeobjects.

  • Contains one or more section objects.

  • The structure of section objects is given below.

startPointIndex
number

Index of the first point (offset 0) in the route this section applies to (only included for a routeRepresentation polyline).

endPointIndex
number

Index of the last point (offset 0) in the route this section applies to (only included for a routeRepresentation polyline).

countryCode
string

A 3-character ISO 3166-1 alpha-3 country code.

simpleCategory
string

Type of the incident.

  • Can currently be JAM, ROAD_WORK, ROAD_CLOSURE, or OTHER.

  • See the tec field for detailed information.

effectiveSpeedInKmh
number

The effective speed of the incident in km/h, averaged over its entire length.

delayInSeconds
number

The delay in seconds caused by the incident.

magnitudeOfDelay
number

The magnitude of delay caused by the incident.
Possible values:

  • 0: unknown

  • 1: minor

  • 2: moderate

  • 3: major

  • 4: undefined, used for road closures and other indefinite delays

These values correspond to the values of the response field magnitudeOfDelay

tec
object

Details of the traffic event. It uses the definitions in the TPEG2-TEC standard. It can contain the effectCode and causes fields.
A selection of TPEG2-TEC causes can be found in the Terms and definitions of Safety related message sets.

effectCode
number

The effect on the traffic flow. Contains a value in the tec001:EffectCode table, as defined in the TPEG2-TEC standard. Can be used to color-code traffic events according to severity.

causes
array of objects

Each object in the array describes one cause of the traffic event.

  • It can contain mainCauseCode and subCauseCode fields.

  • It can be used to define iconography and descriptions.

mainCauseCode
number

The main cause of the traffic event. Contains a value in the tec002:CauseCode table, as defined in the TPEG2-TEC standard.
A selection of TPEG2-TEC causes can be found in the Terms and definitions of Safety related message sets.

subCauseCode
number

The sub-cause of the traffic event. Contains a value in the sub cause table defined by the mainCauseCode, as defined in the TPEG2-TEC standard.
A selection of TPEG2-TEC causes can be found in the Terms and definitions of Safety related message sets.

eventId string

A unique ID of the traffic incident.

lengthInMeters
number

The route or leg length in meters.

travelTimeInSeconds
number

The estimated travel time in seconds. Note that even when traffic=false, travelTimeInSeconds still includes the delay due to traffic.

trafficDelayInSeconds
number

The delay in seconds compared to free-flow conditions according to real-time traffic information.

trafficLengthInMeters
number

The portion of the route or leg, expressed in meters, that is affected by traffic events which cause the delay.

noTrafficTravelTimeInSeconds
number

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
number

The estimated travel time in seconds calculated using time-dependent historic traffic data. Included if requested using the computeTravelTimeFor parameter.

liveTrafficIncidentsTravelTimeInSeconds
number

The estimated travel time in seconds calculated using real-time speed data. Included if requested using the computeTravelTimeFor parameter.

deviationDistance
number

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.

  • If the route is identical to the reference route, then this field is set to the length of the route.

  • Included in all alternative (but not reference) route summary fields.

deviationTime
number

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.

  • If the route is identical to the reference route, then this field is set to the estimated travel time of the route.

  • Included in all alternative (but not reference) route summary fields.

deviationPoint
object

The coordinates of the first point following the origin point of the calculateRoute request where this route forks off from the reference route.

  • If the route is identical to the reference route, then this field is set to the coordinates of the last point on the route.

  • Included in all alternative (but not reference) route summary fields.

fuelConsumptionInLiters
number

The estimated fuel consumption in liters using the Combustion Consumption Model. Included if:

  • The vehicleEngineType is set to combustion.

  • The constantSpeedConsumptionInLitersPerHundredkm is specified.

  • The value will be non-negative (i.e., positive).

batteryConsumptionInkWh
number

The estimated electric energy consumption in kilowatt hours (kWh) using the Electric Consumption Model.

  • Included if:

    • vehicleEngineType is set to electric.

    • constantSpeedConsumptionInkWhPerHundredkm is specified.

  • The value of batteryConsumptionInkWh includes the recuperated electric energy and can therefore be negative (which indicates gaining energy).

  • If both maxChargeInkWh and currentChargeInkWh are specified, recuperation will be capped to ensure that the battery charge level never exceeds maxChargeInkWh.

  • If neither maxChargeInkWh nor currentChargeInkWh are specified, unconstrained recuperation is assumed in the consumption calculation.

reachableRouteOffsets
array of objects

This field is included if chargeMarginsInkWh is specified. It is not present in the leg summary field. Each object in the array corresponds to an entry in chargeMarginsInkWh, and describes the reachable point on the route with respect to the charge margin specified there. Effectively, the farthest the vehicle can go on the route on its current charge, without depleting the battery beyond the specified margin.

  • Objects in the array contain the following fields:

    • chargeMarginInkWh: the charge margin this reachable point is calculated for.

    • point: location of the reachable point defined as a latitude longitude pair.

    • pointIndex: largest index in the polyline of the route for which points[pointIndex] lies on or before point.

    • routeOffsetInMeters: the distance from the start of the route to the reachable point.

  • Note that:

    • If currentChargeInkWh is less than or equal to chargeMarginInkWh, routeOffsetInMeters is zero.

    • routeOffsetInMeters is at most lengthInMeters.

    • Charging stops are ignored in the computation so that e.g., live traffic is used as if driving past any charging station.

optimizedWaypoints
array of objects

A description of an optimized sequence of waypoints. It shows the index from the user-provided waypoint sequence for the original and optimized list. For instance, a response:

{
"optimizedWaypoints": [
{
"providedIndex": 0,
"optimizedIndex": 1
},
{
"providedIndex": 1,
"optimizedIndex": 2
},
{
"providedIndex": 2,
"optimizedIndex": 0
}
]
}

means that:

  • The original sequence is [0, 1, 2].

  • The optimized sequence is [1, 2, 0].

Since the index starts by 0 the original is “first, second, third”, while the optimized is “second, third, first”.

departureTime
string

The estimated departure time for the route or leg. Specified as a dateTime.

arrivalTime
string

The estimated arrival time for the route or leg. Specified as a dateTime.

effectiveSettings
array of objects

Each object in the array represents an effective parameter or a data used when calling the Calculate Route API. Each object has fields key and value both containing a string describing the input and its value.

statusCode
number

The original HTTP status code as listed in the response codes (note: included for content type jsonp only).

planningReason
string

The reason for a better route proposal. Can currently be:

  • Blockage in case the reference route contains road blockages. The returned value is implementation-defined in case both reasons for a better proposal are applicable to the same route.

  • Better_Proposal in case the alternative type is better than the reference route, according to the given planning criteria (set by routeType).

This field is included in the response only if the route is requested with alternativeType=betterRoute. This field is not present in the leg summary field.

progress
array of progress point objects

This field is included if extendedRouteRepresentation is used.

  • It always contains entries for the first and the last point in the route.

  • For any pair of consecutive entries in the progress array, progress for pointIndex values that are not explicitly present and are enclosed by said pair, can be linearly interpolated by summing up straight line distances of the leg points.

  • The Haversine formula is precise enough to compute such distances.

A progress point object may contain the following members:

  • pointIndex: index of the point (offset 0) in the route this object applies to.

  • distanceInMeters: distance (in meters) from the start of the route to this point. This field is included if the extendedRouteRepresentation value distance is used.

  • travelTimeInSeconds: travel time (in seconds) from the start of the route to this point. This field is included if the extendedRouteRepresentation value travelTime is used.

  • batteryConsumptionInkWh: electric energy consumption (in kilowatt hours) from the start of the route to this point. This field is included if the extendedRouteRepresentation value consumption is used and the vehicleEngineType is set to electric. See also the batteryConsumptionInkWh in summary section.

originalWaypointIndexAtEndOfLeg
number

The index of the waypoint at the end of the leg that corresponds to:

  • The index of this waypoint in the list of waypoints from the routePlanningLocations base path parameter in the request (the first waypoint has an index equal to 0).

  • The index of this waypoint in the pointWaypoints field when reconstructing a route.

This field is not provided if the end of the leg corresponds to the destination or to a new charging waypoint that is not present in the request.

userDefinedPauseTimeInSeconds
number

Contains the value of pauseTimeInSeconds, if it was specified for the corresponding leg. This field is not present in the route summary field.

entryPointIndexAtEndOfLeg
number

Identifies the entry point that was used for the route at the end of the leg.
This index corresponds to the position of this entry point in the list of entry points within the respective leg.
The first entry point has an index equal to 0. This field is only present if the leg had entryPoints in the request.

roadShieldAtlasReference
string

The base URL of the Road Shields service to fetch the road shield atlas and metadata resources.
Currently available resources are:

  • sprite.png
  • sprite.json

We recommend to cache the sprite atlas (sprite.png) and metadata (sprite.json) as it changes infrequently and is large compared to a typical road shield description.
Please refer to the Road Shield service for further information. The returned road shield references correspond to the asset names in the Road Shield service.

importantRoadStretchIndex
number

The integer value of importance. The index starts from 0, and a lower value means higher importance. The index is needed for two reasons:

  1. To understand which stretch is the most important (for example, if it is necessary to display a smaller number of stretches).
  2. To group different sections that belong to the same stretch (since there may be gaps in one stretch for various reasons).

streetName
object

An object contains a text field with the name of a street.

roadNumbers
array of objects

An array of objects of type RoadNumber. All items are sorted in descending order of display priority.
The RoadNumber object contains a text field with the road number.

Structure of the section object

Each section object provides additional information about a specific part of the route and includes, at a minimum, the startPointIndex, endPointIndex, and sectionType fields.

JSON fieldDescription

sectionType
string

Contains the response section type.

Request section typeResponse section type
carTrainCAR_TRAIN
countryCOUNTRY
ferryFERRY
motorwayMOTORWAY
pedestrianPEDESTRIAN
tollRoadTOLL_ROAD
tollTOLL
tollVignetteTOLL_VIGNETTE
trafficTRAFFIC
travelModeTRAVEL_MODE
tunnelTUNNEL
carpoolCARPOOL
urbanURBAN
unpavedUNPAVED
lowEmissionZoneLOW_EMISSION_ZONE
roadShieldsROAD_SHIELDS
speedLimitSPEED_LIMIT
importantRoadStretchIMPORTANT_ROAD_STRETCH
  • The COUNTRY sections span between country border crossings from the departure, or to the destination.

    • The section additionally contains countryCode.

    • If the route has disjointed parts in the same country, there will be several sections with the same countryCode.

    • If no country can be assigned to a part of the route, as for example in international waters, there may be no country section for this part.

  • When requested using includeTollPaymentTypes, a TOLL section optionally contains tollPaymentTypes.

  • A TOLL_VIGNETTE section additionally contains a countryCode since toll vignettes are often specific to a country.

  • A TRAFFIC section may additionally contain any of the following: simpleCategory, effectiveSpeedInKmh, delayInSeconds, magnitudeOfDelay, tec, eventId.

  • TRAVEL_MODE sections cover the whole route. Each section’s travel mode is reported in travelMode .

  • CARPOOL sections contain parts of the route that are only open to HOV (high-occupancy vehicles) at the time of traversal. Roads with at least one unrestricted lane are not part of a CARPOOL section.

  • ROAD_SHIELDS sections contain an array of roadShieldReference objects. Please refer to the structure of a road shield reference object for further information.

  • An IMPORTANT_ROAD_STRETCH section additionally contains the importantRoadStretchIndex field, and contains streetName or roadNumbers fields (or both).

travelMode
string

This field 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.

tollPaymentTypes
array of strings

The tollPaymentTypes array appears in toll sections if includeTollPaymentTypes=all. Each element of tollPaymentTypes represents a toll payment type. This field can only be used within sections of type TOLL.


Possible toll payment types are:

  • CASH_COINS_AND_BILLS: Cash can be used including coins and bills.

  • CASH_BILLS_ONLY: Cash can be used, but bills only, e.g., 10 euros.

  • CASH_COINS_ONLY: Cash can be used, but coins only, e.g., 20 cents.

  • CASH_EXACT_CHANGE: Cash is used but the exact amount must be provided.

  • CREDIT_CARD: Credit cards are accepted.

  • DEBIT_CARD: Bank/debit cards are accepted.

  • TRAVEL_CARD: Travel cards are accepted.

  • ETC: Electronic toll collect either via camera or transponder.

  • ETC_TRANSPONDER: Electronic toll collect via transponder.

  • ETC_VIDEO_CAMERA: Electronic toll collect via camera.

  • SUBSCRIPTION: Toll collect based on subscription.

Structure of an error response

JSON fieldDescription

detailedError
object

This object provides a representation of the error message. It contains a code and a message field.

JSON field

Description

code
string

The (non-complete) list of error codes is:

Error code

Description
MAP_MATCHING_FAILURE

One of the input points (Origin, Destination, Waypoints) could not be matched to the map because there is no known drivable section near this point. This error code is always followed by a description of one point that was not matchable:

  • Origin (Latitude, Longitude)
  • Destination (Latitude, Longitude)
  • Waypoint N (Latitude, Longitude)
NO_ROUTE_FOUND

No valid route could be found.

NO_RANGE_FOUND

No valid reachable range could be found.

CANNOT_RESTORE_BASEROUTE

The route reconstruction using supportingPoints failed.

BAD_INPUT

Some input parameter combination was not valid.

COMPUTE_TIME_LIMIT_EXCEEDED

The request exceeded the internal compute time limit and was canceled.

message
string

A human-readable error message.

  • It is a freeform string which may be extended in the future, so it is recommended to only match substrings of the description.

  • The string always contains an error code.

Example of a description string:

Engine error while executing route request: MAP_MATCHING_FAILURE: Origin (54.3226, 3.11463)

Engine error while executing route request: MAP_MATCHING_FAILURE: Origin (54.3226, 3.11463)

Engine error while executing route request: MAP_MATCHING_FAILURE: Waypoint 3 (54.3226, 3.11463)

statusCode
number

The original HTTP status code as listed in response codes (included for content type jsonp only).

Structure of a road shield reference object

JSON field

Description

roadShieldReference
object

This object describes a single road shield reference. It contains the following fields:

reference
string

A unique identifier for the road shield.

shieldContent
string

An optional string to be shown on the road shield.

affixes
array of strings

An optional list of possible affixes that can be shown in addition to the shieldContent.

Route geometry representation formats

Certain request and response fields that describe route geometry using a polyline support two alternative representation formats:

  • An array of points defined as raw decimal coordinates, such as the supportingPoints field in requests and the points field in responses.
  • An encoded polyline string, such as the encodedPolyline field in both requests and responses.

Where documented, either of the two representations can be used. This is purely a representational choice and is independent of any other statements about route geometry. The field containing the array of points is used as a stand-in for the concern of route geometry. For brevity, any references and constraints related to the polyline are stated using the stand-in only.

Using encoded polylines can significantly reduce the data size of requests and responses.

Encoded polyline format

For efficient representation of polylines as encoded polyline strings, this service uses an extended version of the Encoded Polyline Algorithm Format.
The original algorithm limits coordinate precision to 5 decimal places by using a multiplier of 1e5 for the decimal values. The extension allows using multipliers of both 1e5 and 1e7. These multipliers correspond to precisions of 5 and 7 decimal places. Please note that each field in the encoded polyline format may have limitations on its supported precisions.
Since the encoded polyline string doesn’t contain information of the precision or multiplier used, this information must be provided separately alongside each encoded polyline string.
We recommend taking special care when using the higher precision, as some encoding implementations may suffer internal overflows with the higher multiplier.

Encoding

When encoding a polyline, select a supported precision and use the respective multiplier for the decimal value instead of the fixed 1e5 multiplier in the original algorithm (refer to the following table).
Otherwise, the encoding process remains the same as in the original algorithm. Ensure to send the precision used alongside each encoded polyline string in the request.

Decoding

When decoding a received polyline, use the provided precision next to the encoded polyline string to determine the appropriate multiplier for the decimal value instead of the fixed 1e5 multiplier in the original algorithm (refer to the following table). Otherwise, the decoding process remains the same as in the original algorithm. Note that each encoded polyline string is accompanied by the precision used for its encoding.

Precisions and multipliers

The following table illustrates the relationship between precision and multiplier:

Precision

Multiplier

51e5
71e7