Page 1 of 1

How to avoid transit routing through certain countries

Posted: Thu Jun 12, 2014 1:02 pm
by metin.kahraman
Dear forum users,

I need to perform an A-B route calculation which excludes Switzerland as a transit country.
I.e. unless A or B are located in Switzerland no Swiss segments should be part of the route.

I am looking for an approach other than simply checking whether A or B are located in Switzerland and then set EXCLUDE_COUNTRIES appropriately in the request.

In case there is no such option, how about introducing a parameter AVOID_COUNTRIES which takes the following value “41=2500;49=100” (as for AVOID_NATIONALNAMEDTOLL_ROADS).

Any recommendations ?

Regards

Metin Kahraman

Re: How to avoid transit routing through certain countries

Posted: Fri Jun 13, 2014 12:29 pm
by Bernd Welter
Hello Metin,

I'm not sure what you'd like to achieve - But how about an iterative approach:

Perform a standard routing. The response contains a Waypoint-Array that contains the given input stations extended by several properties such as "the country code" (e.g. 41 for Switzerland).
If the output countries (part of the toll info) contains 41-elements though none of the Waypoints is a 41-waypoint then you have to add the additional AVOID_COUNTRIES=49 to perform a detour.

Of course you should make sure not to request more information via the ResultListOptions than necessary.

By the way:
- 2500 doesn't prevent you from using country 41 - it raises a very strong antipathy and if you can save costs by using these segments (instead of thousand kilometers of detour) you will find them in the response
- 49=100 is not "treat it neutral" but a "slight antipathy" to german segments... If you want to treat them neutral your malus value should be "0"

Regards from Karlsruhe

Bernd