Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

How to create routes with custom avoidance of several potential items

Focus mode
How to create routes with custom avoidance of several potential items - Amazon Location Service

The CalculateRoutes API helps you to find the best routes between origin and destination, as well as the best opportunities for driver resting. It supports travel modes such as car, truck, pedestrian and scooter. It also supports up to 25 waypoints (stopovers) including the origin and destination, with only a few constraints.

Potential use cases

  • Calculate routes with custom avoidance: Customize routes with avoidance for better routes and commute planning.

Examples

Sample request
{ "Origin": [ -123.118105, 49.282423 ], "Destination": [ -123.020098, 49.232872 ], "TravelMode": "Car", "Avoid": { "TollRoads": true, "UTurns": true, "Ferries": true, "ControlledAccessHighways": true, "Tunnels": true } }
Sample response
{ "LegGeometryFormat": "FlexiblePolyline", "Notices": [], "Routes": [ { "Legs": [ { "Geometry": { "Polyline": "Redacted" }, "TravelMode": "Car", "Type": "Vehicle", "VehicleLegDetails": { "AfterTravelSteps": [], "Arrival": { "Place": { "ChargingStation": false, "OriginalPosition": [ -123.020098, 49.232872 ], "Position": [ -123.0203051, 49.2328499 ] } }, "Departure": { "Place": { "ChargingStation": false, "OriginalPosition": [ -123.1181051, 49.282423 ], "Position": [ -123.1180883, 49.2824349 ] } }, "Incidents": [], "Notices": [], "PassThroughWaypoints": [], "Spans": [], "Tolls": [], "TollSystems": [], "TravelSteps": [ { "Distance": 1288, "Duration": 102, "ExitNumber": [], "GeometryOffset": 0, "Type": "Depart" }, { "Distance": 262, "Duration": 24, "ExitNumber": [], "GeometryOffset": 37, "RampStepDetails": { "Intersection": [], "SteeringDirection": "Right" }, "Type": "Ramp" }, { "Distance": 1356, "Duration": 134, "ExitNumber": [], "GeometryOffset": 42, "TurnStepDetails": { "Intersection": [], "SteeringDirection": "Right", "TurnIntensity": "Typical" }, "Type": "Turn" }, { "Distance": 7092, "Duration": 568, "ExitNumber": [], "GeometryOffset": 92, "KeepStepDetails": { "Intersection": [], "SteeringDirection": "Left" }, "Type": "Keep" }, { "Distance": 65, "Duration": 26, "ExitNumber": [], "GeometryOffset": 337, "TurnStepDetails": { "Intersection": [], "SteeringDirection": "Left", "TurnIntensity": "Typical" }, "Type": "Turn" }, { "Distance": 50, "Duration": 18, "ExitNumber": [], "GeometryOffset": 339, "TurnStepDetails": { "Intersection": [], "SteeringDirection": "Right", "TurnIntensity": "Typical" }, "Type": "Turn" }, { "Distance": 0, "Duration": 0, "ExitNumber": [], "GeometryOffset": 343, "Type": "Arrive" } ], "TruckRoadTypes": [], "Zones": [] } } ], "MajorRoadLabels": [ { "RouteNumber": { "Language": "en", "Value": "HWY-1A" } } ] } ] }
cURL
curl --request POST \ --url 'https://routes.geo.eu-central-1.amazonaws.com/v2/routes?key=Your_key' \ --header 'Content-Type: application/json' \ --data '{ "Origin": [ -123.118105, 49.282423 ], "Destination": [ -123.020098, 49.232872 ], "TravelMode": "Car", "Avoid": { "TollRoads": true, "UTurns": true, "Ferries": true, "ControlledAccessHighways": true, "Tunnels": true } }'
AWS CLI
aws geo-routes calculate-routes --key ${YourKey} \ --origin -123.118105 49.282423 \ --destination -123.020098 49.232872 \ --travel-mode "Car" \ --avoid '{"TollRoads": true, "UTurns": true, "Ferries": true, "ControlledAccessHighways": true, "Tunnels": true}'

Use CalculateRoutes with avoidance of tolls, u-turns, ferries, highways, tunnels and more.

Sample request
{ "Origin": [ -123.118105, 49.282423 ], "Destination": [ -123.020098, 49.232872 ], "TravelMode": "Car", "Avoid": { "TollRoads": true, "UTurns": true, "Ferries": true, "ControlledAccessHighways": true, "Tunnels": true } }
Sample response
{ "LegGeometryFormat": "FlexiblePolyline", "Notices": [], "Routes": [ { "Legs": [ { "Geometry": { "Polyline": "Redacted" }, "TravelMode": "Car", "Type": "Vehicle", "VehicleLegDetails": { "AfterTravelSteps": [], "Arrival": { "Place": { "ChargingStation": false, "OriginalPosition": [ -123.020098, 49.232872 ], "Position": [ -123.0203051, 49.2328499 ] } }, "Departure": { "Place": { "ChargingStation": false, "OriginalPosition": [ -123.1181051, 49.282423 ], "Position": [ -123.1180883, 49.2824349 ] } }, "Incidents": [], "Notices": [], "PassThroughWaypoints": [], "Spans": [], "Tolls": [], "TollSystems": [], "TravelSteps": [ { "Distance": 1288, "Duration": 102, "ExitNumber": [], "GeometryOffset": 0, "Type": "Depart" }, { "Distance": 262, "Duration": 24, "ExitNumber": [], "GeometryOffset": 37, "RampStepDetails": { "Intersection": [], "SteeringDirection": "Right" }, "Type": "Ramp" }, { "Distance": 1356, "Duration": 134, "ExitNumber": [], "GeometryOffset": 42, "TurnStepDetails": { "Intersection": [], "SteeringDirection": "Right", "TurnIntensity": "Typical" }, "Type": "Turn" }, { "Distance": 7092, "Duration": 568, "ExitNumber": [], "GeometryOffset": 92, "KeepStepDetails": { "Intersection": [], "SteeringDirection": "Left" }, "Type": "Keep" }, { "Distance": 65, "Duration": 26, "ExitNumber": [], "GeometryOffset": 337, "TurnStepDetails": { "Intersection": [], "SteeringDirection": "Left", "TurnIntensity": "Typical" }, "Type": "Turn" }, { "Distance": 50, "Duration": 18, "ExitNumber": [], "GeometryOffset": 339, "TurnStepDetails": { "Intersection": [], "SteeringDirection": "Right", "TurnIntensity": "Typical" }, "Type": "Turn" }, { "Distance": 0, "Duration": 0, "ExitNumber": [], "GeometryOffset": 343, "Type": "Arrive" } ], "TruckRoadTypes": [], "Zones": [] } } ], "MajorRoadLabels": [ { "RouteNumber": { "Language": "en", "Value": "HWY-1A" } } ] } ] }
cURL
curl --request POST \ --url 'https://routes.geo.eu-central-1.amazonaws.com/v2/routes?key=Your_key' \ --header 'Content-Type: application/json' \ --data '{ "Origin": [ -123.118105, 49.282423 ], "Destination": [ -123.020098, 49.232872 ], "TravelMode": "Car", "Avoid": { "TollRoads": true, "UTurns": true, "Ferries": true, "ControlledAccessHighways": true, "Tunnels": true } }'
AWS CLI
aws geo-routes calculate-routes --key ${YourKey} \ --origin -123.118105 49.282423 \ --destination -123.020098 49.232872 \ --travel-mode "Car" \ --avoid '{"TollRoads": true, "UTurns": true, "Ferries": true, "ControlledAccessHighways": true, "Tunnels": true}'
{ "Origin": [ -123.118105, 49.282423 ], "Destination": [ -123.020098, 49.232872 ], "TravelMode": "Car", "Avoid": { "TollRoads": true, "UTurns": true, "Ferries": true, "ControlledAccessHighways": true, "Tunnels": true } }

On this page

PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.