Toll Cost calculation available via HERE Routing v8
Last month, we released a lot of exciting new features to the HERE platform, including released HERE Raster Tile API v3, HERE Style Editor v1.1, and HERE Traffic Vector Tile API; integration HERE Raster Tile API into Maps API for Javascript; lots of updates to the HERE Routing API and more. For complete information, see February 2023 platform release notes. In this blog, we will discuss the Toll Cost calculation service that is now accessible via the HERE Routing V8 endpoint.
HERE Toll Cost calculates the toll costs for a given route taking into account various vehicle profiles or calculates the cost-optimized route based on toll and vehicle costs. You can get toll cost information by including tolls
in the return
parameter. This information is available for the following transport modes: car, truck, taxi, and bus. Each section of the route will contain a list of applicable tolls, with their names, payment methods, prices in local currencies, and, if applicable, converted prices in the requested currency. The granularity of the toll costs can span from the entire route (in case of vignette) to individual road segments (in case of pay-per-km truck tolls).
Sample Application
Below is a sample application showing the truck routes with the truck-related tolls cost and road restrictions highlighted on the map. This sample is built using HERE Maps API for Javascript and modified from the Map with the truck routes and road restrictions sample. The source code for this sample application can be found in our HERE Github repo.
Request Parameters
To get toll cost information we need to include tolls
in the return
parameter. Below is the sample request parameter used in the sample above showing the truck route from Manhattan to Newport with various truck-specific routing parameters.
var routeRequestParams = {
routingMode: 'fast',
transportMode: 'truck',
origin: '40.7249546323,-74.0110042', // Manhattan
destination: '40.7324386599,-74.0341396', // Newport
return: 'polyline,travelSummary,tolls',
units: 'imperial',
spans: 'truckAttributes'
},
function calculateRoutes(platform) {
var router = platform.getRoutingService(null, 8);
// The green route showing a truck route with a trailer
calculateRoute(router, Object.assign(routeRequestParams, {
'truck[axleCount]': 4,
}), {
strokeColor: 'rgba(25, 150, 10, 0.7)',
lineWidth: 10
});
// The violet route showing a truck route with a trailer
calculateRoute(router, Object.assign(routeRequestParams, {
'truck[axleCount]': 5,
'truck[shippedHazardousGoods]': 'flammable'
}.), {
strokeColor: 'rgba(255, 0, 255, 0.7)',
lineWidth: 5
});
}
Tolls Response Formats
Below is the sample response of the route section that has toll cost information.
{
"notices": [...],
"routes": [{
"id": "4143a696-a7b0-41fd-a200-51e6b71cd253",
"sections": [{
"id": "b0bb4fae-e057-41a2-b79f-685f0155963d",
....
"tolls": [{
"countryCode": "USA",
"tollSystemRef": 0,
"tollSystem": "VERRAZANO-NARROWS BRIDGE",
"fares": [{
"id": "ab527b2c-b077-4aef-9d7d-4a2c51c2e475",
"name": "VERRAZANO-NARROWS BRIDGE",
"price": {
"type": "value",
"currency": "USD",
"value": 32.33
},
"reason": "toll",
"paymentMethods": ["transponder"]
}, {
"id": "574cddf2-92da-44d9-9b49-dd84fcd85278",
"name": "VERRAZANO-NARROWS BRIDGE",
"price": {
"type": "value",
"currency": "USD",
"value": 55.05
},
"reason": "toll",
"paymentMethods": ["videoToll"]
}],
"tollCollectionLocations": [{
"name": "New York",
"location": {
"lat": 40.60219,
"lng": -74.06288
}
}]
}, {
"countryCode": "USA",
"tollSystemRef": 2,
"tollSystem": "NEW JERSEY TURNPIKE",
"fares": [{
"id": "15ea6429-72f8-4533-9358-bf6683b32410",
"name": "NEW JERSEY TURNPIKE",
"price": {
"type": "value",
"currency": "USD",
"value": 5.97
},
"reason": "toll",
"paymentMethods": ["transponder"]
}, {
"id": "b854e324-3d74-4ea0-b073-7acba064d0f0",
"name": "NEW JERSEY TURNPIKE",
"price": {
"type": "value",
"currency": "USD",
"value": 6.85
},
"reason": "toll",
"paymentMethods": ["cash"]
}],
"tollCollectionLocations": [{
"name": "Jersey City",
"location": {
"lat": 40.68404,
"lng": -74.0978
}
}, {
"name": "Jersey City",
"location": {
"lat": 40.70615,
"lng": -74.06198
}
}]
}],
"tollSystems": [{
"id": 175,
"name": "VERRAZANO-NARROWS BRIDGE",
"languageCode": "ENG"
}, {
"id": 161,
"name": "BAYONNE BRIDGE",
"languageCode": "ENG"
}, {
"id": 131,
"name": "NEW JERSEY TURNPIKE",
"languageCode": "ENG"
}]
}]
}]
}
Conclusion
The Toll Cost calculation service has now been moved to HERE Routing v8 and is now accessible via the HERE Routing v8 endpoint. HERE Toll Cost calculates the toll costs for a given route taking into account various vehicle profiles or calculates the cost-optimized route based on toll and vehicle costs.
Resources
- February 2023 platform release notes
- HERE Routing API v8 - Get toll cost information for route tutorial
- HERE Maps API for Javascript
- Map with the truck routes and road restrictions sample
Have your say
Sign up for our newsletter
Why sign up:
- Latest offers and discounts
- Tailored content delivered weekly
- Exclusive events
- One click to unsubscribe