Debugging Route Polyline – TollGuru Polyline to Toll API

TollGuru Polyline to Toll API allows fleets, logistic companies, ride-shares, and car rentals to calculate tolls from GPS traces and mapping route polylines. Customers can upload route polyline (created using Google algorithm) and receive tolls for the route. However, when you use Polyline to Toll API, tolls may not be accurately calculated. The article details reasons and what to do when you receive wrong tolls for polylines.

What can you do to receive tolls for the route?

Route Polyline to Toll API errors occur when GPS traces are converted into a route polyline without first carrying out map matching. Map matching converts GPS traces into coordinates that correspond to a map such as GoogleBingMapBoxApple MapHERETomTom, and Waze.

Why do the GPS traces need to be matched to a map?

There are several reasons, chief among them being:

  • GPS traces can be pretty sparse (say the fleet GPS reading is every three minutes).
  • GPS traces can have measurement errors. The US government commits to broadcasting the GPS signal in space with a global average user range error (URE) of ≤25.6 ft. with 95% probability. These measurement errors are sometimes wider than the width of the road. As a result you can see GPS traces everywhere including opposite side of the road.
  • Urban canyons. If you are in a dense part of the city where satellite signals are blocked by high-rise buildings, the GPS location in your smartphone is super inaccurate.
Image for post
Urban Canyon in Downtown Pittsburgh, PA © Jon Dawson
  • Tunnels and dense foliage: Tunnels, large buildings (urban canyons), or areas thick with trees and brush can also block signals from satellites.

Let us consider GPS traces for a a vehicle traveling from south of Salt Lake City, Utah to New Brunswick, NJ. The vehicle gets on Kansas Turnpike east of Topeka, KS, exiting Kansas Turnpike east of Kansas City at Eastern Terminal toll plaza. Later the vehicle gets on Penn Turnpike at New Stanton toll plaza and gets off at New Jersey turnpike exit on to the New Jersey turnpike.

Image for post
Vehicle GPS trace from south of Salt Lake City, Utah to New Brunswick, NJ. The vehicle travels on the Kansas Turnpike, Penn Turnpike and NJ Turnpike.

However, when you zoom onto the map at New Stanton toll plaza you see that the GPS traces (constructed by connecting GPS track points in Red marked as 1, 2 and 3) in blue line miss the toll plaza marked as black dot north of the GPS traces.

Image for post
GPS traces (constructed by connecting GPS track points in Red marked as 1, 2 and 3) in blue line miss the toll plaza (marked as black dot north of the GPS traces)

As you will see in the image below, the vehicle traveled along I-70 leaving at Exit 58 onto Penn Turnpike (I-76) entering at New Stanton ramp toll plaza and continuing east along Penn Turnpike (the route shown in Blue).

Image for post
Blue route shows the vehicle travel path while points 1 and 2 show points recorded by the GPS device

TollGuru GPS traces to Toll API first creates route polyline (in Blue) from GPS traces (in Black). Since the Blue line is drawn near the Stanton Toll plaza (black dot), TollGuru GPS traces to Toll API calculates tolls for the route.

Image for post
Route polyline shown as blue linestring is constructed from GPS points shown in Red

Toll API Solution

If you were to use GPS traces to Toll API instead of the Polyline to Toll API when you have GPS traces, you will receive accurate tolls. You can upload GPS tracks to the GPS traces to Toll API as csv , kml, gpx or nmea file.

curl --request POST -H “x-api-key:Your-key” -- data-binary “@/path/to/file/xx.csv”https://dev.tollguru.com/beta00/calc/route/upload?vehicleType=5AxlesTruck&vehicleName=myTruck&height=vehicleHeight&weight=vehicleWeight

The tolls are returned based on payment types such as transponders (e.g. E-ZPass, TxTag, etc.), cash, license plate toll (Pay by Mail, Pay by Plate etc.), Prepaid card (e.g. Nexpress, Nexus Card, etc.) and credit card in the specific currency. For example, tolls in United States are returned in dollars, Mexico in Mexican Peso, etc by default. 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.

Please get in touch with us at api@tollguru.com if you’d like to schedule a demo or to integrate GPS traces to Toll API in your product. You can upload CSV files with several hundreds thousands GPS traces and receive tolls in a few seconds

About TollGuru

TollGuru, a product of MapUp Inc., calculates tolls for all toll roads, bridges, and tunnels in the United States, Canada, Mexico and India for all vehicle types. TollGuru provides smart toll exchange and navigation platform.

TollGuru mapping service is designed for real America — where both costs and times figure in route decisions. TollGuru shows the cheaper routes not shown by any other mapping applications such as Google maps, Apple maps, Waze, HERE maps, MapQuest, Scout GPS, Garmin, etc. Unlike other mapping applications, our routes consider two vectors — travel time and travel cost (fuel and tolls) to provide a real-time decision platform.

Say you have to dispatch a 5-axle semi from Englewood, NJ to Scarsdale, NY in upstate New York. Navigation softwares would show you three routes, most likely, all going over the George Washington Bridge (GWB) ($90 one-way toll with E-ZPass NY).

Image for post
The Fastest route costs $62 more for 5-axle semi while it saves 4 minutes. Based on traffic conditions and time of travel, the travel time savings and cost savings differ

TollGuru would show the cheapest route over Tappan Zee/ Cuomo Bridge, the fastest route over GWB and some other logical routes. If you drive on the cheapest route (over Tappan Zee), you would take about 4 minutes more (than driving over GWB) but save $62 (if paying with NY E-ZPass). Since the cheapest route does not figure in the top five fastest routes, it is never shown as an option by any other mapping app. Use TollGuru trip calculators (on the web, Android or iPhone) or integrate TollGuru API and save $62 in an hour long trip!

Leave a Comment

Your email address will not be published. Required fields are marked *