Search for content

Geographic Restrictions

The Routing API supports country codes to geographically restrict the search space of the routing algorithm.

To set the countries to use or avoid you can use the parameters options[allowedCountries] and options[prohibitedCountries] in the request.

Allowed Countries

The list of countries the route is allowed to pass. By default, all countries are allowed. If this parameter is present, only these countries are allowed to be passed, i.e. drive only in these countries. This parameter is mutually exclusive with prohibitedCountries.

Prohibited Countries

The list of countries the route must not pass. By default, all countries are allowed to pass. If this parameter is present, all but the given countries are allowed to be passed, i.e. do not drive in these countries. This parameter is mutually exclusive with allowedCountries.

For example a route from Freiburg to Milano:

 

default countries
The default route


allowedCountries=DE,FR,IT
allowedCountries=DE,FR,IT
 

prohibitedCountries=CH
prohibitedCountries=CH

Country Codes

Country codes should be ISO 3166-1 alpha-2 and separated by comma. In countries such as US, RU, AU, CA, and IN results can also be filtered by country subdivision specified as ISO 3166-2. In case the requested subdivision is not available, it is ignored and a warning is attached to the response.

 

Try it in the Geographic Restrictions code sample.