Calculating Toll for a Route
This article explains how to calculate the toll price of a route.
Benefits
- Obtain a precise price for the toll to be paid for a given route and for each leg of the route.
- If detailed toll data is available each single price to be paid with detailed meta information can be returned.
- If forecast data is available planned prices for the future can be calculated.
Prerequisites
- A PTV map containing toll data.
- The example below requires a map with toll data for the Newport Bridge in Rhode Island, USA.
- A valid license for the key
toll
.
Configuration
The sections result field is set automatically. The general toll result field to retrieve at least the summary is always set to true.
Programming Guide
Here is an example for the calculation of toll. The function determineTollDetails
sends a request to dataInformation
and extracts the following information:
- The toll detail level: If the map contains at least some detailed toll data, then some toll cost result fields are set to true.
- The list of available electronic toll collection subscriptions: It is slightly modified and then passed to the route request.
Related Topics
The following topics might be relevant for this use case.
- Integration Samples
- Displaying toll roads - only available with detailed toll data
- Vehicle Parametrization - toll prices highly depend on the vehicle parameters
- Calculating a Route
- Technical Concepts
- Toll
- Route Selection - explains the tollPenalty to avoid or prefer toll roads
- Time Consideration - toll prices often are time-dependent
- Profiles
- Showcases