Calculated toll distance greater than total distance

This forum deals with any kind of routing computation whether it is simple A:B-routing, calculation of isochrones, simple matrix computation or nearest search.
Post Reply
Pete
Posts: 4
Joined: Mon Jan 25, 2021 11:50 am

Calculated toll distance greater than total distance

Post by Pete »

When calculating a route just inside of Germany (to keep things simple) we need to know the total toll distance for the route.

We do this by look at the "toll.sections" collection and add up the "officialDistance" property for all sections.

Over time we noticed that the sum of the toll.sections can be greater the "distance" property of the response which should be the total distance of the route.

Looking at the toll sections in detail, we noticed sometimes sections appear twice, which obviously screws up the result. But even after filtering out duplicates we still have cases where the sum of the officialDistances are greater than the total distance of the route.

Are we doing something wrong here, is there a different (better) way to get the total toll distance?

Or is this a known problem?
Peter Hahndorf
Senior Software Engineer
indiwa digitale kommunikation GmbH
Maximilian Vogel
Posts: 11
Joined: Fri Dec 29, 2017 9:00 am

Re: Calculated toll distance greater than total distance

Post by Maximilian Vogel »

The officialDistance is not available for every toll system as not every toll operator provides this information. In Germany, this information is provided by the government and they even describe how they determine their section lengths: https://www.balm.bund.de/DE/Themen/Lkw- ... _node.html

I can think of a few reasons why the official distances and the total distance of the route may differ, for example the measured distance while driving versus the calculated distance from polyline coordinates (even within the latter there can be differences due to different methods and projections).

I would be very interested in requests where a section appears twice. Those would be bugs in our toll data and of course we want to fix them. There is an explanation why a section can appear twice, that is when there is a waypoint in between where you leave the toll road.
doubled_section.png
If a section is only partially driven (very hard to find an example where this actually could happen), then it also makes sense that the reported distance is less than the toll distance.
partially_driven_section.png
But I guess you are referring to routes that span several hundreds of kilometers through Germany. I assume that there are some systematic errors where our distance might be slightly lower than the actual distance whereas the official distance might be a bit greater than it actually is. I don't think you're doing something wrong and yes, there is a different way to get the total toll distance. You can request the toll events. At each event there is a distanceFromStart returned. So you calculate the difference exitTollEvent.distanceFromStart - enterTollEvent.distanceFromStart and add this up for each pair of enter and exit toll events.
toll_events.png
This should work quite well with most toll systems. However, there are also toll events of type "PASS". There it is very difficult to get a good approximation of the toll distance if no official distance is available. At waypoints there is not necessarily an exit toll event, so if you want the toll distance per leg with this approach, you probably want the waypoint events too, so that you can split the distance accordingly.

There are plans to extend the xRoute 2 API to include the toll distance, however I don't know if it will make it to the next release 2.29 or later. So this is a good opportunity to make some wishes for the API. ;)
Maximilian Vogel
Developer
PTV Logistics
Pete
Posts: 4
Joined: Mon Jan 25, 2021 11:50 am

Re: Calculated toll distance greater than total distance

Post by Pete »

Here is an example of a case where we had duplicate toll secions:

DE-21129 Hamburg, Am Ballinkai 1 - N 53.5085 E 9.9284

to

DE-91275 Auerbach - N 49.6949 E 11.6191

we had 114 toll sections, with two duplicates:

Trockau - Bayreuth-Süd 16000m
Rudolphstein - Bad Lobenstein 4600m

I hope this is helpful
Peter Hahndorf
Senior Software Engineer
indiwa digitale kommunikation GmbH
User avatar
Bernd Welter
Site Admin
Posts: 2574
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: Calculated toll distance greater than total distance

Post by Bernd Welter »

Hi there,

here's a quick update from our data squad ;-)
The problem (175070) is known and understood and will be handled with an upcoming German toll update...
So stay tuned!

Bernd
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany

Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning... :twisted:
Post Reply