How to find toll for any route — Map Independent Toll API

TollGuru now allows individuals and businesses to estimate toll costs for routes from any mapping provider

Maneesh Mahlawat
TollGuru

--

TollGuru released Map Independent Toll API that allows trucking fleets, logistic companies, ride-shares, car rentals, and everyone else to calculate tolls for routes from a mapping provider of their choice. The companies can upload a route shape or encoded route polyline from mapping providers such as Google, Bing, MapBox, Apple Map, HERE, TomTom, Waze, ESRI, Baidu, Gaode and receive toll information specific to the departure time, payment type, vehicle type and vehicle characteristics such as axle count, height and weight.

The companies can also upload a complete route polyline from their custom mapping solutions such as those created using Open Source Routing Machine or GraphHopper Direction Map API. They can also receive tolls for their custom routing solution created using R tree, network graph, A* or any shortest path algorithm, map data from OSM or any other datasources such as ArcGIS.

Why is it hard to calculate tolls for a route polyline from any mapping service

TollGuru developed a data abstraction model that works with each specific implementation of routing by different mapping providers. This allowed us to implement map independent or map-agnostic toll calculation algorithms.

To elucidate how different mapping platforms create polyline for the same road in a slightly different manner, let’s consider New Rochelle Toll Plaza on the New York Thruway. As shown in the image below, the toll plaza (now rebuilt and moved further north) had 14 lanes to collect tolls in northbound direction:

New Rochelle Toll Barrier Historical Imagery from Google Earth
New Rochelle toll barrier — Historical Imagery from Google Earth (The plaza has since been rebuilt)

One way to represent all toll locations would be to create 14 links (node pairs) corresponding to the 14 northbound lanes to represent the fact that vehicles need to pay a toll at each plaza based on their vehicle type and time of travel. As shown in the image below, OSM volunteers chose to create 14 links (way) at this location. A route polyline in northbound direction would include a link from the 14 links. The northbound lanes are shown under the elongated brown oval in the image below.

OSM representation of New Rochelle toll barrier. 14 toll gantries are shown as 14 ways

Other mapping service providers such as Google, HERE, Bing, TomTom represent the northbound road in a different manner. These mapping services chose to code one or two links instead of 14 links. The northbound lanes are shown under the brown oval shape in following images:

Google Map (left) and HERE map (right) representation of the northbound lanes. Unlike OpenStreetMap, Google and HERE used one link (polyline) to represent 14 toll toll plazas and lanes
TomTom (left) and MapQuest (right) representation of the northbound lanes. Unlike OSM, TomTom and MapQuest use two links (polyline) to represent 14 toll toll plazas
Bing (left) and Waze (right) representation of the northbound lanes. Unlike TomTom, MapQuest and Bing that use two links, Waze, Google, HERE use one link (polyline) to represent 14 toll toll plazas
Apple Maps(left), Yandex (middle), wikimapia (right) representation of the northbound lanes. Like Waze, Google, HERE maps, Apple maps, Yandex and wikimapia use 1 link (polyline) to represent 14 toll toll plazas

Each of the mapping services have a different conceptual data models of the physical world. For example, in OpenStreetMap each feature is one or more geometries with attached attribute data. Since each mapping service uses its own conceptual model to create online maps, it differs from other maps.

As shown in image below, Google, HERE and OSM routing API provide different polyline for the same road. The polyline from HERE map is shown in purple color and is east of polylines from Google (shown in blue color) and OSM (shown in green color).

Polylines from HERE map Route API, Google Map Direction API and OSM. TollGuru Toll API calculates toll information for each of the mapping platforms

TollGuru API Solution

TollGuru REST API has developed a conceptual model for its proprietary algorithms to work with each of the mapping platforms described earlier. The Toll API endpoint to receive polyline from any mapping service is:

https://apis.tollguru.com/toll/v2/complete-polyline-from-mapping-service

The tolls are returned for payment types such as transponders (e.g. E-ZPass, TxTag, etc.), cash, license plate toll (Pay by Mail, Pay by Plate etc.), and Prepaid card (e.g. Nexpress, Nexus Card, etc.) in the specific currency. For example, tolls in United States are returned in dollars, Mexico in Mexican Peso, etc by default. The toll response includes the following

{
"summary": { ...
},
"departure_time": 1551541566
},
"route": {
"hasTolls": true,
"costs": {
"fuel": 4.31,
"otherCost": 10,
"tag": 2.46,
"cash": false,
"licensePlate": 3.69,
"creditCard": false,
"prepaidCard": 2.46
},
"tolls": [
{
"id": 131030,
"lat": 33.00225,
"lng": -96.77585,
"name": "Coit Main Lane Gantry (MLP7)",
"road": "President George Bush Tpke",
"state": "Texas",
"type": "barrier",
"tagCost": 1.34,
"tagPriCost": 1.34,
"tagSecCost": false,
"cashCost": false,
"licensePlateCost": 2.01,
"prepaidCardCost": 1.34,
"creditCardCost": false,
"currency": "USD",
"tagPrimary": [
"TxTAG",
"TollTag",
"EZ TAG",
"K-Tag"
],
"tagSecondary": [],
"licensePlatePrimary": "ZipCash",
"licensePlateSecondary": false,
"discountCarDetails": false,
"discountCarType": false,
"discountTruckDetails": false,
"discountTrucks": false,
"height": "No"
}
]
}
}

The tolls are specific to vehicle specified. If the vehicle travels on a toll road (such as Pennsylvania turnpike) where the tolls depend on axles and vehicle weight, tolls are returned for the specific weight. The following image shows some of the attributes about toll information.

Please get in touch with us at api@tollguru.com if you’d like to schedule a demo or to integrate TollGuru Map Independent Toll API in your product.

About TollGuru

TollGuru, a product of MapUp Inc., calculates tolls for all toll roads, bridges, and tunnels in 80+ countries across the globe: North America — USA, Canada, Mexico; Europe — UK, France, Spain, Portugal, Ireland, Netherlands, Denmark, Norway, Sweden, Italy, Germany; Latin America — Peru, Colombia, Argentina, Chile; India and Australia.

TollGuru mapping service is designed for real world — where both costs and times figure in route decisions. Unlike other mapping services, our routes consider two vectors — travel time and travel cost (fuel and tolls) to provide a real-time decision platform.

--

--

Maneesh Mahlawat
TollGuru

Mapping geek. On a mission to transform maps into human decision making platform