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 optimize waypoints for a route

Focus mode
How to optimize waypoints for a route - Amazon Location Service

The OptimizeWaypoints API calculates the most efficient route between a series of waypoints, minimizing either travel time or total distance. This API solves the Traveling Salesman Problem by considering road networks and traffic conditions to determine the optimal path.

Potential use cases

  • Analyze service area patterns: Use waypoint optimization to make informed decisions about business service areas and improve logistics efficiency.

Examples

Sample Request
{ "Origin": [ -123.095740, 49.274426 ], "Waypoints": [ { "Position": [ -123.115193, 49.280596 ] }, { "Position": [ -123.089557, 49.271774 ] } ], "DepartureTime": "2024-10-25T18:13:42Z", "Destination": [ -123.095185, 49.263728 ], "TravelMode": "Car" }
Sample Response
{ "Connections": [ { "Distance": 1989, "From": "Origin", "RestDuration": 0, "To": "Waypoint0", "TravelDuration": 258, "WaitDuration": 0 }, { "Distance": 3010, "From": "Waypoint0", "RestDuration": 0, "To": "Waypoint1", "TravelDuration": 298, "WaitDuration": 0 }, { "Distance": 2371, "From": "Waypoint1", "RestDuration": 0, "To": "Destination", "TravelDuration": 311, "WaitDuration": 0 } ], "Distance": 7370, "Duration": 867, "ImpedingWaypoints": [], "OptimizedWaypoints": [ { "DepartureTime": "2024-10-25T18:13:42Z", "Id": "Origin", "Position": [ -123.09574, 49.274426 ] }, { "DepartureTime": "2024-10-25T18:18:00Z", "Id": "Waypoint0", "Position": [ -123.115193, 49.280596 ] }, { "DepartureTime": "2024-10-25T18:22:58Z", "Id": "Waypoint1", "Position": [ -123.089557, 49.271774 ] }, { "ArrivalTime": "2024-10-25T18:28:09Z", "Id": "Destination", "Position": [ -123.095185, 49.263728 ] } ], "TimeBreakdown": { "RestDuration": 0, "ServiceDuration": 0, "TravelDuration": 867, "WaitDuration": 0 } }
cURL
curl --request POST \ --url 'https://routes.geo.eu-central-1.amazonaws.com/v2/optimize-waypoints?key=Your_key' \ --header 'Content-Type: application/json' \ --data '{ "Origin": [ -123.095740, 49.274426 ], "Waypoints": [ { "Position": [ -123.115193, 49.280596 ] }, { "Position": [ -123.089557, 49.271774 ] } ], "DepartureTime": "2024-10-25T18:13:42Z", "Destination": [ -123.095185, 49.263728 ], "TravelMode": "Car" }'
AWS CLI
aws geo-routes optimize-waypoints --key ${YourKey} \ --origin -123.095740 49.274426 \ --waypoints '[{"Position": [-123.115193 , 49.280596]}, {"Position": [-123.089557 , 49.271774]}]' \ --destination -123.095185 49.263728 \ --departure-time "2024-10-25T18:13:42Z" \ --travel-mode "Car"

Optimize waypoints using Car TravelMode

Sample Request
{ "Origin": [ -123.095740, 49.274426 ], "Waypoints": [ { "Position": [ -123.115193, 49.280596 ] }, { "Position": [ -123.089557, 49.271774 ] } ], "DepartureTime": "2024-10-25T18:13:42Z", "Destination": [ -123.095185, 49.263728 ], "TravelMode": "Car" }
Sample Response
{ "Connections": [ { "Distance": 1989, "From": "Origin", "RestDuration": 0, "To": "Waypoint0", "TravelDuration": 258, "WaitDuration": 0 }, { "Distance": 3010, "From": "Waypoint0", "RestDuration": 0, "To": "Waypoint1", "TravelDuration": 298, "WaitDuration": 0 }, { "Distance": 2371, "From": "Waypoint1", "RestDuration": 0, "To": "Destination", "TravelDuration": 311, "WaitDuration": 0 } ], "Distance": 7370, "Duration": 867, "ImpedingWaypoints": [], "OptimizedWaypoints": [ { "DepartureTime": "2024-10-25T18:13:42Z", "Id": "Origin", "Position": [ -123.09574, 49.274426 ] }, { "DepartureTime": "2024-10-25T18:18:00Z", "Id": "Waypoint0", "Position": [ -123.115193, 49.280596 ] }, { "DepartureTime": "2024-10-25T18:22:58Z", "Id": "Waypoint1", "Position": [ -123.089557, 49.271774 ] }, { "ArrivalTime": "2024-10-25T18:28:09Z", "Id": "Destination", "Position": [ -123.095185, 49.263728 ] } ], "TimeBreakdown": { "RestDuration": 0, "ServiceDuration": 0, "TravelDuration": 867, "WaitDuration": 0 } }
cURL
curl --request POST \ --url 'https://routes.geo.eu-central-1.amazonaws.com/v2/optimize-waypoints?key=Your_key' \ --header 'Content-Type: application/json' \ --data '{ "Origin": [ -123.095740, 49.274426 ], "Waypoints": [ { "Position": [ -123.115193, 49.280596 ] }, { "Position": [ -123.089557, 49.271774 ] } ], "DepartureTime": "2024-10-25T18:13:42Z", "Destination": [ -123.095185, 49.263728 ], "TravelMode": "Car" }'
AWS CLI
aws geo-routes optimize-waypoints --key ${YourKey} \ --origin -123.095740 49.274426 \ --waypoints '[{"Position": [-123.115193 , 49.280596]}, {"Position": [-123.089557 , 49.271774]}]' \ --destination -123.095185 49.263728 \ --departure-time "2024-10-25T18:13:42Z" \ --travel-mode "Car"
{ "Origin": [ -123.095740, 49.274426 ], "Waypoints": [ { "Position": [ -123.115193, 49.280596 ] }, { "Position": [ -123.089557, 49.271774 ] } ], "DepartureTime": "2024-10-25T18:13:42Z", "Destination": [ -123.095185, 49.263728 ], "TravelMode": "Car" }

On this page

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