Vehicle properties
Vehicle properties are a group of parameters that allow you to give the Routing API more information about the physical properties of the vehicle you're calculating the route for, as well as its cargo or the vehicle's legal status.
Adding vehicle properties to a route calculation request allows the API to consider more restrictions on the calculated route and ensure that the route violates the least restrictions possible (ideally none).
The most common use case for vehicle properties is route calculation for cargo vehicles such as trucks or vans. Defining the vehicle properties allows the API to calculate routes that don't go through roads for which the vehicle is too heavy, avoid tunnels for which it's too tall, or roads for which it's too wide.
Vehicle properties can also be used for non-commercial applications. Defining vehicle height helps vehicles with roof racks avoid low tunnels or bridges, while defining the number of occupants allows the API to calculate routes using HOV (high-occupancy vehicle) lanes.
Usage
To add vehicle properties to your request, use the parameters from the vehicle[PROPERTY_NAME] group.
Every property you add to the request is a separate parameter.
Example properties include:
vehicle[height]vehicle[width]vehicle[length]vehicle[tiresCount]vehicle[weightPerAxle]
Note
The list of available properties is subject to regular updates. For all currently available properties, see the API Reference.
Example: vehicle height
The following request calculates a route for a car that is 2.7 m high, which is specified by using the vehicle[height]=270 parameter.
The API returns a critical notice warning about a restriction violation as the destination of this route is in a height-restricted area.
Violating restrictions can't be avoided when restrictions apply on a waypoint.
There are no other violations on the route, as the API calculates a route around them.
Request
curl -gX GET 'https://router.hereapi.com/v8/routes?'\
'origin=40.90429,9.100922&'\
'destination=40.9041583,9.1014598&'\
'return=polyline&'\
'spans=notices&'\
'transportMode=car&'\
'vehicle[height]=270&'\
'apiKey=YOUR_API_KEY'Response
{
...,
"polyline": "BGmmzguC2nvrRpGuFU8GA4I9CqM",
"spans": [
{
"offset": 0,
"length": 13
},
{
"offset": 1,
"length": 38,
"notices": [
0
]
}
],
"notices": [
{
"title": "Violated vehicle restriction.",
"code": "violatedVehicleRestriction",
"severity": "critical",
"details": [
{
"type": "restriction",
"cause": "Route violates vehicle restriction",
"maxHeight": 250
}
]
}
]
}Example: towing a trailer
The vehicle[trailerCount]=1 option indicates that the vehicle is towing a trailer.
Adding this option to the request allows the API to calculate a route that avoids roads where towing trailers is not allowed.
Note
When a vehicle tows trailers, most vehicle parameters should take values reflecting the vehicle and trailer combination. This means that
vehicle[currentWeight],vehicle[grossWeight],vehicle[length], and other similar parameters should also include the weight and dimensions of the trailer.The Routing API currently ignores speed limits that apply specifically to cars with trailers.
The following requests show how the calculated route changes depending on whether the vehicle is towing a trailer or not. Note that the weight and length properties change to reflect the presence of the trailer.
Route with a trailer
curl -gX GET 'https://router.hereapi.com/v8/routes?'\
'origin=41.8669074,14.0680527&'\
'destination=41.8733632,14.0690313&'\
'return=polyline,summary&'\
'transportMode=car&'\
'vehicle[currentWeight]=3500&'\
'vehicle[length]=700&'\
'vehicle[trailerCount]=1&'\
'apiKey=YOUR_API_KEY'
Route with no trailer
curl -gX GET 'https://router.hereapi.com/v8/routes?'\
'origin=41.8669074,14.0680527&'\
'destination=41.8733632,14.0690313&'\
'return=polyline,summary&'\
'transportMode=car&'\
'vehicle[currentWeight]=2000&'\
'vehicle[length]=400&'\
'vehicle[trailerCount]=0&'\
'apiKey=YOUR_API_KEY'
Impact on route calculation
With vehicle properties specified, the API might not be able to calculate a route that doesn't violate restrictions.
In such situations, the calculated route contains critical severity notices.
In certain situations, such as specific combinations of vehicle parameters and regional regulations, the routing algorithm might abandon route calculation due to how difficult and time-consuming it is to work around violations and find a legal route.
Related content
Updated 9 days ago