Calculating Toll for a Route

This article explains how to calculate the toll price of a routeClosed A route corresponds to a path of a vehicle through the underlying transport network. The main attributes of a route are the distance and the time that the vehicle travels along the path..

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.