Page 1 of 1

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

Posted: Mon Oct 05, 2020 1:39 pm
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 8023 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 8023 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