Detect Routing Country Violation

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
Andreas Schönebeck
Posts: 15
Joined: Fri Jul 09, 2021 3:11 pm

Detect Routing Country Violation

Post by Andreas Schönebeck »

We are using the XServer2 calculateRoute operation and have the following problem:

If, for example, prohibitedCountries=["CH"] is specified in the GeographicRestrictions and the route contains an arrival stop within this prohibited country, a route will still be calculated if Course.Violations.Enabled=true is specified in the routing profile. This is okay at first, since we are indicating to the user that there is a violation for example due to the truck attributes.

But the particular thing is that the route ends right at the border of the forbidden country. Now I expected a RouteViolationEvent to be returned from the server if resultFields.eventTypes.ROUTE_VIOLATION_EVENT is specified, from which we can conclude that the route is marked as violated due to a forbidden country. Unfortunately, it seems that this is not the case.

So the following problem we would like to solve:
a) Course.Violations.Enabled=true can be used in the routing profile.
b) From the routing response it should be possible to determine that the route is incomplete due to a prohibited country.

We would be very glad if you can help us with this problem.

With kind regards
Andreas Schönebeck
ESYS GmbH Berlin
Joost
Posts: 310
Joined: Fri Apr 25, 2014 1:46 pm

Re: Detect Routing Country Violation

Post by Joost »

a route will still be calculated if Course.Violations.Enabled=true is specified in the routing profile
This is not correct. When you set prohibitedCountries the engine will no load map data for these countries. In other words: as far as the engine is concerned that country does not exist for the request.

In this case the normal linking behavior will occur (linking is the term for connecting an input waypoint to the road network). This means our engine will search for the nearest road by airline and connect your input to this road. In your example the nearest road will be then outside of CH.

A screenshot of a small example:
prohibitedCountries.jpg
Here you see I have a waypoint in CH and the engine will link to directly to the nearest road which is in DE.

I'm not sure what can be done to solve your use case. The way the engine prohibits countries cannot be changed since we need it for high performance routing to keep map data limited in a single network. As for way to work around this: i don't know your use case, i would recommend you would discuss this 1:1 with your primary xServer consultant.
Joost Claessen
Senior Technical Consultant
PTV Benelux
User avatar
Bernd Welter
Site Admin
Posts: 2695
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: Detect Routing Country Violation

Post by Bernd Welter »

Hi Andreas, Joost,

thanks for the quick response, Joost. I was on vacation and will now get in touch with Andreas 1:1.

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

Re: Detect Routing Country Violation

Post by Bernd Welter »

Here's some generic info from DEV (Max):
  • If you assign routingProfile.linking.maximumDistanceToSegment to a very low value (e.g. 100) you'd receive a
    WaypointNotLinkableFault
  • Input waypoint coordinates located very close to the border could be linked to the "allowed" neighbour country.
  • Geographic restrictions are HARD constraints which cannot be overruled by "violations allowed".
  • A potential workaround for your usecase might be: try to route without prohibiting countries and then use route events (CountryEvent) to check whether a critical country is used. You can then inform the user about this "usecase violation".
Does this answer the current requirement?
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:
Andreas Schönebeck
Posts: 15
Joined: Fri Jul 09, 2021 3:11 pm

Re: Detect Routing Country Violation

Post by Andreas Schönebeck »

Joost wrote:
a route will still be calculated if Course.Violations.Enabled=true is specified in the routing profile
This is not correct. When you set prohibitedCountries the engine will no load map data for these countries. In other words: as far as the engine is concerned that country does not exist for the request.

In this case the normal linking behavior will occur (linking is the term for connecting an input waypoint to the road network). This means our engine will search for the nearest road by airline and connect your input to this road. In your example the nearest road will be then outside of CH.
Thanks for your information. We had wrongly used OnRoadWaypoint. We have now switched to OffRoadWaypoint and combined the request with a low value for routingProfile.linking.maximumDistanceToSegment which then leads to an error as expected.
User avatar
Bernd Welter
Site Admin
Posts: 2695
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: Detect Routing Country Violation

Post by Bernd Welter »

Brilliant. Here's also an example for the difference between cost optimized routing and the old school abstract routing.
Left chart series / western route: via France - more distance but less overall costs<br />Right chart series / eastern route: via Switzerland - short distance and shorter driving period but in total more expensive due to the toll costs
Left chart series / western route: via France - more distance but less overall costs
Right chart series / eastern route: via Switzerland - short distance and shorter driving period but in total more expensive due to the toll costs
Maybe monetary cost optimized routing is also important to consider ;-)
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