xRoute2: how to determine (inofficial) tollDistance/Country?

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
User avatar
Bernd Welter
Site Admin
Posts: 2574
Joined: Mon Apr 14, 2014 10:28 am
Contact:

xRoute2: how to determine (inofficial) tollDistance/Country?

Post by Bernd Welter »

Cheerio,

these days a partner asked me how to determine the toll distance per country in xRoute2.
What he encountered was that the Toll and it's list of TollSections does not always contain an "officialDistance".
TollSections with the official distance (Germany only), though all the three countries return toll prices...
TollSections with the official distance (Germany only), though all the three countries return toll prices...
TollSections.PNG (7.91 KiB) Viewed 7620 times
Therefore it would be necessary to aggregate some other output element's distance values:
  • Request both the CountryEvents and TollEvents
    RouteEvents
    RouteEvents
  • Iterate over the events and "memorize" the current country
  • Collect corresponding ENTER and EXIT TollEvents based on the AccessTypes
    TollEvents
    TollEvents
  • Determine the length of these "inofficial" toll sections by subtracting ExitEvent.distanceFromStart-EnterEvent.distanceFromStart
    Computed distances...
    Computed distances...
    Aggregated.PNG (4.43 KiB) Viewed 7620 times
  • Aggregate them on the level you want...
    • per country as a whole
    • per country each time you enter it
    • in total
This should work fine. Here's an example based on a route "DE-Karlsruhe" =>"FR-Paris"=>>"ES-Madrid". Be aware that only Germany supports the exact toll. France and Spain are computed by the logic I recommended above.

Best regards,
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