Stay organized with collections
Save and categorize content based on your preferences.
You specify which route features you prefer to avoid, such as avoiding tolls or
highways, by adding route modifiers to a request. The API then attempts to
provide a route that does not require those features.
Use the routeModifiers property in a request, of type
RouteModifiers. You can specify avoidTolls,
avoidHighways, avoidFerries, and avoidIndoor.
Specifying a route modifier does not necessarily eliminate routes that include
the restricted feature. The API uses the modifier to bias the result to more
favorable routes. There can be a few reasons why requesting an avoidance option
doesn't change your route. For example, the only route from the origin to the
destination makes it impossible to avoid a highway or ferry. Or, the alternate
route actually lengthens travel time significantly.
The following example demonstrates how to set route modifiers in a
computeRoutes
method (REST) request body. You can also specify this option to the
ComputeRoutes
method (gRPC). In this example, you specify to avoid tolls and highways:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-01-29 UTC."],[[["The Routes API's Compute Route Matrix feature does not support avoiding route features."],["You can request routes that avoid tolls, highways, ferries, and indoor travel using the `routeModifiers` property."],["While route modifiers bias the results, they may not eliminate the specified features if alternatives are unavailable or significantly increase travel time."],["You can specify route modifiers in both REST and gRPC requests, using the `avoidTolls`, `avoidHighways`, `avoidFerries`, and `avoidIndoor` fields within the `routeModifiers` property."]]],[]]