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.
&mode=fastest;car;traffic:disabled;motorway:-2
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.