Routing API v7 Developer's Guide

Avoiding Certain Road Types

To penalize the traversal of certain types of roads such as toll roads or motorways, you can specify a weighted routing feature within the specification of the routing mode.

For example, in the following code block:

The motorway parameter specifies the routing feature and using -2 for the weight determines how strictly route calculation should prioritize this routing feature.

If you specify motorway:-2, the API excludes motorways from the route calculation if it is possible to find a route that avoids them. Otherwise, the route calculation includes motorways.