Don’t get trolled by tolls: Avoid common polyline endpoint pitfalls

Maneesh Mahlawat
TollGuru
Published in
5 min readAug 28, 2023

--

Picture this: Alex, a trucking product owner, is scrambling to figure out why toll estimations on his quote system have gone haywire. Across town, David, a car-share startup CTO, is scratching his head over discrepancies in toll reimbursements that are costing his customers some serious cash. It’s like a plot from a suspense thriller, except the villain isn’t an elusive hacker or a software bug — it’s something far more benign but equally menacing: inaccurate polyline.

Welcome to the untamed jungle of toll calculations, where a simple line can make or break your budget and business. And let’s be honest, in a realm where pennies make the world go ‘round, the adage “garbage in, garbage out” never rang so true.

Buckle up, because this blog post is going to be your GPS through the polyline pitfalls that could be quietly sabotaging your toll estimations. 🚗💨

Issue 1: Including extra road layers

Sometimes input polylines (or paths) include additional road layers along with the actual travel path. This can occur when “map match” to the GPS track picks up surrounding road layers (just in case nothing is missing). While this may seem innocuous, the extra road layers can include toll locations. Depending on the type of toll system — open or closed — this can lead to inaccurate calculations.

  • Open toll system: Response may show higher tolls than actually incurred for the trip
  • Closed toll system: Closed toll system: Without reliable entry and exit points, tolls are theoretically unknown (discussed later). For example, if both the mainline and ramp entry locations are picked when only one of them should be picked up, it is not possible to accurately calculate the toll amount.
The vehicle travels south on Dallas North Tollway (DNT). However, the input polyline (path) provided includes information for the surrounding road layer including ramps. While the vehicle didn’t travel on a ramp, the total toll includes ramp tolls (since ramps are included in the input polyline).

The Impact

The toll calculations are wrong. If used for driver reimbursements, this can lead to an inaccurate reimbursement leading to manual interventions to fix toll calculations. Similarly, it can lead to charging wrong tolls to shippers, leading to mismatch in toll amounts from TollGuru API with agency bills.

Issue 2: Ignoring the road layer and directly connecting two points

Sometimes input polylines ignore the road layer. Instead of including the complete travel path, two distant points on the travel path are connected by a straight line, completely ignoring the actual road layer. Vehicles travel on the path along the toll road and if the road layer is not provided, toll calculations can be wrong.

As seen in Map 1, points 1 and 2 are connected by a straight line. In Map 2, the actual travel path is shown in Green color (while straight line is shown in Orange). Since Map 1 polyline in Orange doesn’t include the path on the toll road, it skips the George Washington Bridge included in the polyline shown in green color

The Impact

Connecting two points directly without including a road layer can result in missed tolls along the actual travel path, which can severely impact the overall toll calculation and route optimization. Also, it may include extra tolls if the straight line passes through toll locations.

Issue 3: Polylines start or end within closed systems

Sometimes the polylines begin and / or end completely within a closed system. As a result, the entry or exit for a vehicle on closed toll systems is not known.

In a closed system, we need to know both the entry and exit toll plaza to calculate the combination rates. Think of this like a metro system. The toll plazas are like metro stations. We can only get on the train at the station by walking / driving to the station. Trying to find accurate fare for a rider whose entry or exit metro station is not known is not possible. Similarly for closed systems, if either of the entry or exit plaza is not known, tolls cannot be accurately calculated.

You can see a simple closed system in the following figure. While traveling eastbound, you can get on the closed system at either Mainline Toll Plaza 1 or Ramp Toll Plaza 3 and get off on Mainline Toll Plaza 4 or Ramp Toll Plaza 2. Mainline toll plazas 1 and 4 are the start and end of this simple closed system.

Tolls are not calculated accurately when the polyline starts after the user is already on the ticket system (entry unknown error)

Say the polyline begins west of Plaza 4 and ends east of Plaza 4: the vehicle could have entered the system at either Mainline Plaza 1 or Ramp Plaza 3. Without knowing the exact combination (entry 1 and exit 4 or entry 3 and exit 4), tolls cannot be accurately calculated.

The Impact

This creates a significant issue, as without knowing the exact entry and/or exit points, it’s impossible to calculate the correct toll fees.

Issue 4: Some other common issues

Here is a summary checklist highlighted issues discussed earlier with polylines and some other issues with other input parameters

  • Polyline
    — No extra road layer
    — Not a lossy polyline
    — Complete polyline without missing any edges / links
    — Complete travel path on closed systems
    — Latitude and longitude order should not be reversed
  • Accurate vehicle type
    — If providing, vehicle parameters provide units along with dimensions such as height, weight
  • No duplicate timestamps in locTimes array
    — Check speeds for timestamps you provide. Speeds should not be unrealistic

Conclusion

Accurate toll calculations hinge on the quality of input polylines and other parameters such as timestamps and vehicle information. Issues like including extra road layers, ignoring the road layer altogether, or providing incomplete polylines can introduce inaccuracies in toll estimates. Awareness of these common pitfalls will ensure more accurate, cost-effective toll information and route optimization.

Want to learn more? 🔗 Dive into our Toll API docs to unlock the power of Toll API and elevate your product.

Need to see it in action first? We’re here to guide you. Schedule a live demo with our team at api@tollguru.com.

--

--

Maneesh Mahlawat
TollGuru

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