The avoid option allows to avoid toll, ferries or train shuttles on a route, e.g to reduce extra costs. This could lead to longer routes or even to undesired results, e.g. avoiding toll in a country with a lot of toll roads.
Please note that it is not always possible to avoid these features, e.g. routing to a waypoint on an island only reachable via ferry. In such a case the ferry is used anyway and a route is calculated as the goal is to avoid and not to prohibit the ferry.
The example below shows the avoidance of ferries:
Using ferries (default)
Avoiding ferries
Using avoid options
One or more avoid options can be set using the options query parameter:
options[avoid]=TOLL,FERRIES
Avoid features
The following features can be avoided:
Avoid feature | Description |
---|---|
TOLL | Avoid toll roads. If this is not possible and TOLL_COSTS are requested, toll costs will appear in the response. |
FERRIES | Avoid transportation via ferries. If this is not possible and COMBINED_TRANSPORT_EVENTS are requested, ferries will appear as combined transport BOAT in the response. |
RAIL_SHUTTLES | Avoid transportation via rail shuttles. If this is not possible and COMBINED_TRANSPORT_EVENTS are requested, rail shuttles will appear as combined transport RAIL in the response. |
Try it in the Avoid code sample.