

# Amazon Location Service Routes
<a name="routes"></a>

![\[An overview of Amazon Location Service Routes.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/routesV2/route-banner.png)


With Amazon Location Service Routes, you can calculate travel time and distance between multiple starting points and ending points, visualize vehicle GPS traces aligned with roads, and better understand your serviceable areas. This helps reduce operating costs and improve customer experience.

## Features
<a name="routes-features"></a>

**Plan a route path**  
Calculate routes between two or more locations, considering various factors such as distance, time, and road conditions. You can also see alternative routes for the same set of locations.

**Route Optimization**  
Optimize routes for time or distance, choosing the fastest or shortest route. You can also sequence waypoints to optimize for the traveling salesman problem.

**Route Analysis**  
Analyze performance metrics like travel time, distance, or the number of stops to ensure the route meets your desired goals.

**Service Area**  
Defines the geographic area that can be serviced from a particular location based on distance or time limits.

**Toll Costs**  
Calculate the costs associated with toll infrastructure on your route.

**Avoidances**  
Constrain your route calculation by avoiding highways, tunnels, ferries, and toll roads.

**Speed Limits**  
Find speed limits for each segment of a route, ensuring drivers comply with local regulations.

![\[An application using Amazon Location Service route features.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/routesV2/route-demo.png)


## Use cases
<a name="routes-usecases"></a>

**Provide efficient routes and turn-by-turn directions**  
Plan routes from any starting location (address, POI, or GPS coordinates) and calculate the best path to multiple destinations, factoring in vehicle dimensions and restrictions.  
For more information, see [Calculate routes](calculate-routes.md).

**Optimize delivery routes**  
Use waypoint sequencing to solve the Traveling Salesman Problem and calculate the optimal route to multiple destinations, minimizing time and distance.  
For more information, see [Optimize waypoints](actions-optimize-waypoints.md).

**Make sure deliveries are made from the nearest warehouse**  
Use Matrix Routing and Waypoint Sequencing to identify the fastest route from your warehouses to each customer, maximizing efficiency and minimizing costs.  
For more information, see [Calculate routes](calculate-routes.md) and [Calculate route matrix](calculate-route-matrix.md).

**Improve taxi and ride-share dispatch**  
Use Matrix Routing to identify the nearest available vehicle and calculate optimal routes based on real-time traffic. This ensures the closest vehicle reaches the customer efficiently, driving both customer satisfaction and business productivity. Make more trips, save on fuel costs, and deliver a superior service experience.  
For more information, see [Calculate routes](calculate-routes.md), [Calculate route matrix](calculate-route-matrix.md), and [Calculate isolines](calculate-isolines.md).

**Find service areas**  
Use Isoline routes to determine the geographic reach of your business, based on time or distance constraints. This allows the business to identify potential customers and make dispatch plans. In-home healthcare providers can ensure they have enough staff and resources to reach all patients within 15 minutes. Isoline helps optimize service areas, ensure timely deliveries, and locate new facilities.  
For more information, see [Calculate isolines](calculate-isolines.md).

**Snap GPS trace to roads**  
Align GPS traces to roads and visualize vehicle movements, ensuring route adherence and regulatory compliance. Fleet managers can see if vehicles are staying on planned routes and identify deviations. Verify that drivers are following guidelines, spot inefficiencies, and ensure compliance with regulations. Corrects GPS inaccuracies and variations, and presents a realistic view of vehicle activity. Enable better decision-making around route optimization, driver behavior, and fleet management.  
For more information, see [Snap to Roads](snap-to-roads.md).

## APIs
<a name="routes-apis"></a>

This table provides an overview of key Amazon Location Service APIs for route planning and location-based data processing. Each API offers unique functionality, such as calculating routes, optimizing waypoints, and snapping GPS traces to roads for accurate tracking.


**APIs**  

| API name | Description | Read more | 
| --- | --- | --- | 
| Calculate Routes | Calculate a travel distance, travel time, and turn-by-turn directions between a starting point and multiple destinations factoring vehicle restrictions, and real-time traffic. | [Calculate routes](calculate-routes.md) | 
| Calculate Route Matrix | Calculate route distance and time between a set of departure points and a set of destinations, factoring real time traffic. | [Calculate route matrix](calculate-route-matrix.md) | 
| Calculate Isolines | Identify the geographic area that can be reached within a specified time or distance based on your travel modes. | [Calculate isolines](calculate-isolines.md) | 
| Optimize Waypoints | Find the efficient order to travel to multiple destinations, reducing travel time and distance while accounting for factors like traffic and vehicle constraints. | [How to optimize waypoints for a route](optimize-waypoints.md) | 
| Snap to Roads | Match GPS traces to the nearest road segment, to improve accuracy of vehicle tracking and route visualization. | [Snap to Roads](snap-to-roads.md) | 

# Routes concepts
<a name="routes-concepts"></a>

The Routes concepts in Amazon Location Service provide a robust framework for planning and optimizing journeys, whether for simple navigation or complex logistics. Routes encompass various components, such as waypoints, legs, steps, and spans, each contributing to the granularity and flexibility of route calculations. Leveraging the Routes API, you can calculate travel distances, estimate travel times, and optimize multi-stop journeys. Additionally, features like route geometry, traffic awareness, speed limits, toll costs, and flexible polyline encoding enhance the capabilities for visualization, analysis, and operational efficiency. This section covers terminology, best practices, and detailed usage patterns, guiding you through implementing effective route solutions for navigation, delivery, field services, and more.

**Topics**
+ [Routes Terminology](routes-terminology.md)
+ [Where (origin, destination, waypoint, and traces)](concepts-where.md)
+ [When (departure and arrival)](concepts-when.md)
+ [How (travel mode, avoidance, and exclusion)](concepts-how.md)
+ [Traffic awareness](concepts-traffic-awareness.md)
+ [Optimize route and waypoint sequence](optimize-route-waypoint.md)
+ [Driver schedule and notices](driver-schedule-notices.md)

# Routes Terminology
<a name="routes-terminology"></a>

**Route**  
A route provides details for traveling from a departure position through waypoint positions to a destination. It includes travel distance, travel time, route geometry, speed limits, spans, and other attributes.

**Route Matrix**  
A matrix representing travel distance and travel time from a set of origins to a set of destinations. It is useful as an input for route planning or optimization applications.

**Waypoint**  
Waypoints are intermediate stops along a route from the departure point to the destination. The route follows the stopover order as specified in the request.

**Leg**  
A leg represents the journey between two consecutive positions on a route. If the positions are off-road, they are moved to the nearest road. A route with no waypoints consists of a single leg. Routes with one or more waypoints have multiple legs, with each leg representing travel from one waypoint to the next. Certain legs, like those involving ferries, contain specific information pertinent to that leg type.

**Step**  
A step is a segment within a leg, providing summary details for that part of the journey. Types of steps include:  
+ **Default Steps** – Basic steps with human-readable instructions, suited for web applications that display a route overview.
+ **Turn-by-Turn Steps** – Detailed steps suitable for turn-by-turn applications, providing granular instructions.
+ **Before Travel Steps** – Steps to complete before starting the journey. Example: boarding a ferry.
+ **After Travel Steps** – Steps to complete after reaching the end of a journey. Example: de-boarding a ferry.

**Span**  
A span represents a continuous stretch of a road that shares a consistent set of attributes. New spans are created along a route whenever one of the requested attributes changes.

**Segment**  
A segment is a navigable portion of a road, typically represented as a linear stretch.

**Route Geometry**  
Route geometry depicts the path of a route for visualization, analysis, or other uses. Each route leg’s geometry can be represented as a compressed, encoded polyline or as a simple line string.

**Flexible Polyline**  
A compact, encoded polyline format for representing geometry. Recommended for limiting response size and optimized for client-side decoding.

**Simple Line String**  
A GeoJSON LineString format representing geometry. This format produces a larger response payload and is an ordered array of coordinates that can be used to plot routes on a map.

# Where (origin, destination, waypoint, and traces)
<a name="concepts-where"></a>

Specifies the location for route calculation, including where the route starts, ends, and intermediate stops (or locations to be passed through).


**Specifies the where for route calculation**  

| Parameter | Description | Routes | Routes Matrix | Isoline | Optimize Waypoint | Snap to Road | 
| --- | --- | --- | --- | --- | --- | --- | 
| Origin(s) | Starting position of the route. | Yes, with options | Yes, with options | Yes, with options | Yes, with options | No | 
| Waypoint | Intermediate positions to be included along the route. | Yes, with options | Yes, with options | Yes, with options | Yes, with options | No | 
| Destination(s) | Ending position of the route. | Yes, with options | Yes, with options | Yes, with options | Yes, with options | No | 
| Trace points | GPS trace that includes historical position information emitted by a travel mode. These positions include typical GPS inaccuracies and gaps when the device couldn't emit or record this information. | No | No | No | No | Yes, with options | 

## Configurable options
<a name="configurable-options"></a>

Provides options to customize routing behavior for waypoints, origins, and destinations.

**Waypoints options**


| Parameter | Description | Routes | Routes Matrix | Isoline | Optimize Waypoint | Snap To Road | 
| --- | --- | --- | --- | --- | --- | --- | 
| AvoidActionsForDistance | Avoids actions for the provided distance. Typically used to ensure drivers have enough time to make decisions near waypoints. | Yes | No | No | No | No | 
| AvoidUTurns | Specifies whether U-turns are allowed at the waypoint. | Yes | No | No | No | No | 
| Heading | GPS heading at the waypoint position. | Yes | No | No | Yes | No | 
| Matching | Options to configure matching the provided position to the road network. | Yes, with options | No | No | No | No | 
| SideOfStreet | Specifies the side of the street to match the waypoint position. | Yes, with options | No | No | Yes, with options | No | 
| StopDuration | Duration to stop over at the waypoint position. | Yes | No | No | No | No | 
| Position | Longitude and Latitude for the waypoint. | Yes | No | No | Yes | No | 
| PassThrough | Determines if the waypoint should be treated as a stop or passed through. | Yes | No | No | No | No | 
| Id | Identifier string for the waypoint. | No | No | No | Yes | No | 
| AccessHours | Specifies access hours for visiting the destination. | No | No | No | Yes | No | 
| AppointmentTime | Scheduled appointment time at the waypoint. | No | No | No | Yes | No | 
| ServiceDuration | Service time at the waypoint, such as duration of an appointment. | No | No | No | Yes | No | 
| Before | Defines which waypoints must be visited after this one. | No | No | No | Yes | No | 

**Origin options**


| Parameter | Description | Routes | Routes Matrix | Isoline | Optimize Waypoint | Snap To Road | 
| --- | --- | --- | --- | --- | --- | --- | 
| AvoidActionsForDistance | Avoids actions for the provided distance. | Yes | Yes | Yes | No | No | 
| AvoidUTurns | Specifies if U-turns are permitted at the origin. | Yes | No | No | No | No | 
| Heading | GPS heading at the origin position. | Yes | Yes | Yes | No | No | 
| Matching | Options to match the origin position to the road network. | Yes, with options | Yes, with options | Yes, with options | No | No | 
| SideOfStreet | Specifies the side of the street to match the origin position. | Yes, with options | Yes, with options | Yes, with options | No | No | 
| Id | Identifier string for the origin. | No | No | Yes | No | No | 

**Destination options**


| Parameter | Description | Routes | Routes Matrix | Isoline | Optimize Waypoint | Snap To Road | 
| --- | --- | --- | --- | --- | --- | --- | 
| AvoidActionsForDistance | Avoids actions for the provided distance at the destination. | Yes | Yes | Yes | No | No | 
| AvoidUTurns | Specifies if U-turns are allowed at the destination. | Yes | No | No | No | No | 
| Heading | GPS heading at the destination position. | Yes | Yes | Yes | Yes | No | 
| Matching | Options to match the destination position to the road network. | Yes, with options | Yes, with options | Yes, with options | No | No | 
| SideOfStreet | Specifies the side of the street to match the destination position. | Yes, with options | Yes, with options | Yes, with options | Yes, with options | No | 
| StopDuration | Duration to stop over at the destination. | Yes | No | No | No | No | 
| Id | Identifier string for the destination. | No | No | Yes | No | No | 
| AccessHours | Specifies access hours for visiting the destination. | No | No | Yes | No | No | 
| AppointmentTime | Scheduled appointment time at the destination. | No | No | Yes | No | No | 
| ServiceDuration | Service time at the destination, such as duration of an appointment. | No | No | Yes | No | No | 

# When (departure and arrival)
<a name="concepts-when"></a>

Specifies the time for route calculation. The time not only determines the timestamps for departure and arrival but also influences the traffic data to be used.


| Parameter | Description | Routes | Routes Matrix | Isoline | Optimize Waypoint | Snap To Road | 
| --- | --- | --- | --- | --- | --- | --- | 
| Departure Time | Time of departure from the Origin. If neither arrival nor departure time is provided, dynamic traffic information is not used, and only free-flow speeds based on historical traffic are applied. | Yes | Yes | Yes | Yes | No | 
| Depart Now | Uses the current time as the time of departure from the Origin. | Yes | Yes | Yes | No | No | 
| Arrival Time | Time of arrival at the destination. If neither arrival nor departure time is provided, dynamic traffic information is not used, and only free-flow speeds based on historical traffic are applied. | Yes | No | Yes | No | No | 

# How (travel mode, avoidance, and exclusion)
<a name="concepts-how"></a>

Use the following options to specify the travel mode and related features to use for route calculation.

**Travel mode options**

Specifies the mode of transport when calculating a route. This setting influences the estimated speed of travel, road compatibility, and the potential use of ferries where needed.


| Parameter | Description | Routes | Routes Matrix | Isoline | Optimize Waypoint | Snap To Road | 
| --- | --- | --- | --- | --- | --- | --- | 
| Car | Car travel mode. | Yes, with options | Yes, with options | Yes, with options | Yes | Yes | 
| Scooter | Scooter travel mode. | Yes, with options | Yes | Yes, with options | Yes | Yes | 
| Pedestrian | Walking travel mode. | Yes, with options | Yes | Yes | Yes, with options | Yes | 
| Truck | Truck travel mode. | Yes, with options | Yes, with options | Yes, with options | Yes, with options | Yes, with options | 

**Avoidance, exclusion, and allow options**

Determines whether a specific set of features should be included, excluded, or avoided during route calculation.


| Parameter | Description | Routes | Routes Matrix | Isoline | Optimize Waypoint | Snap To Road | 
| --- | --- | --- | --- | --- | --- | --- | 
| Avoidance | Features that are avoided on a best-case basis. If the router cannot find a valid route, the avoidance will be ignored, and a notice will indicate that the avoidance could not be honored. | Yes, with options | Yes, with options | Yes, with options | Yes, with options | No | 
| Exclusion | Features that are strictly excluded. If the router cannot find a valid route with the exclusion options, no routes are returned. | Yes, with options | Yes, with options | No | No | No | 
| Allow | Features that need to be explicitly enabled. | Yes, with options | Yes, with options | Yes, with options | Yes, with options | No | 

**List of avoidance**

Lists features that are avoided on a best-case basis. If the router cannot find a valid route, the avoidance will be ignored, and a notice will indicate that the avoidance could not be honored.


| Parameter | Description | Routes | Routes Matrix | Isoline | Optimize Waypoint | Snap To Road | 
| --- | --- | --- | --- | --- | --- | --- | 
| Areas | Areas to be avoided with exceptions. | Yes, with options | Yes, with options | Yes, with options | Yes, with options | No | 
| Controlled Access Highways | High-speed roads with limited entry points. | Yes | Yes | Yes | Yes | No | 
| Car Shuttle Trains | Trains transporting vehicles through tunnels. | Yes | Yes | Yes | No | No | 
| Dirt Roads | Unpaved roads with natural surfaces. | Yes | Yes | Yes | Yes | No | 
| Ferries | Boats carrying vehicles across water bodies | Yes | Yes | Yes | No | No | 
| Boat Ferries | Ferries transporting vehicles on rail tracks. | No | No | Yes | Yes | No | 
| Rail Ferries | Ferries transporting vehicles on rail tracks. | No | No | Yes | Yes | No | 
| Seasonal Closure | Roads closed during certain seasons. | Yes | No | Yes | No | No | 
| Tunnels | Underground passages for vehicular traffic. | Yes | Yes | Yes | Yes | No | 
| Toll Road | Roads requiring payment for access. | Yes | Yes | Yes | Yes | No | 
| Toll Transponders | Avoids roads where toll transponders are the only means of payment. | Yes | No | Yes | No | No | 
| U-Turns | Points allowing vehicles to turn in reverse direction. | Yes | Yes | Yes | Yes | No | 
| Zone Categories | Zone categories to be avoided. | Yes | Yes | Yes | No | No | 

**List of exclusions**

Lists features that are strictly excluded. If the router cannot find a valid route with the exclusion options, no routes are returned.


| Parameter | Description | Routes | Routes Matrix | Isoline | Optimize Waypoint | Snap To Road | 
| --- | --- | --- | --- | --- | --- | --- | 
| Countries | Country Code 2 or Country Code 3 for countries that should be strictly excluded from route calculation. | Yes | Yes | No | Yes | No | 

**List of allow**

Lists features that need to be explicitly enabled for route calculation.


| Parameter | Description | Routes | Routes Matrix | Isoline | Optimize Waypoint | Snap To Road | 
| --- | --- | --- | --- | --- | --- | --- | 
| HOV | Enable use of high occupancy vehicle lanes for route calculation. | Yes | Yes | Yes | No | No | 
| HOT | Enable use of high occupancy toll lanes for route calculation. | Yes | Yes | Yes | No | No | 

# Traffic awareness
<a name="concepts-traffic-awareness"></a>

Determines the type of traffic-related information used during route calculation. Flow traffic represents congestion, excluding long-term incident-related congestion. The accuracy of flow traffic data decreases over time, making historical traffic data more reliable for past events.


| Parameter | Description | Routes | Routes Matrix | Isoline | Optimize Waypoint | Snap To Road | 
| --- | --- | --- | --- | --- | --- | --- | 
| Usage | Enable or disable traffic data during route calculation. When enabled, if `DepartureTime`, `ArrivalTime`, or `DepartNow` are not provided, only long-term closures will be considered. Otherwise, if a time is provided, all traffic data is taken into account. | Yes | Yes | Yes | Yes | No | 
| FlowEventThresholdOverride | Duration in seconds for which a flow traffic event is considered valid. While valid, flow traffic data will be used over historical traffic data. | Yes | Yes | Yes | No | No | 

# Optimize route and waypoint sequence
<a name="optimize-route-waypoint"></a>

## Optimize routing
<a name="optimize-routing"></a>

Optimization criteria for when calculating a route. This can either be the fastest route measured by time or the shortest route measured by distance.


| Option | Description | Measurement | 
| --- | --- | --- | 
| Fastest Route | Calculate the fastest route, focusing on minimizing travel time. This takes into account traffic conditions, road speed limits, and other factors. | Time | 
| Shortest Route | Calculate the shortest route, minimizing the distance traveled. This is often used when distance is the key factor, such as reducing fuel costs or emissions. | Distance | 

## Optimize waypoint
<a name="optimize-waypoint"></a>

Optimization criteria for sequencing waypoints in a route. 

# Driver schedule and notices
<a name="driver-schedule-notices"></a>

## Driver schedule
<a name="driver-schedule"></a>

Driver settings to define work and rest schedules. This is mandatory for many jurisdictions.


| Parameter | Description | Routes | Routes Matrix | Isoline | Optimize Waypoint | Snap To road | 
| --- | --- | --- | --- | --- | --- | --- | 
| Custom rest cycles | Rest cycles defined by drive duration to be followed up with a rest duration. Any number of such cycles can be provided. | Yes, with options | No | No | No | No | 
| Long rest cycle and short rest cycle | Rest cycles defined by short cycle and long cycle. A short drive duration is followed by a short rest drive duration. Short drives can be repeated until a long drive duration is reached, at which point the long rest duration is enforced. | No | No | No | Yes, with options | No | 

## Notices, warnings, and constraints
<a name="notices-warnings-constraints"></a>

Supplemental information that provides insight into decisions made during the route calculation.


| Parameter | Description | Routes | Routes Matrix | Isoline | Optimize Waypoint | Snap To road | 
| --- | --- | --- | --- | --- | --- | --- | 
| Notices | Notices regarding route calculation. Additionally may include an impact for the notice indicating if the results of the route calculation can be used as is or will need to be manually inspected before usage. | Yes, with details | No | No | No | Yes | 
| FailedConstraints | Constraints that were provided in the request that could not be satisfied, leading to failure of the optimization problem. | No | No | No | Yes, with details | No | 

# Route APIs
<a name="choose-routes-apis"></a>

Routes provide capabilities for calculating optimized paths between locations. These features support applications requiring logistics planning, distance calculations, and route optimization. Users can also snap location points to roads for improved accuracy. For more information, See [Amazon Location Service Routes](routes.md).
+ **CalculateIsolines**: Generates isolines based on travel time or distance, useful for defining service areas or reachability zones. For more information, See [Calculate isolines](calculate-isolines.md).
+ **CalculateRouteMatrix**: Provides a matrix of distances and travel times between multiple origins and destinations, supporting logistics and trip planning. For more information, See [Calculate route matrix](calculate-route-matrix.md).
+ **CalculateRoutes**: Calculates optimized routes for point-to-point or multi-stop navigation, including customizable routing preferences. For more information, See [Calculate routes](calculate-routes.md).
+ **OptimizeWaypoints**: Optimizes the order of waypoints for the most efficient travel route, minimizing distance or time. For more information, See [Optimize waypoints](actions-optimize-waypoints.md).
+ **SnapToRoads**: Aligns coordinates to the nearest road paths, enhancing GPS accuracy by snapping points to known roads. For more information, See [Snap to Roads](snap-to-roads.md).

The following table presents a number of business use cases that are best solved with Routes APIs.


| **Business need** | **Useful API** | **Examples** | 
| --- | --- | --- | 
| **Calculate the travel distance and time for a origins and a destination**Supports the following: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/location/latest/developerguide/choose-routes-apis.html) | `CalculateRoutes` |  | 
| **Find route polyline for a origins and a destination **Supports the following: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/location/latest/developerguide/choose-routes-apis.html) | `CalculateRoutes` |  | 
| **Find routes turn by turn direction for an origin and a destination**Supports the following: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/location/latest/developerguide/choose-routes-apis.html) | `CalculateRoutes` |  | 
| **Find a route by departing now**Supports the following: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/location/latest/developerguide/choose-routes-apis.html) | `CalculateRoutes` |  | 
| **Find a route if you depart at specific time**Supports the following: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/location/latest/developerguide/choose-routes-apis.html) | `CalculateRoutes` |  | 
| **Find a route if you need to arrival at specific time**Supports the following: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/location/latest/developerguide/choose-routes-apis.html) | `CalculateRoutes` |  | 
| **Find shortest routes **Supports the following: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/location/latest/developerguide/choose-routes-apis.html) | `CalculateRoutes` |  | 
| **Find fastest routes **Supports the following: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/location/latest/developerguide/choose-routes-apis.html) | `CalculateRoutes` |  | 
| **Find alternative routes**Supports the following: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/location/latest/developerguide/choose-routes-apis.html) | `CalculateRoutes` |  | 
| **Find traffic aware routes **Supports the following: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/location/latest/developerguide/choose-routes-apis.html) | `CalculateRoutes` |  | 
| **Find routes with avoidance such as toll, u-turn, ferry, highway, tunnel, and more **Supports the following: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/location/latest/developerguide/choose-routes-apis.html) | `CalculateRoutes` |  | 
| **Find routes with custom avoidance by passing polyline or polygon**Supports the following: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/location/latest/developerguide/choose-routes-apis.html) | `CalculateRoutes` |  | 
| **Calculate toll cost **Supports the following: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/location/latest/developerguide/choose-routes-apis.html) | `CalculateRoutes` | [Calculate toll cost](calculate-toll-cost.md) | 
| **Find speed limit of a road span on a route **Supports the following: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/location/latest/developerguide/choose-routes-apis.html) | `CalculateRoutes` |  | 
| **Draw a route on a map**Supports waypoint marking. | `GetTile` and `GetStyleDescriptor` with rendering engine (MapLibre) with Calculate route  |  | 
| **Calculate route matrix of distance and time for multiple origins and destinations**Supports the following:[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/location/latest/developerguide/choose-routes-apis.html) | `CalculateRouteMatrix` | [How to calculate a route matrix of distance and time for multiple origins and destinations](calculate-route-matrix-distance.md) | 
| **Calculate route matrix with avoidance **Supports the following:[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/location/latest/developerguide/choose-routes-apis.html) | `CalculateRouteMatrix` | [How to calculate route matrix with avoidance](calculate-route-matrix-with-avoidance.md) | 
| **Calculate a service area based on time (isochrones)**Supports travel modes, such as truck, pedestrian, car, and scooter.  | `CalculateIsolines` | [How to calculate a service area based on ranges of time](calculate-service-area-based-on-time.md) | 
| **Calculate a service area based on distance (isodistance)**Supports travel modes, such as truck, pedestrian, car, and scooter.  | `CalculateIsolines` |  | 
| **Calculate a service area with avoidance**Supports travel modes, such as truck, pedestrian, car, and scooter.  | `CalculateIsolines` |  | 
|  **Calculate a service area from reverse direction** Supports travel modes, such as truck, pedestrian, car, and scooter.  | `CalculateIsolines` |  | 
|  **Calculate service area for multi-range of time or distance** Supports travel modes, such as truck, pedestrian, car, and scooter.  | `CalculateIsolines` |  | 
| **Optimize waypoints for routes (traveling salesman problem)** Supports travel modes, such as truck, pedestrian, car, and scooter.  | `OptimizeWaypoint` | [How to optimize waypoints for a route](optimize-waypoints.md) | 
| **Optimize waypoints for a route with traffic awareness ** Supports travel modes, such as truck, pedestrian, car, and scooter.  | `OptimizeWaypoint` |  | 
| **Optimize waypoints for a route with access hour awareness** Supports travel modes, such as truck, pedestrian, car, and scooter. | `OptimizeWaypoint` |  | 
| **Match GPS traces to road network **Supports travel modes, such as truck, pedestrian, car, and scooter. | Snap to road  | [How to match GPS traces to a road network](how-to-match-gps-traces.md) | 
| **Visualize matched GPS traces on a map **Supports travel modes, such as truck, pedestrian, car, and scooter. | `GetStyleDescriptor` with rendering engine (MapLibre) with Snap to road  |  | 

# Calculate routes
<a name="calculate-routes"></a>

The Routes API calculates routes between two or more locations with or without avoidances for different travel modes such as car, truck, scooter, and pedestrian. With this API, you can customize routing options and request additional route-related information to meet specific needs. This API supports turn-by-turn navigation and customizes route calculations by applying parameters like avoiding toll roads, motorways, or ferries. The API also returns speed limits and toll costs.

For more information, see [CalculateRoutes](https://docs.aws.amazon.com/location/latest/APIReference/API_CalculateRoutes.html) in the *Amazon Location Service API Reference*.

For example requests, responses, cURL, and CLI commands for this API, see [How to use Calculate routes](https://docs.aws.amazon.com/location/latest/developerguide/calculate-routes-how-to.html).

![\[An overview of Amazon Location Service Routes.\]](http://docs.aws.amazon.com/location/latest/developerguide/images/routesV2/P2P-Turn-by-turn-navigation.gif)


## Use cases
<a name="use-cases"></a>
+ **Display geographic details on a route map:** Use advanced mapping features to visualize detailed routes with rich geographic information, including landmarks, terrain, and urban infrastructure. Enhance decision-making by allowing users to view clear routes from their starting point to their destination. This feature can support navigation, planning, and various logistics scenarios, and display routes for travel modes such as cars, trucks, scooters, and pedestrians. Customize routes by adding elements like avoidances or toll calculations.
+ **Show turn-by-turn navigation:** Provide seamless navigation support on web and mobile devices. Users can access turn-by-turn directions, ensuring efficient travel. Both platforms can leverage navigation instructions to offer routes for personal or business travel, including speed limits.
+ **Calculate toll costs along routes:** Incorporate toll cost calculations into route planning to provide accurate pricing estimates for routes that include toll roads, bridges, or tunnels. Display toll costs upfront to help drivers and planners make cost-effective decisions and avoid tolls when necessary.
+ **Ensure compliance with speed limits:** Integrate speed limit data to help drivers stay within legal limits, reducing the risk of fines and promoting safer, fuel-efficient driving. Logistics and fleet management can also benefit by monitoring speed compliance in real time.
+ **Assist with freight and vehicle routing solutions:** Simplify freight and vehicle routing operations by integrating routes, navigation, and tracking capabilities into logistics portals. Efficiently plan routes for multiple deliveries, track shipments in real-time, and manage fuel costs through better routing.

## Understand the request
<a name="understanding-request"></a>

**Note**  
 For customers in `ap-southeast-1` and `ap-southeast-5`, supported request and response fields may differ. Refer to the [CalculateRoutes API Reference](https://docs.aws.amazon.com/location/latest/APIReference/API_CalculateRoutes.html) for details. 

The request requires `Origin` and `Destination` parameters, while optional parameters like `Allow`, `Avoid`, and `Traffic` customize the route to meet specific needs and constraints. .

**Origin**  
The start position of the route in longitude and latitude.

**Destination**  
The end position of the route.

**Waypoints**  
Intermediate positions to include along a route between the start and end positions.

**OptimizeRoutingFor**  
Optimization criteria for the route, such as fastest or shortest.

**LegGeometryFormat**  
Format of the geometry returned for each route leg.

**Avoid**  
Features to be avoided during route calculation, ignored if no alternative route is found.

**Traffic**  
Traffic-related options affecting route calculation.

**Tolls**  
Toll-related options impacting route calculations and toll costs.

**LegAdditionalFeatures**  
Features that can be enabled within the response for each leg of the journey.

**SpanAdditionalFeatures**  
Span features that can be enabled within the response for each leg of the journey.

## Understand the response
<a name="understanding-response"></a>

The response provides route details such as the legs of the journey, notices about route calculations, and summary information including distance and duration. .

**Routes**  
Array of routes containing legs and associated properties.

**Notices**  
Warnings or informational messages about the route.

**LegGeometryFormat**  
Specifies the format of the route's geometry.

### Leg details
<a name="leg-details"></a>

Each leg of a journey can be of type Ferry, Pedestrian, or Vehicle depending on the transport mode. While each leg contains properties agnostic to transport mode, specific properties can be found under:

**FerryLegDetails**  
Ferry-specific properties for the leg.

**VehicleLegDetails**  
Vehicle-specific properties for the leg.

**PedestrianLegDetails**  
Pedestrian-specific properties for the leg.

### Steps
<a name="steps"></a>

Each leg of a journey is divided into steps that describe actions for portions of the route. A step can be either Default, suitable for basic applications, or TurnByTurn, suitable for turn-by-turn navigation. Each step contains properties agnostic to step type, such as duration and distance, and other specific properties like ExitStepDetails, which applies only to exit steps.

**BeforeTravelSteps**  
Steps to perform before beginning the journey.

**TravelSteps**  
Steps to perform during the journey.

**AfterTravelSteps**  
Steps to perform after completing the journey.

### Spans
<a name="spans"></a>

Each leg of a journey can be split into spans. A span is a portion of the leg with the same values for the set of requested `SpanAdditionalFeatures`. Spans are divided by road properties such as `SpeedLimit`, road names, or regions. Returned spans can be used to visualize road attributes and access-related information.

# Calculate toll cost
<a name="calculate-toll-cost"></a>

This topic provides an overview of the fields and definitions associated with calculating toll costs. Using these fields, you can specify parameters such as payment methods, currency, and vehicle characteristics to customize toll cost calculations.


| Field name | Routes | 
| --- | --- | 
| Transponders | Yes, with options | 
| Vignettes | Yes, with options | 
| Currency | Yes, with options | 
| EmissionType | Yes, with options | 
| VehicleCategory | Yes, with options | 

## Definitions
<a name="definitions"></a>

This section provides brief definitions for each field used in toll cost calculation.

****Transponders****  
Transponders are a method of payment for tolls, potentially resulting in a different price compared to other payment methods.

****Vignettes****  
A vignette is a form of road pricing. When a user has the required vignette, no additional toll payments are necessary.

****Currency****  
The currency in which toll costs are reported. In addition to the local currency, a converted currency is included, which also impacts the currency used in the toll summary within the response.

****EmissionType****  
The emission type of the vehicle, used for calculating toll costs based on vehicle emissions.

****VehicleCategory****  
The vehicle sub-category used for toll cost calculation.

# Understanding route steps
<a name="understanding-route-steps"></a>

This section defines various actions and steps that need to be taken to complete a leg of a journey. Route steps vary by travel mode and provide guidance for both overview applications and detailed turn-by-turn navigation.

## Route steps overview
<a name="route-steps-overview"></a>

The following types of route steps define the actions needed to complete a route leg, varying by travel mode and the stage of the journey.


| **Step type** | **Description** | 
| --- | --- | 
| Default steps | Basic steps providing human-readable instructions, often used in web-based applications to offer an overview of the route. | 
| Turn by turn steps | Detailed steps for creating a turn-by-turn navigation application, offering more granular directions. | 
| Before travel steps | Steps that need to be completed before starting the travel section, such as boarding a ferry. | 
| After travel steps | Steps to be performed after the travel section is complete, like de-boarding a ferry. | 

## Step breakdown by travel mode
<a name="route-step-types"></a>


| **Section** | **Step** | **Before Travel** | **Travel** | **After Travel** | 
| --- | --- | --- | --- | --- | 
| Vehicle | Arrive | No | Yes | No | 
| Vehicle | Continue | No | Yes | No | 
| Vehicle | ContinueHighway | No | Yes | No | 
| Vehicle | Depart | No | Yes | No | 
| Vehicle | Exit | No | Yes | No | 
| Pedestrian | Arrive | No | Yes | No | 
| Pedestrian | Charge | No | Yes | No | 
| Ferry | Wait | No | No | Yes | 
| Ferry | Board | Yes | No | No | 
| Ferry | Deboard | No | No | Yes | 

# Calculate route matrix
<a name="calculate-route-matrix"></a>

The Matrix Routing service calculates routing matrices, providing travel times or distances between multiple origins and destinations. This service offers flexible customization options, allowing you to specify travel modes, traffic conditions, and other routing parameters. The matrix calculations can vary in size and shape, supporting both square and non-square matrices, and accommodate dynamic or free-flow traffic data.

For more information, see [CalculateRouteMatrix](https://docs.aws.amazon.com/location/latest/APIReference/API_CalculateRouteMatrix.html) in the *Amazon Location Service API Reference*.

For example requests, responses, cURL, and CLI commands for this API, see [How to use Calculate route matrix](https://docs.aws.amazon.com/location/latest/developerguide/calculate-route-matrix-how-to.html).

## Use cases
<a name="route-matrix-use-cases"></a>
+ **Optimize delivery routes for logistics and e-commerce:** Efficiently calculate travel time and distance between multiple pickup and delivery locations to optimize routes. Logistics companies can use this feature to minimize costs and delivery time by planning efficient paths across cities. It is ideal for setting optimized delivery windows for same-day or next-day services and planning multi-stop delivery routes.
+ **Match drivers and passengers in ride-sharing applications:** Use route calculations to match drivers with the closest passengers by finding the fastest route between locations. Ride-sharing apps can enhance user experience by providing real-time driver arrival estimates, ensuring prompt pickups and drop-offs. Supports various transportation modes like cars, bikes, and scooters.
+ **Plan and optimize routes for fleet management:** Manage large fleets by optimizing routes to reduce fuel consumption and travel time. Fleet managers can assign the most efficient routes to vehicles for multiple stops, thereby increasing overall operational efficiency. Use cases include service fleets, transportation companies, and utilities where optimal route planning is essential for site visits.

## Understand the request
<a name="route-matrix-request"></a>

**Note**  
 For customers in `ap-southeast-1` and `ap-southeast-5`, supported request and response fields may differ. Refer to the [CalculateRouteMatrix API Reference](https://docs.aws.amazon.com/location/latest/APIReference/API_CalculateRouteMatrix.html) for details. 

The request includes **Origins** and **Destinations** for route calculations, with optional parameters to tailor the matrix based on preferences and constraints. For more details, refer to the API Reference for Calculate Route Matrix API.
+ `Origins`: List of origin coordinates in longitude and latitude.
+ `Destinations`: List of destination coordinates.
+ `OptimizeRoutingFor`: Optimization criteria such as "Fastest" or "Shortest" route.
+ `RoutingBoundary`: Defines boundaries for calculation, either as "Unbounded" or restricted to a specific geometry.
+ `Avoid`: Features to avoid during route calculation. Ignored if no viable route can be found.
+ `Traffic`: Traffic-related options impacting route calculations.

## Understand the response
<a name="route-matrix-response"></a>

The response includes a matrix of calculated routes between origins and destinations, with details such as distance and duration. Errors and boundaries for the routes are also provided, if applicable. Refer to the API Reference for additional details on the Calculate Route Matrix API.
+ `RouteMatrix`: Matrix containing travel distances (in meters) and durations (in seconds) between origins and destinations.
+ `ErrorCount`: Number of errors encountered during route calculations.
+ `RoutingBoundary`: Boundary within which the matrix is calculated.

# Calculate isolines
<a name="calculate-isolines"></a>

The Calculate Isolines API allows you to determine areas reachable within specified time or distance limits. By considering factors such as road restrictions, traffic conditions, and travel mode, it generates isolines that outline accessible areas, supporting urban planning, logistics, and service accessibility applications. This API can be used for urban planning, real estate analysis, and accessibility studies by visualizing service reach, transportation options, or resources within a set timeframe or distance limit. By displaying these isolines on a map, users can assess travel reach within specific constraints, enhancing decision-making for site selection, service coverage, and resource allocation.

For more information, see [CalculateIsolines](https://docs.aws.amazon.com/location/latest/APIReference/API_CalculateIsolines.html) in the *Amazon Location Service API Reference*.

For example requests, responses, cURL, and CLI commands for this API, see [How to use Calculate isolines](https://docs.aws.amazon.com/location/latest/developerguide/calculate-isolines-how-to.html).

## Use cases
<a name="use-cases"></a>
+ **Assess healthcare accessibility through travel time isolines:** Generate isolines to evaluate access to healthcare facilities from various neighborhoods based on travel times. Healthcare organizations can use this feature to identify underserved areas and make informed decisions about clinic locations or mobile health services, thereby improving community healthcare access.
+ **Analyze market reach for retail expansion using travel time isolines:** Create isolines to represent customer access to retail locations based on travel times. Retail businesses can assess new store locations and understand customer demographics, using these visualizations to strategically expand and optimize sales potential.
+ **Optimize logistics and delivery zones with isolines:** Generate isolines to define delivery zones based on time-sensitive logistics requirements. Logistics companies can visualize areas reachable within specific timeframes from distribution centers, improving route planning, operational efficiency, and timely deliveries.
+ **Plan tourism and recreational access with isolines:** Visualize travel times from tourist attractions to nearby accommodations. Tourism boards can help travelers find convenient lodging options, promoting local businesses and enhancing the travel experience by displaying these isolines on a map.
+ **Improve emergency response planning through isolines:** Generate isolines to assess response times from emergency service locations to various areas in a community. Emergency management teams can identify regions within critical response times, optimizing resource allocation to improve response during incidents.
+ **Analyze commuting patterns for workforce planning with isolines:** Generate isolines to visualize commuting times and identify areas with high travel times. Businesses can use these insights for remote work policies or office relocations, enhancing employee satisfaction and productivity.

## Understand the request
<a name="understanding-request"></a>

The request accepts parameters like `Origin`, `Destination`, and `Thresholds` for defining isolines. Optional parameters, such as `Allow`, `Avoid`, and `TravelModeOptions`, allow customization of isoline constraints. For more information, see the .

**Origin**  
The starting point for isoline calculation in longitude and latitude.

**Thresholds**  
Time or distance limits used to define the isoline boundary.

**TravelMode**  
The mode of transport, such as car, pedestrian, or truck.

**OptimizeIsolineFor**  
Optimization criteria, such as Accurate, Balanced, or Fast calculation.

**DepartureTime**  
Time of departure, if specified, for calculating time-dependent isolines.

**ArrivalTime**  
Time of arrival, if specified, for calculating time-dependent isolines.

**IsolineGranularity**  
The maximum number of points and resolution of the isoline boundary.

## Understand the response
<a name="understanding-response"></a>

The response includes isolines with properties like `IsolineGeometryFormat`, outlining the reachable area based on request parameters. .

**Isolines**  
Calculated isolines with associated properties, including geometries and connections.

**Geometries**  
List of geometries outlining the calculated isoline boundaries.

**Connections**  
Connections between isoline geometries, including the geometry for each connection.

# Optimize waypoints
<a name="actions-optimize-waypoints"></a>

The Optimize Waypoints API calculates the most efficient sequence for visiting multiple waypoints along a route. Using advanced algorithms, this API minimizes travel time and distance while considering factors such as traffic conditions, avoidances, and vehicle specifications. Integrating the Optimize Waypoints API helps businesses streamline operations, reduce fuel consumption, enhance delivery efficiency, and improve customer satisfaction. The API provides optimized routes, enabling better decision-making and resource allocation in multi-stop travel scenarios.

For more information, see [OptimizeWaypoints](https://docs.aws.amazon.com/location/latest/APIReference/API_OptimizeWaypoints.html) in the *Amazon Location Service API Reference*.

For example requests, responses, cURL, and CLI commands for this API, see [How to use Optimize waypoints](https://docs.aws.amazon.com/location/latest/developerguide/optimize-waypoints-how-to.html).

## Use cases
<a name="use-cases"></a>
+ **Enhance multi-stop delivery efficiency:** Efficiently optimize the sequence of multiple delivery stops to reduce travel time and costs. Delivery services can streamline operations by calculating the most efficient route for drivers, minimizing fuel expenses and ensuring timely deliveries, which improves customer satisfaction and operational efficiency.
+ **Streamline field service operations:** Optimize the sequence of visits to multiple job sites in a single day, reducing travel time for field service technicians. This allows companies to complete more jobs daily, enhancing productivity and service delivery.
+ **Plan efficient tour routes for travel agencies:** Optimize itineraries that include multiple attractions to maximize sightseeing while minimizing travel time. Travel agencies can use this feature to create optimal plans for guided tours, enhancing the overall tourist experience by making better use of available time.
+ **Improve ride-sharing driver efficiency:** Optimize pick-up and drop-off sequences for multiple passengers, reducing wait times and enhancing the rider experience. Ride-sharing services can maximize driver earnings and ensure timely service for passengers by optimizing waypoints.
+ **Optimize routes for waste collection services:** Plan garbage collection routes to minimize travel distance and time, which helps waste management companies streamline operations and ensure timely collection, achieving cost savings and reducing environmental impact.
+ **Coordinate logistics for events and conferences:** Manage transportation logistics for delivering equipment and supplies to multiple venues, optimizing loading and unloading routes. This allows event planners to streamline transportation, reduce delays, and ensure timely material arrival for events.
+ **Enhance emergency response routes:** Plan the fastest routes to multiple emergencies, optimizing response times in critical situations. Emergency services can improve response efficiency, potentially saving lives by using optimized waypoints.
+ **Facilitate sales route planning for field representatives:** Optimize routes for sales representatives visiting multiple clients in a day, minimizing travel time and maximizing client visits. This helps companies increase productivity and capitalize on more sales opportunities.

## Understand the request
<a name="understanding-request"></a>

The request requires parameters like `Origin` and `Waypoints` to calculate an optimized sequence. Optional parameters like `Avoid`, `Traffic`, and `Driver` allow additional customization.

**Waypoints**  
A list of waypoints to be optimized in sequence.

**Origin**  
The starting position of the route for optimization.

**Destination**  
An optional end position of the route for optimization.

**OptimizeSequencingFor**  
Criteria for sequencing optimization, such as fastest or shortest route.

**Traffic**  
Traffic-related options affecting route calculation.

**Driver**  
Driver work and rest cycles to ensure compliance with regional driving regulations.

**Clustering**  
Clustering allows you to specify how nearby waypoints can be clustered to improve the optimized sequence.

Each waypoint can also specify constraints that must be satisfied, such as `AppointmentTime`, `AccessHours`, and ordering constraints like `Before` another waypoint.

## Understand the response
<a name="understanding-response"></a>

The response provides details of the optimized waypoint sequence, including `OptimizedWaypoints` and the overall `Distance` and `Duration` for the journey. 

**OptimizedWaypoints**  
A list of waypoints in their optimized order.

**ImpedingWaypoints**  
Waypoints that prevent an optimized sequence, including failed constraints that were not met.

**Connections**  
Details about travel between waypoints, including distance and duration.

**TimeBreakdown**  
Breakdown of total `Travel`, `Rest`, `Service`, and `Wait` durations for the route.

**ClusterIndex**  
Index of the cluster the waypoint is associated with. The index is included in the response only if clustering was performed while processing the request.

# Snap to Roads
<a name="snap-to-roads"></a>

The Snap to Road API enhances the accuracy of geographic positioning by aligning GPS coordinates to the nearest road segments on a digital map. This API takes raw longitude and latitude data, often collected from mobile devices or vehicles, and "snaps" these points to the corresponding road network, correcting inaccuracies caused by GPS drift or signal loss. By integrating the Snap to Road API, you can ensure your applications provide reliable and accurate data, supporting better decision-making and operational efficiency across various scenarios.

For more information, see [SnapToRoads](https://docs.aws.amazon.com/location/latest/APIReference/API_SnapToRoads.html) in the *Amazon Location Service API Reference*.

For example requests, responses, cURL, and CLI commands for this API, see [How to use Snap to Roads](https://docs.aws.amazon.com/location/latest/developerguide/snap-to-roads-how-to.html).

## Use cases
<a name="use-cases"></a>
+ **Enhance navigation accuracy by snapping to the road network:** Efficiently align GPS coordinates to the nearest road segments to improve navigation accuracy. This feature is valuable for mapping and navigation services, providing users with precise directions and real-time location updates, thus enhancing the navigation experience.
+ **Improve data accuracy for fleet management applications:** Correct the reported positions of vehicles by snapping their GPS coordinates to the closest roadways. In fleet management systems, this feature ensures accurate vehicle tracking, enabling optimized logistics and better operational efficiency.

## Understand the request
<a name="understanding-request"></a>

The request requires `TracePoints` to match to roads, with optional parameters like `SnappedGeometryFormat` and `SnapRadius` for controlling geometry format and snapping radius. .

**TracePoints**  
A list of coordinates to be snapped to the road network.

**SnappedGeometryFormat**  
The format of the returned geometry, such as "FlexiblePolyline" or "Simple".

**SnapRadius**  
The radius around trace points within which road snapping is considered.

## Understand the response
<a name="understanding-response"></a>

The response contains corrected geometry and snapped trace points, with properties like `SnappedGeometry` and `SnappedTracePoints` to indicate accuracy and snapping confidence. .

**SnappedGeometry**  
The corrected geometry of the snapped route.

**SnappedTracePoints**  
The adjusted coordinates of the trace points snapped to roads.

**Notices**  
Warnings or informational messages about the snapping process.

# How to
<a name="routes-how-to"></a>

This section provides guides for leveraging the Routes APIs to solve routing and navigation challenges. These tutorials cover the essential tasks for integrating routing functionality into your applications. Each topic focuses on a specific use case, enabling you to efficiently implement advanced routing features tailored to your business needs.

**Topics**
+ [Learn how to use CalculateRoutes](calculate-routes-how-to.md)
+ [Learn how to use CalculateIsolines](calculate-isolines-how-to.md)
+ [Learn how to use CalculateRouteMatrix](calculate-route-matrix-how-to.md)
+ [Learn how to use OptimizeWaypoints](optimize-waypoints-how-to.md)
+ [Learn how to use SnapToRoads](snap-to-roads-how-to.md)

# Learn how to use CalculateRoutes
<a name="calculate-routes-how-to"></a>

This section provides step-by-step instructions for using `CalculateRoutes`. This topic details guidance on finding routes with specific configurations, such as incorporating turn-by-turn navigation, setting travel modes, and adding waypoints.

**Topics**
+ [How to find a route for an origin and destination](calculate-routes-origin-destination-waypoints.md)
+ [How to find routes with turn-by-turn directions](how-to-find-turn-by-turn-route.md)
+ [How to find a speed limit for a road span](calculate-routes-speed-limit-road.md)
+ [How to find alternate routes](calculate-routes-alternate.md)
+ [How to calculate the tolls for a route](calculate-routes-tolls.md)
+ [How to create routes with custom avoidance](calculate-routes-custom-avoidance-poly.md)
+ [How to create routes with custom avoidance of several potential items](calculate-routes-custom-avoidance-multiple.md)
+ [How to find the fastest route](calculate-routes-custom-avoidance-fast.md)
+ [How to find the shortest routes](calculate-routes-custom-avoidance-shortest.md)

# How to find a route for an origin and destination
<a name="calculate-routes-origin-destination-waypoints"></a>

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

## Potential use cases
<a name="potential-use-cases"></a>
+ **Find point-to-point routes:** Determine the best route between two locations based on various travel modes and additional options.

## Examples
<a name="calculate-routes-examples"></a>

### Calculate routes from origin to destination using Car TravelMode
<a name="calculate-routes-car-mode"></a>

------
#### [ Sample request ]

```
{
    "Origin": [
        -123.118105,
        49.282423
    ],
    "Destination": [
        -123.020098,
        49.232872
    ]
}
```

------
#### [ 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
                                ]
                            }
                        },
                        "TravelSteps": [
                            {
                                "Distance": 1288,
                                "Duration": 102,
                                "Type": "Depart"
                            },
                            {
                                "Distance": 262,
                                "Duration": 24,
                                "Type": "Ramp"
                            },
                            {
                                "Distance": 1356,
                                "Duration": 134,
                                "Type": "Turn"
                            },
                            {
                                "Distance": 7092,
                                "Duration": 568,
                                "Type": "Keep"
                            },
                            {
                                "Distance": 65,
                                "Duration": 26,
                                "Type": "Turn"
                            },
                            {
                                "Distance": 50,
                                "Duration": 18,
                                "Type": "Turn"
                            },
                            {
                                "Distance": 0,
                                "Duration": 0,
                                "Type": "Arrive"
                            }
                        ]
                    }
                }
            ]
        }
    ]
}
```

------
#### [ 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
  ]
}'
```

------
#### [ AWS CLI ]

```
aws geo-routes calculate-routes --key ${YourKey} \
--origin -123.118105 49.282423 \
--destination -123.020098 49.232872
```

------

# How to find routes with turn-by-turn directions
<a name="how-to-find-turn-by-turn-route"></a>

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
<a name="potential-use-cases-turn-by-turn"></a>
+ **Create a navigation mobile app:** Use the API to get turn-by-turn navigation instructions.
+ **Display directions on a web platform:** Show detailed route guidance for web applications to assist you with navigation.

## Examples
<a name="calculate-routes-examples-turn-by-turn"></a>

### Calculate routes using Car TravelMode
<a name="calculate-routes-car-mode-turn-by-turn"></a>

------
#### [ Sample request ]

```
{
    "Origin": [
        -123.118105,
        49.282423
    ],
    "Destination": [
        -123.020098,
        49.232872
    ],
    "TravelStepType": "TurnByTurn",
    "TravelMode": "Car"
}
```

------
#### [ Sample response ]

```
{
    "LegGeometryFormat": "FlexiblePolyline",
    "Notices": [],
    "Routes": [
        {
            "Legs": [
                {
                    "Geometry": {
                        "Polyline": "Redacted"
                    },
                    "TravelMode": "Car",
                    "Type": "Vehicle",
                    "VehicleLegDetails": {
                        "Arrival": {
                            "Place": {
                                "Position": [-123.0203051, 49.2328499]
                            }
                        },
                        "Departure": {
                            "Place": {
                                "Position": [-123.1180883, 49.2824349]
                            }
                        },
                        "TravelSteps": [
                            {
                                "Distance": 1288,
                                "Duration": 102,
                                "Type": "Depart",
                                "NextRoad": {
                                    "RoadName": "W Georgia St",
                                    "RouteNumber": "HWY-1A"
                                }
                            },
                            {
                                "Distance": 262,
                                "Duration": 24,
                                "Type": "Keep",
                                "NextRoad": {
                                    "RoadName": "Main St",
                                    "RouteNumber": "HWY-1A"
                                }
                            },
                            {
                                "Distance": 1356,
                                "Duration": 134,
                                "Type": "Turn",
                                "NextRoad": {
                                    "RoadName": "Main St",
                                    "RouteNumber": "HWY-1A"
                                }
                            },
                            {
                                "Distance": 7092,
                                "Duration": 568,
                                "Type": "Keep",
                                "NextRoad": {
                                    "RoadName": "Kingsway",
                                    "RouteNumber": "HWY-1A"
                                }
                            },
                            {
                                "Distance": 65,
                                "Duration": 26,
                                "Type": "Turn"
                            },
                            {
                                "Distance": 0,
                                "Duration": 0,
                                "Type": "Arrive"
                            }
                        ]
                    }
                }
            ]
        }
    ]
}
```

------
#### [ 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
  ],
  "TravelStepType": "TurnByTurn",
  "TravelMode": "Car"
}'
```

------
#### [ AWS CLI ]

```
aws geo-routes calculate-routes --key ${YourKey} \
--origin -123.118105 49.282423 \
--destination -123.020098 49.232872 \
--travel-step-type "TurnByTurn" \
--travel-mode "Car"
```

------

# How to find a speed limit for a road span
<a name="calculate-routes-speed-limit-road"></a>

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
<a name="potential-use-cases"></a>
+ **Audit speed limit compliance:** Stays aware of speed limits and compliance to them.
+ **Inform the driver of the speed limit:** Notifies the driver of the speed limit when it might not be clear otherwise.

## Examples
<a name="calculate-routes-speed-examples"></a>

### Find speed limits in Car TravelMode
<a name="calculate-routes-speed"></a>

------
#### [ Sample request ]

```
{
    "Origin": [
        13.055211,
        52.704802
    ],
    "Destination": [
        13.551910,
        52.282705
    ],
    "TravelMode": "Car",
    "SpanAdditionalFeatures": ["SpeedLimit"]
}
```

------
#### [ Sample response ]

```
{
    "LegGeometryFormat": "FlexiblePolyline",
    "Notices": [],
    "Routes": [
        {
            "Legs": [
                {
                    "Geometry": {
                        "Polyline": "Redacted"
                    },
                    "TravelMode": "Car",
                    "Type": "Vehicle",
                    "VehicleLegDetails": {
                        "AfterTravelSteps": [],
                        "Arrival": {
                            "Place": {
                                "ChargingStation": false,
                                "OriginalPosition": [
                                    13.55191,
                                    52.282705
                                ],
                                "Position": [
                                    13.5507836,
                                    52.2859121
                                ]
                            }
                        },
                        "Departure": {
                            "Place": {
                                "ChargingStation": false,
                                "OriginalPosition": [
                                    13.055211,
                                    52.704802
                                ],
                                "Position": [
                                    13.0555036,
                                    52.7056073
                                ]
                            }
                        },
                        "Incidents": [],
                        "Notices": [],
                        "PassThroughWaypoints": [],
                        "Spans": [
                            {
                                "GeometryOffset": 0,
                                "SpeedLimit": {
                                    "Unlimited": true
                                }
                            },
                            {
                                "GeometryOffset": 151,
                                "SpeedLimit": {
                                    "MaxSpeed": 120.00000762939453
                                }
                            },
                            {
                                "GeometryOffset": 167,
                                "SpeedLimit": {
                                    "MaxSpeed": 80
                                }
                            },
                            {
                                "GeometryOffset": 195,
                                "SpeedLimit": {
                                    "MaxSpeed": 120.00000762939453
                                }
                            },
                            {
                                "GeometryOffset": 220,
                                "SpeedLimit": {
                                    "Unlimited": true
                                }
                            },
                            {
                                "GeometryOffset": 356,
                                "SpeedLimit": {
                                    "MaxSpeed": 120.00000762939453
                                }
                            },
                            {
                                "GeometryOffset": 358,
                                "SpeedLimit": {
                                    "MaxSpeed": 100
                                }
                            },
                            {
                                "GeometryOffset": 368,
                                "SpeedLimit": {
                                    "MaxSpeed": 80
                                }
                            },
                            {
                                "GeometryOffset": 384,
                                "SpeedLimit": {
                                    "MaxSpeed": 60.000003814697266
                                }
                            },
                            {
                                "GeometryOffset": 639,
                                "SpeedLimit": {
                                    "MaxSpeed": 80
                                }
                            },
                            {
                                "GeometryOffset": 701,
                                "SpeedLimit": {
                                    "MaxSpeed": 60.000003814697266
                                }
                            },
                            {
                                "GeometryOffset": 726,
                                "SpeedLimit": {
                                    "MaxSpeed": 80
                                }
                            },
                            {
                                "GeometryOffset": 805,
                                "SpeedLimit": {
                                    "MaxSpeed": 60.000003814697266
                                }
                            },
                            {
                                "GeometryOffset": 839,
                                "SpeedLimit": {
                                    "MaxSpeed": 80
                                }
                            },
                            {
                                "GeometryOffset": 1384,
                                "SpeedLimit": {
                                    "MaxSpeed": 60.000003814697266
                                }
                            },
                            {
                                "GeometryOffset": 1393,
                                "SpeedLimit": {
                                    "MaxSpeed": 50
                                }
                            },
                            {
                                "GeometryOffset": 1443,
                                "SpeedLimit": {
                                    "MaxSpeed": 30.000001907348633
                                }
                            },
                            {
                                "GeometryOffset": 1454,
                                "SpeedLimit": {
                                    "MaxSpeed": 50
                                }
                            },
                            {
                                "GeometryOffset": 1504,
                                "SpeedLimit": {
                                    "MaxSpeed": 60.000003814697266
                                }
                            },
                            {
                                "GeometryOffset": 1513,
                                "SpeedLimit": {
                                    "MaxSpeed": 80
                                }
                            },
                            {
                                "GeometryOffset": 1516,
                                "SpeedLimit": {
                                    "MaxSpeed": 60.000003814697266
                                }
                            },
                            {
                                "GeometryOffset": 1555,
                                "SpeedLimit": {
                                    "MaxSpeed": 80
                                }
                            },
                            {
                                "GeometryOffset": 1748,
                                "SpeedLimit": {
                                    "MaxSpeed": 120.00000762939453
                                }
                            },
                            {
                                "GeometryOffset": 1904,
                                "SpeedLimit": {
                                    "MaxSpeed": 100
                                }
                            },
                            {
                                "GeometryOffset": 1945,
                                "SpeedLimit": {
                                    "Unlimited": true
                                }
                            },
                            {
                                "GeometryOffset": 2006,
                                "SpeedLimit": {
                                    "MaxSpeed": 70
                                }
                            },
                            {
                                "GeometryOffset": 2017,
                                "SpeedLimit": {
                                    "MaxSpeed": 50
                                }
                            },
                            {
                                "GeometryOffset": 2033,
                                "SpeedLimit": {
                                    "MaxSpeed": 30.000001907348633
                                }
                            }
                        ],
                        "Tolls": [],
                        "TollSystems": [],
                        "TravelSteps": [
                            {
                                "Distance": 9099,
                                "Duration": 262,
                                "ExitNumber": [],
                                "GeometryOffset": 0,
                                "Type": "Depart"
                            },
                            {
                                "Distance": 18849,
                                "Duration": 800,
                                "ExitNumber": [],
                                "GeometryOffset": 162,
                                "KeepStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right"
                                },
                                "Type": "Keep"
                            },
                            {
                                "Distance": 4290,
                                "Duration": 212,
                                "ExitNumber": [],
                                "ExitStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right"
                                },
                                "GeometryOffset": 701,
                                "Type": "Exit"
                            },
                            {
                                "Distance": 14418,
                                "Duration": 651,
                                "ExitNumber": [],
                                "GeometryOffset": 828,
                                "Type": "Continue"
                            },
                            {
                                "Distance": 1255,
                                "Duration": 62,
                                "ExitNumber": [],
                                "ExitStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right"
                                },
                                "GeometryOffset": 1359,
                                "Type": "Exit"
                            },
                            {
                                "Distance": 1607,
                                "Duration": 139,
                                "ExitNumber": [],
                                "GeometryOffset": 1393,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Left",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 934,
                                "Duration": 92,
                                "ExitNumber": [],
                                "GeometryOffset": 1442,
                                "Type": "Continue"
                            },
                            {
                                "Distance": 320,
                                "Duration": 27,
                                "ExitNumber": [],
                                "GeometryOffset": 1473,
                                "Type": "Continue"
                            },
                            {
                                "Distance": 320,
                                "Duration": 33,
                                "ExitNumber": [],
                                "GeometryOffset": 1491,
                                "Type": "Continue"
                            },
                            {
                                "Distance": 17863,
                                "Duration": 680,
                                "ExitNumber": [],
                                "GeometryOffset": 1504,
                                "RampStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right"
                                },
                                "Type": "Ramp"
                            },
                            {
                                "Distance": 2888,
                                "Duration": 95,
                                "ExitNumber": [],
                                "GeometryOffset": 1917,
                                "Type": "Continue"
                            },
                            {
                                "Distance": 321,
                                "Duration": 28,
                                "ExitNumber": [],
                                "ExitStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right"
                                },
                                "GeometryOffset": 1977,
                                "Type": "Exit"
                            },
                            {
                                "Distance": 549,
                                "Duration": 41,
                                "ExitNumber": [],
                                "GeometryOffset": 2006,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 386,
                                "Duration": 51,
                                "ExitNumber": [],
                                "GeometryOffset": 2023,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Left",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 98,
                                "Duration": 15,
                                "ExitNumber": [],
                                "GeometryOffset": 2033,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 0,
                                "Duration": 0,
                                "ExitNumber": [],
                                "GeometryOffset": 2036,
                                "Type": "Arrive"
                            }
                        ],
                        "TruckRoadTypes": [],
                        "Zones": []
                    }
                }
            ],
            "MajorRoadLabels": [
                {
                    "RouteNumber": {
                        "Language": "de",
                        "Value": "A111"
                    }
                },
                {
                    "RouteNumber": {
                        "Language": "de",
                        "Value": "A113"
                    }
                }
            ]
        }
    ]
}
```

------
#### [ 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": [
    13.055211,
    52.704802
  ],
  "Destination": [
    13.551910,
    52.282705
  ],
  "TravelMode": "Car",
  "SpanAdditionalFeatures": ["SpeedLimit"]
}'
```

------
#### [ AWS CLI ]

```
aws geo-routes calculate-routes --key ${YourKey} \
--origin 13.055211 52.704802 \
--destination 13.551910 52.282705 \
--travel-mode "Car" \
--span-additional-features "SpeedLimit"
```

------

# How to find alternate routes
<a name="calculate-routes-alternate"></a>

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
<a name="potential-use-cases"></a>
+ **Identify alternate routes:** Be able to pick the best route to suit your business needs.

## Examples
<a name="calculate-routes-alternate-examples"></a>

### Find alternate routes in Car TravelMode
<a name="calculate-routes-alternate"></a>

------
#### [ Sample request ]

```
{
    "Origin": [
        13.055211,
        52.704802
    ],
    "Destination": [
        13.551910,
        52.282705
    ],
    "TravelMode": "Car",
    "MaxAlternatives": 2
}
```

------
#### [ Sample response ]

```
{
    "LegGeometryFormat": "FlexiblePolyline",
    "Notices": [],
    "Routes": [
        {
            "Legs": [
                {
                    "Geometry": {
                        "Polyline": "Redacted"
                    },
                    "TravelMode": "Car",
                    "Type": "Vehicle",
                    "VehicleLegDetails": {
                        "AfterTravelSteps": [],
                        "Arrival": {
                            "Place": {
                                "ChargingStation": false,
                                "OriginalPosition": [
                                    13.55191,
                                    52.282705
                                ],
                                "Position": [
                                    13.5507836,
                                    52.2859121
                                ]
                            }
                        },
                        "Departure": {
                            "Place": {
                                "ChargingStation": false,
                                "OriginalPosition": [
                                    13.055211,
                                    52.704802
                                ],
                                "Position": [
                                    13.0555036,
                                    52.7056073
                                ]
                            }
                        },
                        "Incidents": [],
                        "Notices": [],
                        "PassThroughWaypoints": [],
                        "Spans": [],
                        "Tolls": [],
                        "TollSystems": [],
                        "TravelSteps": [
                            {
                                "Distance": 9099,
                                "Duration": 262,
                                "ExitNumber": [],
                                "GeometryOffset": 0,
                                "Type": "Depart"
                            },
                            {
                                "Distance": 18849,
                                "Duration": 800,
                                "ExitNumber": [],
                                "GeometryOffset": 162,
                                "KeepStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right"
                                },
                                "Type": "Keep"
                            },
                            {
                                "Distance": 4290,
                                "Duration": 212,
                                "ExitNumber": [],
                                "ExitStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right"
                                },
                                "GeometryOffset": 701,
                                "Type": "Exit"
                            },
                            {
                                "Distance": 14418,
                                "Duration": 651,
                                "ExitNumber": [],
                                "GeometryOffset": 828,
                                "Type": "Continue"
                            },
                            {
                                "Distance": 1255,
                                "Duration": 62,
                                "ExitNumber": [],
                                "ExitStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right"
                                },
                                "GeometryOffset": 1359,
                                "Type": "Exit"
                            },
                            {
                                "Distance": 1607,
                                "Duration": 139,
                                "ExitNumber": [],
                                "GeometryOffset": 1393,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Left",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 934,
                                "Duration": 92,
                                "ExitNumber": [],
                                "GeometryOffset": 1442,
                                "Type": "Continue"
                            },
                            {
                                "Distance": 320,
                                "Duration": 27,
                                "ExitNumber": [],
                                "GeometryOffset": 1473,
                                "Type": "Continue"
                            },
                            {
                                "Distance": 320,
                                "Duration": 33,
                                "ExitNumber": [],
                                "GeometryOffset": 1491,
                                "Type": "Continue"
                            },
                            {
                                "Distance": 17863,
                                "Duration": 680,
                                "ExitNumber": [],
                                "GeometryOffset": 1504,
                                "RampStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right"
                                },
                                "Type": "Ramp"
                            },
                            {
                                "Distance": 2888,
                                "Duration": 95,
                                "ExitNumber": [],
                                "GeometryOffset": 1917,
                                "Type": "Continue"
                            },
                            {
                                "Distance": 321,
                                "Duration": 28,
                                "ExitNumber": [],
                                "ExitStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right"
                                },
                                "GeometryOffset": 1977,
                                "Type": "Exit"
                            },
                            {
                                "Distance": 549,
                                "Duration": 41,
                                "ExitNumber": [],
                                "GeometryOffset": 2006,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 386,
                                "Duration": 51,
                                "ExitNumber": [],
                                "GeometryOffset": 2023,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Left",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 98,
                                "Duration": 15,
                                "ExitNumber": [],
                                "GeometryOffset": 2033,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 0,
                                "Duration": 0,
                                "ExitNumber": [],
                                "GeometryOffset": 2036,
                                "Type": "Arrive"
                            }
                        ],
                        "TruckRoadTypes": [],
                        "Zones": []
                    }
                }
            ],
            "MajorRoadLabels": [
                {
                    "RouteNumber": {
                        "Language": "de",
                        "Value": "A111"
                    }
                },
                {
                    "RouteNumber": {
                        "Language": "de",
                        "Value": "A113"
                    }
                }
            ]
        },
        {
            "Legs": [
                {
                    "Geometry": {
                        "Polyline": "Redacted"
                    },
                    "TravelMode": "Car",
                    "Type": "Vehicle",
                    "VehicleLegDetails": {
                        "AfterTravelSteps": [],
                        "Arrival": {
                            "Place": {
                                "ChargingStation": false,
                                "OriginalPosition": [
                                    13.55191,
                                    52.282705
                                ],
                                "Position": [
                                    13.5507836,
                                    52.2859121
                                ]
                            }
                        },
                        "Departure": {
                            "Place": {
                                "ChargingStation": false,
                                "OriginalPosition": [
                                    13.055211,
                                    52.704802
                                ],
                                "Position": [
                                    13.0555036,
                                    52.7056073
                                ]
                            }
                        },
                        "Incidents": [],
                        "Notices": [],
                        "PassThroughWaypoints": [],
                        "Spans": [],
                        "Tolls": [],
                        "TollSystems": [],
                        "TravelSteps": [
                            {
                                "Distance": 91047,
                                "Duration": 2880,
                                "ExitNumber": [],
                                "GeometryOffset": 0,
                                "Type": "Depart"
                            },
                            {
                                "Distance": 3496,
                                "Duration": 119,
                                "ExitNumber": [],
                                "ExitStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right"
                                },
                                "GeometryOffset": 1473,
                                "Type": "Exit"
                            },
                            {
                                "Distance": 321,
                                "Duration": 28,
                                "ExitNumber": [],
                                "ExitStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right"
                                },
                                "GeometryOffset": 1565,
                                "Type": "Exit"
                            },
                            {
                                "Distance": 549,
                                "Duration": 41,
                                "ExitNumber": [],
                                "GeometryOffset": 1594,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 386,
                                "Duration": 51,
                                "ExitNumber": [],
                                "GeometryOffset": 1611,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Left",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 98,
                                "Duration": 15,
                                "ExitNumber": [],
                                "GeometryOffset": 1621,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 0,
                                "Duration": 0,
                                "ExitNumber": [],
                                "GeometryOffset": 1624,
                                "Type": "Arrive"
                            }
                        ],
                        "TruckRoadTypes": [],
                        "Zones": []
                    }
                }
            ],
            "MajorRoadLabels": [
                {
                    "RouteNumber": {
                        "Language": "de",
                        "Value": "A10"
                    }
                }
            ]
        },
        {
            "Legs": [
                {
                    "Geometry": {
                        "Polyline": "Redacted"
                    },
                    "TravelMode": "Car",
                    "Type": "Vehicle",
                    "VehicleLegDetails": {
                        "AfterTravelSteps": [],
                        "Arrival": {
                            "Place": {
                                "ChargingStation": false,
                                "OriginalPosition": [
                                    13.55191,
                                    52.282705
                                ],
                                "Position": [
                                    13.5507836,
                                    52.2859121
                                ]
                            }
                        },
                        "Departure": {
                            "Place": {
                                "ChargingStation": false,
                                "OriginalPosition": [
                                    13.055211,
                                    52.704802
                                ],
                                "Position": [
                                    13.0555036,
                                    52.7056073
                                ]
                            }
                        },
                        "Incidents": [],
                        "Notices": [],
                        "PassThroughWaypoints": [],
                        "Spans": [],
                        "Tolls": [],
                        "TollSystems": [],
                        "TravelSteps": [
                            {
                                "Distance": 9099,
                                "Duration": 262,
                                "ExitNumber": [],
                                "GeometryOffset": 0,
                                "Type": "Depart"
                            },
                            {
                                "Distance": 18849,
                                "Duration": 800,
                                "ExitNumber": [],
                                "GeometryOffset": 162,
                                "KeepStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right"
                                },
                                "Type": "Keep"
                            },
                            {
                                "Distance": 4290,
                                "Duration": 212,
                                "ExitNumber": [],
                                "ExitStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right"
                                },
                                "GeometryOffset": 701,
                                "Type": "Exit"
                            },
                            {
                                "Distance": 12258,
                                "Duration": 554,
                                "ExitNumber": [],
                                "GeometryOffset": 828,
                                "Type": "Continue"
                            },
                            {
                                "Distance": 18567,
                                "Duration": 1218,
                                "ExitNumber": [],
                                "ExitStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right"
                                },
                                "GeometryOffset": 1282,
                                "Type": "Exit"
                            },
                            {
                                "Distance": 250,
                                "Duration": 28,
                                "ExitNumber": [],
                                "GeometryOffset": 1760,
                                "RampStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right"
                                },
                                "Type": "Ramp"
                            },
                            {
                                "Distance": 4856,
                                "Duration": 245,
                                "ExitNumber": [],
                                "GeometryOffset": 1793,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 3202,
                                "Duration": 165,
                                "ExitNumber": [],
                                "GeometryOffset": 1970,
                                "RoundaboutExitStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right"
                                },
                                "Type": "RoundaboutExit"
                            },
                            {
                                "Distance": 386,
                                "Duration": 51,
                                "ExitNumber": [],
                                "GeometryOffset": 2072,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 98,
                                "Duration": 15,
                                "ExitNumber": [],
                                "GeometryOffset": 2082,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 0,
                                "Duration": 0,
                                "ExitNumber": [],
                                "GeometryOffset": 2085,
                                "Type": "Arrive"
                            }
                        ],
                        "TruckRoadTypes": [],
                        "Zones": []
                    }
                }
            ],
            "MajorRoadLabels": [
                {
                    "RouteNumber": {
                        "Language": "de",
                        "Value": "A111"
                    }
                },
                {
                    "RouteNumber": {
                        "Language": "de",
                        "Value": "B96"
                    }
                }
            ]
        }
    ]
}
```

------
#### [ 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": [
    13.055211,
    52.704802
  ],
  "Destination": [
    13.551910,
    52.282705
  ],
  "TravelMode": "Car",
  "MaxAlternatives": 2
}'
```

------
#### [ AWS CLI ]

```
aws geo-routes calculate-routes --key ${YourKey} \
--origin 13.055211 52.704802 \
--destination 13.551910 52.282705 \
--travel-mode "Car" \
--max-alternatives 2
```

------

# How to calculate the tolls for a route
<a name="calculate-routes-tolls"></a>

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
<a name="potential-use-cases"></a>
+ **Calculate tolls:** Be able to calculate toll costs during route planning.
+ **Audit tolls:** Be able to audit toll costs after traveling.

## Examples
<a name="calculate-routes-tolls-examples"></a>

### Calculate tolls for your routes in Car TravelMode
<a name="calculate-routes-tolls"></a>

------
#### [ Sample request ]

```
{
    "Origin": [
        2.234491,
        48.815704
    ],
    "Destination": [
        5.11412,
        47.260723
    ],
    "TravelMode": "Car",
    "Tolls": {
        "AllTransponders": true,
        "AllVignettes": true
    }
}
```

------
#### [ Sample response ]

```
{
    "LegGeometryFormat": "FlexiblePolyline",
    "Notices": [],
    "Routes": [
        {
            "Legs": [
                {
                    "Geometry": {
                        "Polyline": "Redacted"
                    },
                    "TravelMode": "Car",
                    "Type": "Vehicle",
                    "VehicleLegDetails": {
                        "AfterTravelSteps": [],
                        "Arrival": {
                            "Place": {
                                "ChargingStation": false,
                                "OriginalPosition": [
                                    5.11412,
                                    47.2607229
                                ],
                                "Position": [
                                    5.1128203,
                                    47.2596356
                                ]
                            }
                        },
                        "Departure": {
                            "Place": {
                                "ChargingStation": false,
                                "OriginalPosition": [
                                    2.234491,
                                    48.8157039
                                ],
                                "Position": [
                                    2.2346482,
                                    48.815674
                                ]
                            }
                        },
                        "Incidents": [],
                        "Notices": [],
                        "PassThroughWaypoints": [],
                        "Spans": [],
                        "Tolls": [
                            {
                                "Country": "FRA",
                                "PaymentSites": [
                                    {
                                        "Name": "FLEURY-EN-BIERE",
                                        "Position": [
                                            2.53988,
                                            48.42578
                                        ]
                                    },
                                    {
                                        "Name": "POUILLY-EN-AUXOIS",
                                        "Position": [
                                            4.56112,
                                            47.25244
                                        ]
                                    }
                                ],
                                "Rates": [
                                    {
                                        "Id": "2d680295-fb0f-45aa-a8ed-79d9f0f9ff9f",
                                        "LocalPrice": {
                                            "Currency": "EUR",
                                            "Estimate": false,
                                            "Range": false,
                                            "Value": 21.700000762939453
                                        },
                                        "Name": "APRR",
                                        "PaymentMethods": [
                                            "Cash",
                                            "BankCard",
                                            "CreditCard",
                                            "Transponder",
                                            "TravelCard"
                                        ],
                                        "Transponders": [
                                            {
                                                "SystemName": "BipandGo"
                                            },
                                            {
                                                "SystemName": "BipandGo"
                                            },
                                            {
                                                "SystemName": "BipandGo IDVROOM carpoorling"
                                            },
                                            {
                                                "SystemName": "Cito30"
                                            },
                                            {
                                                "SystemName": "Easytrip pass"
                                            },
                                            {
                                                "SystemName": "Liane 30"
                                            },
                                            {
                                                "SystemName": "Liber-t"
                                            },
                                            {
                                                "SystemName": "Liber-t mobilitis"
                                            },
                                            {
                                                "SystemName": "Pass Pont-Pont"
                                            },
                                            {
                                                "SystemName": "Progressivi'T Maurienne"
                                            },
                                            {
                                                "SystemName": "TopEurop"
                                            },
                                            {
                                                "SystemName": "Tunnel Pass+"
                                            },
                                            {
                                                "SystemName": "Ulys"
                                            },
                                            {
                                                "SystemName": "Ulys Europe"
                                            },
                                            {
                                                "SystemName": "Viaduc-t 30"
                                            }
                                        ]
                                    }
                                ],
                                "Systems": [
                                    0
                                ]
                            }
                        ],
                        "TollSystems": [
                            {
                                "Name": "APRR"
                            }
                        ],
                        "TravelSteps": [
                            {
                                "Distance": 122,
                                "Duration": 21,
                                "ExitNumber": [],
                                "GeometryOffset": 0,
                                "Type": "Depart"
                            },
                            {
                                "Distance": 32,
                                "Duration": 7,
                                "ExitNumber": [],
                                "GeometryOffset": 7,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 74,
                                "Duration": 14,
                                "ExitNumber": [],
                                "GeometryOffset": 8,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 199,
                                "Duration": 33,
                                "ExitNumber": [],
                                "GeometryOffset": 9,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 21,
                                "Duration": 10,
                                "ExitNumber": [],
                                "GeometryOffset": 17,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 461,
                                "Duration": 63,
                                "ExitNumber": [],
                                "GeometryOffset": 20,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 1557,
                                "Duration": 145,
                                "ExitNumber": [],
                                "GeometryOffset": 41,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Left",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 3471,
                                "Duration": 151,
                                "ExitNumber": [],
                                "GeometryOffset": 135,
                                "RoundaboutExitStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right"
                                },
                                "Type": "RoundaboutExit"
                            },
                            {
                                "Distance": 9796,
                                "Duration": 430,
                                "ExitNumber": [],
                                "GeometryOffset": 242,
                                "RampStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right"
                                },
                                "Type": "Ramp"
                            },
                            {
                                "Distance": 2473,
                                "Duration": 112,
                                "ExitNumber": [],
                                "ExitStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right"
                                },
                                "GeometryOffset": 582,
                                "Type": "Exit"
                            },
                            {
                                "Distance": 674,
                                "Duration": 25,
                                "ExitNumber": [],
                                "GeometryOffset": 669,
                                "Type": "Continue"
                            },
                            {
                                "Distance": 253953,
                                "Duration": 7468,
                                "ExitNumber": [],
                                "GeometryOffset": 679,
                                "Type": "Continue"
                            },
                            {
                                "Distance": 37379,
                                "Duration": 1192,
                                "ExitNumber": [],
                                "ExitStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right"
                                },
                                "GeometryOffset": 5701,
                                "Type": "Exit"
                            },
                            {
                                "Distance": 2021,
                                "Duration": 110,
                                "ExitNumber": [],
                                "GeometryOffset": 6695,
                                "RoundaboutExitStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right"
                                },
                                "Type": "RoundaboutExit"
                            },
                            {
                                "Distance": 7380,
                                "Duration": 316,
                                "ExitNumber": [],
                                "GeometryOffset": 6776,
                                "RoundaboutPassStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right"
                                },
                                "Type": "RoundaboutPass"
                            },
                            {
                                "Distance": 4253,
                                "Duration": 156,
                                "ExitNumber": [],
                                "GeometryOffset": 6987,
                                "KeepStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Left"
                                },
                                "Type": "Keep"
                            },
                            {
                                "Distance": 813,
                                "Duration": 54,
                                "ExitNumber": [],
                                "GeometryOffset": 7081,
                                "RampStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right"
                                },
                                "Type": "Ramp"
                            },
                            {
                                "Distance": 1909,
                                "Duration": 109,
                                "ExitNumber": [],
                                "GeometryOffset": 7133,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Left",
                                    "TurnIntensity": "Sharp"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 827,
                                "Duration": 47,
                                "ExitNumber": [],
                                "GeometryOffset": 7182,
                                "Type": "Continue"
                            },
                            {
                                "Distance": 680,
                                "Duration": 41,
                                "ExitNumber": [],
                                "GeometryOffset": 7216,
                                "RoundaboutExitStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right"
                                },
                                "Type": "RoundaboutExit"
                            },
                            {
                                "Distance": 224,
                                "Duration": 12,
                                "ExitNumber": [],
                                "GeometryOffset": 7258,
                                "Type": "Continue"
                            },
                            {
                                "Distance": 25,
                                "Duration": 2,
                                "ExitNumber": [],
                                "GeometryOffset": 7265,
                                "Type": "Continue"
                            },
                            {
                                "Distance": 748,
                                "Duration": 51,
                                "ExitNumber": [],
                                "GeometryOffset": 7267,
                                "Type": "Continue"
                            },
                            {
                                "Distance": 656,
                                "Duration": 46,
                                "ExitNumber": [],
                                "GeometryOffset": 7299,
                                "RoundaboutExitStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right"
                                },
                                "Type": "RoundaboutExit"
                            },
                            {
                                "Distance": 1119,
                                "Duration": 78,
                                "ExitNumber": [],
                                "GeometryOffset": 7329,
                                "Type": "Continue"
                            },
                            {
                                "Distance": 432,
                                "Duration": 26,
                                "ExitNumber": [],
                                "GeometryOffset": 7383,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 1864,
                                "Duration": 100,
                                "ExitNumber": [],
                                "GeometryOffset": 7402,
                                "RoundaboutExitStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right"
                                },
                                "Type": "RoundaboutExit"
                            },
                            {
                                "Distance": 1110,
                                "Duration": 93,
                                "ExitNumber": [],
                                "GeometryOffset": 7470,
                                "RoundaboutExitStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right"
                                },
                                "Type": "RoundaboutExit"
                            },
                            {
                                "Distance": 232,
                                "Duration": 10,
                                "ExitNumber": [],
                                "GeometryOffset": 7563,
                                "Type": "Continue"
                            },
                            {
                                "Distance": 642,
                                "Duration": 29,
                                "ExitNumber": [],
                                "GeometryOffset": 7572,
                                "Type": "Continue"
                            },
                            {
                                "Distance": 357,
                                "Duration": 25,
                                "ExitNumber": [],
                                "GeometryOffset": 7580,
                                "Type": "Continue"
                            },
                            {
                                "Distance": 63,
                                "Duration": 10,
                                "ExitNumber": [],
                                "GeometryOffset": 7600,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 2626,
                                "Duration": 411,
                                "ExitNumber": [],
                                "GeometryOffset": 7602,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 234,
                                "Duration": 37,
                                "ExitNumber": [],
                                "GeometryOffset": 7627,
                                "Type": "Continue"
                            },
                            {
                                "Distance": 0,
                                "Duration": 0,
                                "ExitNumber": [],
                                "GeometryOffset": 7632,
                                "Type": "Arrive"
                            }
                        ],
                        "TruckRoadTypes": [],
                        "Zones": []
                    }
                }
            ],
            "MajorRoadLabels": [
                {
                    "RouteNumber": {
                        "Language": "fr",
                        "Value": "A6"
                    }
                }
            ]
        }
    ]
}
```

------
#### [ 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": [
    2.234491,
    48.815704
  ],
  "Destination": [
    5.11412,
    47.260723
  ],
  "TravelMode": "Car",
  "Tolls": {
    "AllTransponders": true,
    "AllVignettes": true
  }
}'
```

------
#### [ AWS CLI ]

```
aws geo-routes calculate-routes --key ${YourKey} \
--origin 13.055211 52.704802 \
--destination 13.551910 52.282705 \
--travel-mode "Car" \
--tolls '{"AllTransponders": true, "AllVignettes": true}'
```

------

# How to create routes with custom avoidance
<a name="calculate-routes-custom-avoidance-poly"></a>

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
<a name="potential-use-cases"></a>
+ **Calculate routes with custom avoidance:** Customize routes with avoidance for better routes and commute planning.

## Examples
<a name="calculate-routes-custom-avoidance-examples"></a>

### Use CalculateRoutes with an avoid BoundingBox to create custom routes.
<a name="calculate-routes-custom-avoidance-poly"></a>

------
#### [ Sample request ]

```
{
    "Origin": [
        -123.116655,
        49.281538
    ],
    "Destination": [
        -123.01791785749363,
        49.22782762759908
    ],
    "TravelMode": "Car",
    "Avoid": {
        "Areas": [
            {
                "Geometry": {
                    "BoundingBox": [
                        -123.078693,
                        49.238987,
                        -123.054638,
                        49.251694
                    ]
                }
            }
        ]
    }
}
```

------
#### [ Sample response ]

```
{
    "LegGeometryFormat": "FlexiblePolyline",
    "Notices": [],
    "Routes": [
        {
            "Legs": [
                {
                    "Geometry": {
                        "Polyline": "Redacted"
                    },
                    "TravelMode": "Car",
                    "Type": "Vehicle",
                    "VehicleLegDetails": {
                        "AfterTravelSteps": [],
                        "Arrival": {
                            "Place": {
                                "ChargingStation": false,
                                "OriginalPosition": [
                                    -123.0179179,
                                    49.2278276
                                ],
                                "Position": [
                                    -123.0229001,
                                    49.22883
                                ]
                            }
                        },
                        "Departure": {
                            "Place": {
                                "ChargingStation": false,
                                "OriginalPosition": [
                                    -123.116655,
                                    49.281538
                                ],
                                "Position": [
                                    -123.1166332,
                                    49.2815528
                                ]
                            }
                        },
                        "Incidents": [],
                        "Notices": [],
                        "PassThroughWaypoints": [],
                        "Spans": [],
                        "Tolls": [],
                        "TollSystems": [],
                        "TravelSteps": [
                            {
                                "Distance": 1144,
                                "Duration": 85,
                                "ExitNumber": [],
                                "GeometryOffset": 0,
                                "Type": "Depart"
                            },
                            {
                                "Distance": 262,
                                "Duration": 24,
                                "ExitNumber": [],
                                "GeometryOffset": 35,
                                "RampStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right"
                                },
                                "Type": "Ramp"
                            },
                            {
                                "Distance": 433,
                                "Duration": 47,
                                "ExitNumber": [],
                                "GeometryOffset": 40,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 1131,
                                "Duration": 81,
                                "ExitNumber": [],
                                "GeometryOffset": 54,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Left",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 54,
                                "Duration": 4,
                                "ExitNumber": [],
                                "GeometryOffset": 79,
                                "Type": "Continue"
                            },
                            {
                                "Distance": 520,
                                "Duration": 39,
                                "ExitNumber": [],
                                "GeometryOffset": 83,
                                "Type": "Continue"
                            },
                            {
                                "Distance": 1123,
                                "Duration": 111,
                                "ExitNumber": [],
                                "GeometryOffset": 101,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 1131,
                                "Duration": 81,
                                "ExitNumber": [],
                                "GeometryOffset": 141,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Left",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 2843,
                                "Duration": 209,
                                "ExitNumber": [],
                                "GeometryOffset": 167,
                                "Type": "Continue"
                            },
                            {
                                "Distance": 3219,
                                "Duration": 246,
                                "ExitNumber": [],
                                "GeometryOffset": 255,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 64,
                                "Duration": 23,
                                "ExitNumber": [],
                                "GeometryOffset": 332,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Left",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 0,
                                "Duration": 0,
                                "ExitNumber": [],
                                "GeometryOffset": 334,
                                "Type": "Arrive"
                            }
                        ],
                        "TruckRoadTypes": [],
                        "Zones": []
                    }
                }
            ],
            "MajorRoadLabels": [
                {
                    "RoadName": {
                        "Language": "en",
                        "Value": "Boundary Rd"
                    }
                },
                {
                    "RoadName": {
                        "Language": "en",
                        "Value": "Grandview Hwy"
                    }
                }
            ]
        }
    ]
}
```

------
#### [ 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.116655,
    49.281538
  ],
  "Destination": [
    -123.01791785749363,
    49.22782762759908
  ],
  "TravelMode": "Car",
  "Avoid": {
    "Areas": [
      {
        "Geometry": {
          "BoundingBox": [
            -123.078693,
            49.238987,
            -123.054638,
            49.251694
          ]
        }
      }
    ]
  }
}'
```

------
#### [ AWS CLI ]

```
aws geo-routes calculate-routes --key ${YourKey} \
--origin -123.13277 49.281538 \
--destination -123.01791785749363 49.22782762759908 \
--travel-mode "Car" \
--avoid '{"Areas":[{"Geometry":{"BoundingBox":[-123.054638,49.238987,-123.054638,49.251694]}}]}'
```

------

### Use CalculateRoutes with an avoid polygon to create custom routes.
<a name="calculate-routes-custom-avoidance-poly-polygon"></a>

------
#### [ Sample request ]

```
{
    "Origin": [
        -123.116655,
        49.281538
    ],
    "Destination": [
        -123.01791785749363,
        49.22782762759908
    ],
    "TravelMode": "Car",
    "Avoid": {
        "Areas": [
            {
                "Geometry": {
                    "polygon": [
                        [
                            [
                                -123.06953,
                                49.256419
                            ],
                            [
                                -123.080486,
                                49.242115
                            ],
                            [
                                -123.058573,
                                49.242115
                            ],
                            [
                                -123.06953,
                                49.256419
                            ]
                        ]
                    ]
                }
            }
        ]
    }
}
```

------
#### [ Sample response ]

```
{
    "LegGeometryFormat": "FlexiblePolyline",
    "Notices": [],
    "Routes": [
        {
            "Legs": [
                {
                    "Geometry": {
                        "Polyline": "Redacted"
                    },
                    "TravelMode": "Car",
                    "Type": "Vehicle",
                    "VehicleLegDetails": {
                        "AfterTravelSteps": [],
                        "Arrival": {
                            "Place": {
                                "ChargingStation": false,
                                "OriginalPosition": [
                                    -123.0179179,
                                    49.2278276
                                ],
                                "Position": [
                                    -123.0229001,
                                    49.22883
                                ]
                            }
                        },
                        "Departure": {
                            "Place": {
                                "ChargingStation": false,
                                "OriginalPosition": [
                                    -123.116655,
                                    49.281538
                                ],
                                "Position": [
                                    -123.1166332,
                                    49.2815528
                                ]
                            }
                        },
                        "Incidents": [],
                        "Notices": [],
                        "PassThroughWaypoints": [],
                        "Spans": [],
                        "Tolls": [],
                        "TollSystems": [],
                        "TravelSteps": [
                            {
                                "Distance": 1144,
                                "Duration": 85,
                                "ExitNumber": [],
                                "GeometryOffset": 0,
                                "Type": "Depart"
                            },
                            {
                                "Distance": 262,
                                "Duration": 24,
                                "ExitNumber": [],
                                "GeometryOffset": 35,
                                "RampStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right"
                                },
                                "Type": "Ramp"
                            },
                            {
                                "Distance": 433,
                                "Duration": 47,
                                "ExitNumber": [],
                                "GeometryOffset": 40,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 1131,
                                "Duration": 81,
                                "ExitNumber": [],
                                "GeometryOffset": 54,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Left",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 54,
                                "Duration": 4,
                                "ExitNumber": [],
                                "GeometryOffset": 79,
                                "Type": "Continue"
                            },
                            {
                                "Distance": 520,
                                "Duration": 39,
                                "ExitNumber": [],
                                "GeometryOffset": 83,
                                "Type": "Continue"
                            },
                            {
                                "Distance": 1123,
                                "Duration": 111,
                                "ExitNumber": [],
                                "GeometryOffset": 101,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 1131,
                                "Duration": 81,
                                "ExitNumber": [],
                                "GeometryOffset": 141,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Left",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 448,
                                "Duration": 34,
                                "ExitNumber": [],
                                "GeometryOffset": 167,
                                "Type": "Continue"
                            },
                            {
                                "Distance": 1797,
                                "Duration": 151,
                                "ExitNumber": [],
                                "GeometryOffset": 182,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 2836,
                                "Duration": 224,
                                "ExitNumber": [],
                                "GeometryOffset": 222,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Left",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 339,
                                "Duration": 30,
                                "ExitNumber": [],
                                "GeometryOffset": 326,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 64,
                                "Duration": 23,
                                "ExitNumber": [],
                                "GeometryOffset": 335,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Left",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 0,
                                "Duration": 0,
                                "ExitNumber": [],
                                "GeometryOffset": 337,
                                "Type": "Arrive"
                            }
                        ],
                        "TruckRoadTypes": [],
                        "Zones": []
                    }
                }
            ],
            "MajorRoadLabels": [
                {
                    "RouteNumber": {
                        "Language": "en",
                        "Value": "HWY-1A"
                    }
                },
                {
                    "RoadName": {
                        "Language": "en",
                        "Value": "Nanaimo St"
                    }
                }
            ]
        }
    ]
}
```

------
#### [ 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.116655,
    49.281538
  ],
  "Destination": [
    -123.01791785749363,
    49.22782762759908
  ],
  "TravelMode": "Car",
  "Avoid": {
    "Areas": [
      {
        "Geometry": {
          "polygon": [
            [
              [
                -123.06953,
                49.256419
              ],
              [
                -123.080486,
                49.242115
              ],
              [
                -123.058573,
                49.242115
              ],
              [
                -123.06953,
                49.256419
              ]
            ]
          ]
        }
      }
    ]
  }
}'
```

------
#### [ AWS CLI ]

```
aws geo-routes calculate-routes --key ${YourKey} \
--origin -123.13277 49.281538 \
--destination -123.01791785749363 49.22782762759908 \
--travel-mode "Car" \
--avoid '{"Areas":[{"Geometry":{"Polygon":[[[-123.06953,49.256419],[-123.05167,49.242115],[-123.02381,49.242115],[-123.06953,49.256419]]]}}]}'
```

------

### Use CalculateRoutes with PolylinePolygon to create custom routes.
<a name="calculate-routes-custom-avoidance-poly-polyline"></a>

------
#### [ Sample request ]

```
{
    "Origin": [
        -123.116655,
        49.281538
    ],
    "Destination": [
        -123.01791785749363,
        49.22782762759908
    ],
    "TravelMode": "Car",
    "Avoid": {
        "Areas": [
            {
                "Geometry": {
                    "PolylinePolygon": [
                        "BF0s0sJxglvXr5CvkCAgpEs5CvkC"
                    ]
                }
            }
        ]
    }
}
```

------
#### [ Sample response ]

```
{
    "LegGeometryFormat": "FlexiblePolyline",
    "Notices": [],
    "Routes": [
        {
            "Legs": [
                {
                    "Geometry": {
                        "Polyline": "Redacted"
                    },
                    "TravelMode": "Car",
                    "Type": "Vehicle",
                    "VehicleLegDetails": {
                        "AfterTravelSteps": [],
                        "Arrival": {
                            "Place": {
                                "ChargingStation": false,
                                "OriginalPosition": [
                                    -123.0179179,
                                    49.2278276
                                ],
                                "Position": [
                                    -123.0229001,
                                    49.22883
                                ]
                            }
                        },
                        "Departure": {
                            "Place": {
                                "ChargingStation": false,
                                "OriginalPosition": [
                                    -123.116655,
                                    49.281538
                                ],
                                "Position": [
                                    -123.1166332,
                                    49.2815528
                                ]
                            }
                        },
                        "Incidents": [],
                        "Notices": [],
                        "PassThroughWaypoints": [],
                        "Spans": [],
                        "Tolls": [],
                        "TollSystems": [],
                        "TravelSteps": [
                            {
                                "Distance": 1144,
                                "Duration": 85,
                                "ExitNumber": [],
                                "GeometryOffset": 0,
                                "Type": "Depart"
                            },
                            {
                                "Distance": 262,
                                "Duration": 24,
                                "ExitNumber": [],
                                "GeometryOffset": 35,
                                "RampStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right"
                                },
                                "Type": "Ramp"
                            },
                            {
                                "Distance": 433,
                                "Duration": 47,
                                "ExitNumber": [],
                                "GeometryOffset": 40,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 1131,
                                "Duration": 81,
                                "ExitNumber": [],
                                "GeometryOffset": 54,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Left",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 54,
                                "Duration": 4,
                                "ExitNumber": [],
                                "GeometryOffset": 79,
                                "Type": "Continue"
                            },
                            {
                                "Distance": 520,
                                "Duration": 39,
                                "ExitNumber": [],
                                "GeometryOffset": 83,
                                "Type": "Continue"
                            },
                            {
                                "Distance": 1123,
                                "Duration": 111,
                                "ExitNumber": [],
                                "GeometryOffset": 101,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 1131,
                                "Duration": 81,
                                "ExitNumber": [],
                                "GeometryOffset": 141,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Left",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 448,
                                "Duration": 34,
                                "ExitNumber": [],
                                "GeometryOffset": 167,
                                "Type": "Continue"
                            },
                            {
                                "Distance": 1797,
                                "Duration": 151,
                                "ExitNumber": [],
                                "GeometryOffset": 182,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 2836,
                                "Duration": 224,
                                "ExitNumber": [],
                                "GeometryOffset": 222,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Left",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 339,
                                "Duration": 30,
                                "ExitNumber": [],
                                "GeometryOffset": 326,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 64,
                                "Duration": 23,
                                "ExitNumber": [],
                                "GeometryOffset": 335,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Left",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 0,
                                "Duration": 0,
                                "ExitNumber": [],
                                "GeometryOffset": 337,
                                "Type": "Arrive"
                            }
                        ],
                        "TruckRoadTypes": [],
                        "Zones": []
                    }
                }
            ],
            "MajorRoadLabels": [
                {
                    "RouteNumber": {
                        "Language": "en",
                        "Value": "HWY-1A"
                    }
                },
                {
                    "RoadName": {
                        "Language": "en",
                        "Value": "Nanaimo St"
                    }
                }
            ]
        }
    ]
}
```

------
#### [ 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.116655,
    49.281538
  ],
  "Destination": [
    -123.01791785749363,
    49.22782762759908
  ],
  "TravelMode": "Car",
  "Avoid": {
    "Areas": [
      {
        "Geometry": {
          "PolylinePolygon": [
            "BF0s0sJxglvXr5CvkCAgpEs5CvkC"
          ]
        }
      }
    ]
  }
}'
```

------
#### [ AWS CLI ]

```
aws geo-routes calculate-routes --key ${YourKey} \
--origin -123.13277 49.281538 \
--destination -123.01791785749363 49.22782762759908 \
--travel-mode "Car" \
--avoid '{"Areas":[{"Geometry":{"PolylinePolygon":["BF0s0sJxglvXr5CvkCAgpEs5CvkC"]}}]}'
```

------

### Use CalculateRoutes with avoid Corridor to create custom routes.
<a name="calculate-routes-custom-avoidance-corridor"></a>

------
#### [ Sample request ]

```
{
    "Origin": [
        -123.116655,
        49.281538
    ],
    "Destination": [
        -123.01791785749363,
        49.22782762759908
    ],
    "TravelMode": "Car",
    "Avoid": {
        "Areas": [
            {
                "Geometry": {
                    "PolylineCorridor": {
                        "Polyline": "Redacted",
                        "Radius": 10
                    }
                }
            }
        ]
    }
}
```

------
#### [ Sample response ]

```
{
    "LegGeometryFormat": "FlexiblePolyline",
    "Notices": [],
    "Routes": [
        {
            "Legs": [
                {
                    "Geometry": {
                        "Polyline": "Redacted"
                    },
                    "TravelMode": "Car",
                    "Type": "Vehicle",
                    "VehicleLegDetails": {
                        "AfterTravelSteps": [],
                        "Arrival": {
                            "Place": {
                                "ChargingStation": false,
                                "OriginalPosition": [
                                    -123.0179179,
                                    49.2278276
                                ],
                                "Position": [
                                    -123.0229001,
                                    49.22883
                                ]
                            }
                        },
                        "Departure": {
                            "Place": {
                                "ChargingStation": false,
                                "OriginalPosition": [
                                    -123.116655,
                                    49.281538
                                ],
                                "Position": [
                                    -123.1166332,
                                    49.2815528
                                ]
                            }
                        },
                        "Incidents": [],
                        "Notices": [],
                        "PassThroughWaypoints": [],
                        "Spans": [],
                        "Tolls": [],
                        "TollSystems": [],
                        "TravelSteps": [
                            {
                                "Distance": 1144,
                                "Duration": 85,
                                "ExitNumber": [],
                                "GeometryOffset": 0,
                                "Type": "Depart"
                            },
                            {
                                "Distance": 262,
                                "Duration": 24,
                                "ExitNumber": [],
                                "GeometryOffset": 35,
                                "RampStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right"
                                },
                                "Type": "Ramp"
                            },
                            {
                                "Distance": 1356,
                                "Duration": 134,
                                "ExitNumber": [],
                                "GeometryOffset": 40,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 2468,
                                "Duration": 204,
                                "ExitNumber": [],
                                "GeometryOffset": 90,
                                "KeepStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Left"
                                },
                                "Type": "Keep"
                            },
                            {
                                "Distance": 1100,
                                "Duration": 88,
                                "ExitNumber": [],
                                "GeometryOffset": 170,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 1588,
                                "Duration": 133,
                                "ExitNumber": [],
                                "GeometryOffset": 214,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Left",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 47,
                                "Duration": 14,
                                "ExitNumber": [],
                                "GeometryOffset": 260,
                                "Type": "Continue"
                            },
                            {
                                "Distance": 2478,
                                "Duration": 196,
                                "ExitNumber": [],
                                "GeometryOffset": 265,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 339,
                                "Duration": 30,
                                "ExitNumber": [],
                                "GeometryOffset": 357,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 64,
                                "Duration": 23,
                                "ExitNumber": [],
                                "GeometryOffset": 366,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Left",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 0,
                                "Duration": 0,
                                "ExitNumber": [],
                                "GeometryOffset": 368,
                                "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.116655,
    49.281538
  ],
  "Destination": [
    -123.01791785749363,
    49.22782762759908
  ],
  "TravelMode": "Car",
  "Avoid": {
    "Areas": [
      {
        "Geometry": {
          "PolylineCorridor": {
            "Polyline": "Redacted",
            "Radius": 10
          }
        }
      }
    ]
  }
}'
```

------
#### [ AWS CLI ]

```
aws geo-routes calculate-routes --key ${YourKey} \
--origin -123.116655 49.281538 \
--destination -123.01791785749363 49.22782762759908 \
--travel-mode "Car" \
--avoid '{"Areas": [{"Geometry": {"PolylineCorridor": {"Polyline": "BF2mysJnmkvX5ekiC", "Radius": 10}}}]}'
```

------

### Use CalculateRoutes with an avoid PolylineCorridor to create custom routes.
<a name="calculate-routes-custom-avoidance-polyline-corridor"></a>

------
#### [ Sample request ]

```
{
    "Origin": [
        -123.116655,
        49.281538
    ],
    "Destination": [
        -123.01791785749363,
        49.22782762759908
    ],
    "TravelMode": "Car",
    "Avoid": {
        "Areas": [
            {
                "Geometry": {
                    "Corridor": {
                        "LineString": [
                            [
                                -123.06532243038754,
                                49.245226301868776
                            ],
                            [
                                -123.0547357660333,
                                49.24030469850804
                            ]
                        ],
                        "Radius": 10
                    }
                }
            }
        ]
    }
}
```

------
#### [ Sample response ]

```
{
    "LegGeometryFormat": "FlexiblePolyline",
    "Notices": [],
    "Routes": [
        {
            "Legs": [
                {
                    "Geometry": {
                        "Polyline": "Redacted"
                    },
                    "TravelMode": "Car",
                    "Type": "Vehicle",
                    "VehicleLegDetails": {
                        "AfterTravelSteps": [],
                        "Arrival": {
                            "Place": {
                                "ChargingStation": false,
                                "OriginalPosition": [
                                    -123.0179179,
                                    49.2278276
                                ],
                                "Position": [
                                    -123.0229001,
                                    49.22883
                                ]
                            }
                        },
                        "Departure": {
                            "Place": {
                                "ChargingStation": false,
                                "OriginalPosition": [
                                    -123.116655,
                                    49.281538
                                ],
                                "Position": [
                                    -123.1166332,
                                    49.2815528
                                ]
                            }
                        },
                        "Incidents": [],
                        "Notices": [],
                        "PassThroughWaypoints": [],
                        "Spans": [],
                        "Tolls": [],
                        "TollSystems": [],
                        "TravelSteps": [
                            {
                                "Distance": 1144,
                                "Duration": 85,
                                "ExitNumber": [],
                                "GeometryOffset": 0,
                                "Type": "Depart"
                            },
                            {
                                "Distance": 262,
                                "Duration": 24,
                                "ExitNumber": [],
                                "GeometryOffset": 35,
                                "RampStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right"
                                },
                                "Type": "Ramp"
                            },
                            {
                                "Distance": 1356,
                                "Duration": 134,
                                "ExitNumber": [],
                                "GeometryOffset": 40,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 2468,
                                "Duration": 204,
                                "ExitNumber": [],
                                "GeometryOffset": 90,
                                "KeepStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Left"
                                },
                                "Type": "Keep"
                            },
                            {
                                "Distance": 1100,
                                "Duration": 88,
                                "ExitNumber": [],
                                "GeometryOffset": 170,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 1588,
                                "Duration": 133,
                                "ExitNumber": [],
                                "GeometryOffset": 214,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Left",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 47,
                                "Duration": 14,
                                "ExitNumber": [],
                                "GeometryOffset": 260,
                                "Type": "Continue"
                            },
                            {
                                "Distance": 2478,
                                "Duration": 196,
                                "ExitNumber": [],
                                "GeometryOffset": 265,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 339,
                                "Duration": 30,
                                "ExitNumber": [],
                                "GeometryOffset": 357,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Right",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 64,
                                "Duration": 23,
                                "ExitNumber": [],
                                "GeometryOffset": 366,
                                "TurnStepDetails": {
                                    "Intersection": [],
                                    "SteeringDirection": "Left",
                                    "TurnIntensity": "Typical"
                                },
                                "Type": "Turn"
                            },
                            {
                                "Distance": 0,
                                "Duration": 0,
                                "ExitNumber": [],
                                "GeometryOffset": 368,
                                "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.116655,
    49.281538
  ],
  "Destination": [
    -123.01791785749363,
    49.22782762759908
  ],
  "TravelMode": "Car",
  "Avoid": {
    "Areas": [
      {
        "Geometry": {
          "Corridor": {
            "LineString": [
              [
                -123.06532243038754,
                49.245226301868776
              ],
              [
                -123.0547357660333,
                49.24030469850804
              ]
            ],
            "Radius": 10
          }
        }
      }
    ]
  }
}'
```

------
#### [ AWS CLI ]

```
aws geo-routes calculate-routes --key ${YourKey} \
--origin -123.13277 49.281538 \
--destination -123.01791785749363 49.22782762759908 \
--travel-mode "Car" \
--avoid '{"Areas":[{"Geometry":{"Corridor":{"LineString":[[-123.06532243038754,49.245226301868776],[-123.0547357660333,49.24030469850804]],"Radius":10}}}]}'
```

------

# How to create routes with custom avoidance of several potential items
<a name="calculate-routes-custom-avoidance-multiple"></a>

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
<a name="potential-use-cases"></a>
+ **Calculate routes with custom avoidance:** Customize routes with avoidance for better routes and commute planning.

## Examples
<a name="calculate-routes-examples"></a>

### Use CalculateRoutes with avoidance of tolls, u-turns, ferries, highways, tunnels and more.
<a name="calculate-routes-custom-avoidance-tolls-ferries"></a>

------
#### [ 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}'
```

------

# How to find the fastest route
<a name="calculate-routes-custom-avoidance-fast"></a>

The CalculateRoutes API helps you to find the fastest routes between origin and destination.

## Potential use cases
<a name="calculate-routes-fast-potential-use"></a>
+ **Optimize routes for time efficiency:** Improve delivery operations by calculating the fastest route. This is useful for reducing travel time in logistics and delivery services.

## Examples
<a name="calculate-routes-fast-examples"></a>

### Calculate the fastest route
<a name="calculate-routes-fast-car"></a>

------
#### [ Sample request ]

```
{
    "Origin": [
        -123.118105,
        49.282423
    ],
    "Destination": [
        -123.020098,
        49.232872
    ],
    "TravelMode": "Car",
    "OptimizeRoutingFor": "FastestRoute"
}
```

------
#### [ 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",
  "OptimizeRoutingFor": "FastestRoute"
}'
```

------
#### [ AWS CLI ]

```
aws geo-routes calculate-routes --key ${YourKey} \
--origin -123.118105 49.282423 \
--destination -123.020098 49.232872 \
--travel-mode "Car" \
--optimize-routing-for "FastestRoute"
```

------

# How to find the shortest routes
<a name="calculate-routes-custom-avoidance-shortest"></a>

The CalculateRoutes API helps you to find the shortest routes between origin and destination.

## Potential use cases
<a name="calculate-routes-short-potential-use"></a>
+ **Optimize routes for time efficiency:** Improve delivery operations by calculating the shortest route. This is useful for reducing travel distance in logistics and delivery services.

## Examples
<a name="calculate-routes-short-examples"></a>

### Use CalculateRoutes to find the shortest route and save on travel distance.
<a name="calculate-routes-shortest"></a>

------
#### [ Sample request ]

```
{
    "Origin": [
        -123.118105,
        49.282423
    ],
    "Destination": [
        -123.020098,
        49.232872
    ],
    "TravelMode": "Car",
    "OptimizeRoutingFor": "ShortestRoute"
}
```

------
#### [ 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",
    "OptimizeRoutingFor": "ShortestRoute"
}'
```

------
#### [ AWS CLI ]

```
aws geo-routes calculate-routes --key ${YourKey} \
--origin -123.118105 49.282423 \
--destination -123.020098 49.232872 \
--travel-mode "Scooter" \
--optimize-routing-for "ShortestRoute"
```

------

# Learn how to use CalculateIsolines
<a name="calculate-isolines-how-to"></a>

In this section you learn how to use `CalculateIsolines` with ranges of time or distance, as well as to set areas to avoid.

**Topics**
+ [How to calculate a service area based on ranges of time](calculate-service-area-based-on-time.md)
+ [How to calculate a service area based on ranges of distance](calculate-service-area-based-on-distance.md)
+ [How to calculate a service area based on avoidance](calculate-service-area-based-on-avoidance.md)

# How to calculate a service area based on ranges of time
<a name="calculate-service-area-based-on-time"></a>

The CalculateIsolines API allows you to determine reachable service areas within specified ranges of time or distance, factoring in road networks and traffic conditions. This capability supports applications in defining service areas for restaurants, grocery stores, or other service providers which can assist in planning fuel efficiency and defining accessible areas for service coverage.

## Potential use cases
<a name="calculate-service-area-time-potential-use"></a>
+ **Plan service areas:** Use this API to plan accessible areas for services like restaurants or grocery delivery based on travel time or distance.

## Examples
<a name="calculate-service-area-time-examples"></a>

### Calculate a service area based on a time range with Car TravelMode
<a name="calculate-service-area-time"></a>

------
#### [ Sample request ]

```
{
    "Origin": [
        -123.11679620827039,
        49.28147612192166
    ],
    "DepartureTime": "2024-10-28T21:27:56Z",
    "Thresholds": {
        "Time": [
            500,
            1000,
            1500
        ]
    },
    "TravelMode": "Car"
}
```

------
#### [ Sample response ]

```
{
    "DepartureTime": "2024-10-28T14:27:56-07:00",
    "IsolineGeometryFormat": "FlexiblePolyline",
    "Isolines": [
        {
            "Connections": [],
            "Geometries": [
                {
                    "PolylinePolygon": [
                        "Redacted"
                    ]
                }
            ],
            "TimeThreshold": 500
        },
        {
            "Connections": [],
            "Geometries": [
                {
                    "PolylinePolygon": [
                        "Redacted"
                    ]
                }
            ],
            "TimeThreshold": 1000
        },
        {
            "Connections": [],
            "Geometries": [
                {
                    "PolylinePolygon": [
                        "Redacted"
                    ]
                }
            ],
            "TimeThreshold": 1500
        }
    ],
    "SnappedOrigin": [
        -123.11687,
        49.2813999
    ]
}
```

------
#### [ cURL ]

```
curl --request POST \
  --url 'https://routes.geo.eu-central-1.amazonaws.com/v2/isolines?key=Your_key' \
  --header 'Content-Type: application/json' \
  --data '{
    "Origin": [
        -123.11679620827039,
        49.28147612192166
    ],
    "DepartureTime": "2024-10-28T21:27:56Z",
    "Thresholds": {
        "Time": [
            500,
            1000,
            1500
        ]
    },
    "TravelMode": "Car"
}'
```

------
#### [ AWS CLI ]

```
aws geo-routes calculate-isolines --key ${YourKey} \
--origin -123.11679620827039 49.28147612192166 \
--departure-time "2024-10-28T21:27:56Z" \
--thresholds '{"Time": [500, 1000, 1500]}' \
--travel-mode "Car"
```

------

# How to calculate a service area based on ranges of distance
<a name="calculate-service-area-based-on-distance"></a>

The CalculateIsolines API allows you to determine reachable service areas within specified ranges of time or distance, factoring in road networks and traffic conditions. This capability supports applications in defining service areas for restaurants, grocery stores, or other service providers which can assist in planning fuel efficiency and defining accessible areas for service coverage.

## Potential use cases
<a name="calculate-service-area-distance-potential-use"></a>
+ **Plan service areas:** Use this API to plan accessible areas for services like restaurants or grocery delivery based on travel time or distance.

## Examples
<a name="calculate-service-area-distance-examples"></a>

### Calculate a service area based on ranges of distance with Car TravelMode
<a name="calculate-service-area-distance"></a>

------
#### [ Sample request ]

```
{
    "Origin": [
        -123.11679620827039,
        49.28147612192166
    ],
    "DepartureTime": "2024-10-28T21:27:56Z",
    "Thresholds": {
        "Distance": [
            1000,
            2000,
            3000
        ]
    },
    "TravelMode": "Car"
}
```

------
#### [ Sample response ]

```
{
    "DepartureTime": "2024-10-28T14:27:56-07:00",
    "IsolineGeometryFormat": "FlexiblePolyline",
    "Isolines": [
        {
            "Connections": [],
            "DistanceThreshold": 1000,
            "Geometries": [
                {
                    "PolylinePolygon": [
                        "Redacted"
                    ]
                }
            ]
        },
        {
            "Connections": [],
            "DistanceThreshold": 2000,
            "Geometries": [
                {
                    "PolylinePolygon": [
                        "Redacted"
                    ]
                }
            ]
        },
        {
            "Connections": [],
            "DistanceThreshold": 3000,
            "Geometries": [
                {
                    "PolylinePolygon": [
                        "Redacted"
                    ]
                }
            ]
        }
    ],
    "SnappedOrigin": [
        -123.11687,
        49.2813999
    ]
}
```

------
#### [ cURL ]

```
curl --request POST \
  --url 'https://routes.geo.eu-central-1.amazonaws.com/v2/isolines?key=Your_key' \
  --header 'Content-Type: application/json' \
  --data '{
    "Origin": [
        -123.11679620827039,
        49.28147612192166
    ],
    "DepartureTime": "2024-10-28T21:27:56Z",
    "Thresholds": {
        "Distance": [
            1000,
            2000,
            3000
        ]
    },
    "TravelMode": "Car"
}'
```

------
#### [ AWS CLI ]

```
aws geo-routes calculate-isolines --key ${YourKey} \
--origin -123.11679620827039 49.28147612192166 \
--departure-time "2024-10-28T21:27:56Z" \
--thresholds '{"Distance": [1000, 2000, 3000]}' \
--travel-mode "Car"
```

------

# How to calculate a service area based on avoidance
<a name="calculate-service-area-based-on-avoidance"></a>

The CalculateIsolines API allows you to determine reachable service areas within specified ranges of time or distance, factoring in road networks and traffic conditions to avoid. This capability supports applications in defining service areas for restaurants, grocery stores, or other service providers which can assist in planning fuel efficiency and defining accessible areas for service coverage.

## Potential use cases
<a name="calculate-service-area-avoidance-potential-use"></a>
+ **Plan service areas:** Use this API to plan accessible areas for services like restaurants or grocery delivery based on avoidance.

## Examples
<a name="calculate-service-area-avoidance-examples"></a>

### Calculate a service area based on avoidance with Car TravelMode
<a name="calculate-service-area-avoidance-car"></a>

------
#### [ Sample request ]

```
{
    "Origin": [
        -123.11679620827039,
        49.28147612192166
    ],
    "DepartureTime": "2024-10-28T21:27:56Z",
    "Thresholds": {
        "Distance": [
            4000
        ]
    },
    "Avoid": {
        "TollRoads": true,
        "UTurns": true,
        "ControlledAccessHighways": true,
        "Ferries": true,
        "DirtRoads": true,
        "SeasonalClosure": true,
        "CarShuttleTrains": true,
        "TollTransponders": true,
        "ZoneCategories": [
            {
                "Category": "Environmental"
            }
        ]
    },
    "TravelMode": "Car"
}
```

------
#### [ Sample response ]

```
{
    "DepartureTime": "2024-10-28T14:27:56-07:00",
    "IsolineGeometryFormat": "FlexiblePolyline",
    "Isolines": [
        {
            "Connections": [],
            "DistanceThreshold": 4000,
            "Geometries": [
                {
                    "PolylinePolygon": [
                        "Redacted"
                    ]
                }
            ]
        }
    ],
    "SnappedOrigin": [
        -123.11687,
        49.2813999
    ]
}
```

------
#### [ cURL ]

```
curl --request POST \
  --url 'https://routes.geo.eu-central-1.amazonaws.com/v2/isolines?key=Your_key' \
  --header 'Content-Type: application/json' \
  --data '{
    "Origin": [
        -123.11679620827039,
        49.28147612192166
    ],
    "DepartureTime": "2024-10-28T21:27:56Z",
    "Thresholds": {
        "Distance": [
            4000
        ]
    },
    "Avoid": {
        "TollRoads": true,
        "UTurns": true,
        "ControlledAccessHighways": true,
        "Ferries": true,
        "DirtRoads": true,
        "SeasonalClosure": true,
        "CarShuttleTrains": true,
        "TollTransponders": true,
        "ZoneCategories": [
            {
                "Category": "Environmental"
            }
        ]
    },
    "TravelMode": "Car"
}'
```

------
#### [ AWS CLI ]

```
aws geo-routes calculate-isolines --key ${YourKey} \
--origin -123.11679620827039 49.28147612192166 \
--departure-time "2024-10-28T21:27:56Z" \
--thresholds '{"Distance": [4000]}' \
--avoid '{"TollRoads": true, "UTurns": true, "ControlledAccessHighways": true, "Ferries": true, "DirtRoads": true, "SeasonalClosure": true, "CarShuttleTrains": true, "TollTransponders": true, "ZoneCategories": [{"Category": "Environmental"}]}' \
--travel-mode "Car"
```

------

### Calculate a service area based on avoidance with Truck TravelMode
<a name="calculate-service-area-avoidance-truck"></a>

------
#### [ Sample request ]

```
{
    "Origin": [
        -123.11679620827039,
        49.28147612192166
    ],
    "DepartureTime": "2024-10-28T21:27:56Z",
    "Thresholds": {
        "Distance": [
            4000
        ]
    },
    "Avoid": {
        "TollRoads": true,
        "UTurns": true,
        "ControlledAccessHighways": true,
        "Ferries": true,
        "DirtRoads": true,
        "SeasonalClosure": true,
        "CarShuttleTrains": true,
        "TollTransponders": true,
        "ZoneCategories": [
            {
                "Category": "Environmental"
            }
        ]
    },
    "TravelMode": "Truck"
}
```

------
#### [ Sample response ]

```
{
    "DepartureTime": "2024-10-28T14:27:56-07:00",
    "IsolineGeometryFormat": "FlexiblePolyline",
    "Isolines": [
        {
            "Connections": [],
            "DistanceThreshold": 4000,
            "Geometries": [
                {
                    "PolylinePolygon": [
                        "Redacted"
                    ]
                }
            ]
        }
    ],
    "SnappedOrigin": [
        -123.11687,
        49.2813999
    ]
}
```

------
#### [ cURL ]

```
curl --request POST \
  --url 'https://routes.geo.eu-central-1.amazonaws.com/v2/isolines?key=Your_key' \
  --header 'Content-Type: application/json' \
  --data '{
    "Origin": [
        -123.11679620827039,
        49.28147612192166
    ],
    "DepartureTime": "2024-10-28T21:27:56Z",
    "Thresholds": {
        "Distance": [
            4000
        ]
    },
    "Avoid": {
        "TollRoads": true,
        "UTurns": true,
        "ControlledAccessHighways": true,
        "Ferries": true,
        "DirtRoads": true,
        "SeasonalClosure": true,
        "CarShuttleTrains": true,
        "TollTransponders": true,
        "ZoneCategories": [
            {
                "Category": "Environmental"
            }
        ]
    },
    "TravelMode": "Truck"
}'
```

------
#### [ AWS CLI ]

```
aws geo-routes calculate-isolines --key ${YourKey} \
--origin -123.11679620827039 49.28147612192166 \
--departure-time "2024-10-28T21:27:56Z" \
--thresholds '{"Distance": [4000]}' \
--avoid '{"TollRoads": true, "UTurns": true, "ControlledAccessHighways": true, "Ferries": true, "DirtRoads": true, "SeasonalClosure": true, "CarShuttleTrains": true, "TollTransponders": true, "ZoneCategories": [{"Category": "Environmental"}]}' \
--travel-mode "Truck"
```

------

### Calculate a service area based on avoidance for pedestrians
<a name="calculate-service-area-avoidance-truck"></a>

------
#### [ Sample request ]

```
{
    "Origin": [
        -123.11679620827039,
        49.28147612192166
    ],
    "DepartureTime": "2024-10-28T21:27:56Z",
    "Thresholds": {
        "Distance": [
            4000
        ]
    },
    "Avoid": {
        "TollRoads": true,
        "ControlledAccessHighways": true,
        "Ferries": true,
        "DirtRoads": true,
        "SeasonalClosure": true,
        "CarShuttleTrains": true,
        "TollTransponders": true,
        "ZoneCategories": [
            {
                "Category": "Environmental"
            }
        ]
    },
    "TravelMode": "Pedestrian"
}
```

------
#### [ Sample response ]

```
{
    "DepartureTime": "2024-10-28T14:27:56-07:00",
    "IsolineGeometryFormat": "FlexiblePolyline",
    "Isolines": [
        {
            "Connections": [],
            "DistanceThreshold": 4000,
            "Geometries": [
                {
                    "PolylinePolygon": [
                        "Redacted"
                    ]
                }
            ]
        }
    ],
    "SnappedOrigin": [
        -123.11687,
        49.2813999
    ]
}
```

------
#### [ cURL ]

```
curl --request POST \
  --url 'https://routes.geo.eu-central-1.amazonaws.com/v2/isolines?key=Your_key' \
  --header 'Content-Type: application/json' \
  --data '{
    "Origin": [
        -123.11679620827039,
        49.28147612192166
    ],
    "DepartureTime": "2024-10-28T21:27:56Z",
    "Thresholds": {
        "Distance": [
            4000
        ]
    },
    "Avoid": {
        "TollRoads": true,
        "ControlledAccessHighways": true,
        "Ferries": true,
        "DirtRoads": true,
        "SeasonalClosure": true,
        "CarShuttleTrains": true,
        "TollTransponders": true,
        "ZoneCategories": [
            {
                "Category": "Environmental"
            }
        ]
    },
    "TravelMode": "Pedestrian"
}'
```

------
#### [ AWS CLI ]

```
aws geo-routes calculate-isolines --key ${YourKey} \
--origin -123.11679620827039 49.28147612192166 \
--departure-time "2024-10-28T21:27:56Z" \
--thresholds '{"Distance": [4000]}' \
--avoid '{"TollRoads": true, "ControlledAccessHighways": true, "Ferries": true, "DirtRoads": true, "SeasonalClosure": true, "CarShuttleTrains": true, "TollTransponders": true, "ZoneCategories": [{"Category": "Environmental"}]}' \
--travel-mode "Pedestrian"
```

------

### Calculate a service area based on avoidance with Scooter TravelMode
<a name="calculate-service-area-avoidance-scooter"></a>

------
#### [ Sample request ]

```
{
    "Origin": [
        -123.11679620827039,
        49.28147612192166
    ],
    "DepartureTime": "2024-10-28T21:27:56Z",
    "Thresholds": {
        "Distance": [
            4000
        ]
    },
    "Avoid": {
        "TollRoads": true,
        "ControlledAccessHighways": true,
        "DifficultTurns": false,
        "Ferries": true,
        "DirtRoads": true,
        "SeasonalClosure": true,
        "CarShuttleTrains": true,
        "TollTransponders": true,
        "ZoneCategories": [
            {
                "Category": "Environmental"
            }
        ]
    },
    "TravelMode": "Scooter"
}
```

------
#### [ Sample response ]

```
{
    "DepartureTime": "2024-10-28T14:27:56-07:00",
    "IsolineGeometryFormat": "FlexiblePolyline",
    "Isolines": [
        {
            "Connections": [],
            "DistanceThreshold": 4000,
            "Geometries": [
                {
                    "PolylinePolygon": [
                        "Redacted"
                    ]
                }
            ]
        }
    ],
    "SnappedOrigin": [
        -123.11687,
        49.2813999
    ]
}
```

------
#### [ cURL ]

```
curl --request POST \
  --url 'https://routes.geo.eu-central-1.amazonaws.com/v2/isolines?key=Your_key' \
  --header 'Content-Type: application/json' \
  --data '{
    "Origin": [
        -123.11679620827039,
        49.28147612192166
    ],
    "DepartureTime": "2024-10-28T21:27:56Z",
    "Thresholds": {
        "Distance": [
            4000
        ]
    },
    "Avoid": {
        "TollRoads": true,
        "ControlledAccessHighways": true,
        "Ferries": true,
        "DirtRoads": true,
        "SeasonalClosure": true,
        "CarShuttleTrains": true,
        "TollTransponders": true,
        "ZoneCategories": [
            {
                "Category": "Environmental"
            }
        ]
    },
    "TravelMode": "Scooter"
}'
```

------
#### [ AWS CLI ]

```
aws geo-routes calculate-isolines --key ${YourKey} \
--origin -123.11679620827039 49.28147612192166 \
--departure-time "2024-10-28T21:27:56Z" \
--thresholds '{"Distance": [4000]}' \
--avoid '{"TollRoads": true, "ControlledAccessHighways": true, "Ferries": true, "DirtRoads": true, "SeasonalClosure": true, "CarShuttleTrains": true, "TollTransponders": true, "ZoneCategories": [{"Category": "Environmental"}]}' \
--travel-mode "Scooter"
```

------

# Learn how to use CalculateRouteMatrix
<a name="calculate-route-matrix-how-to"></a>

In this section you learn how to use `CalculateRouteMatrix` to find efficient routes for multiple origins and destinations.

**Topics**
+ [How to calculate a route matrix of distance and time for multiple origins and destinations](calculate-route-matrix-distance.md)
+ [How to calculate route matrix with avoidance](calculate-route-matrix-with-avoidance.md)

# How to calculate a route matrix of distance and time for multiple origins and destinations
<a name="calculate-route-matrix-distance"></a>

The CalculateRouteMatrix API calculates routes and provides travel time and travel distance for each combination of origins and destinations. This capability is useful for applications requiring route planning and optimization across multiple locations.

The response includes `Distance` in meters and `Duration` in seconds for each origin-destination pair.

## Potential use cases
<a name="calculate-route-matrix-potential-use"></a>
+ **Optimize route planning:** Use the route matrix as input for route optimization software to enhance service efficiency and reduce travel time.

## Examples
<a name="calculate-route-matrix-examples"></a>

### CalculateRouteMatrix with an unbounded routing boundary
<a name="calculate-route-matrix-unbounded"></a>

------
#### [ Sample request ]

```
{
    "Origins": [
        {
            "Position": [-123.11679620827039, 49.28147612192166]
        },
        {
            "Position": [-123.11179620827039, 49.3014761219]
        }
    ],
    "Destinations": [
        {
            "Position": [-123.112317039, 49.28897192166]
        }
    ],
    "DepartureTime": "2024-05-28T21:27:56Z",
    "RoutingBoundary": {
        "Unbounded": true
    }
}
```

------
#### [ Sample response ]

```
{
    "ErrorCount": 0,
    "RouteMatrix": [
        [
            {
                "Distance": 1907,
                "Duration": 343
            }
        ],
        [
            {
                "Distance": 5629,
                "Duration": 954
            }
        ]
    ],
    "RoutingBoundary": {
        "Unbounded": true
    }
}
```

------
#### [ cURL ]

```
curl --request POST \
  --url 'https://routes.geo.eu-central-1.amazonaws.com/v2/route-matrix?key=Your_key' \
  --header 'Content-Type: application/json' \
  --data '{
    "Origins": [
        {
            "Position": [-123.11679620827039, 49.28147612192166]
        },
        {
            "Position": [-123.11179620827039, 49.3014761219]
        }
    ],
    "Destinations": [
        {
            "Position": [-123.112317039, 49.28897192166]
        }
    ],
    "DepartureTime": "2024-05-28T21:27:56Z",
    "RoutingBoundary": {
        "Unbounded": true
    }
}'
```

------
#### [ AWS CLI ]

```
aws geo-routes calculate-route-matrix --key ${YourKey} \
--origins '[{"Position": [-123.11679620827039, 49.28147612192166]}, {"Position": [-123.11179620827039, 49.3014761219]}]' \
--destinations '[{"Position": [-123.11179620827039, 49.28897192166]}]' \
--departure-time "2024-05-28T21:27:56Z" \
--routing-boundary '{"Unbounded": true}'
```

------

### CalculateRouteMatrix with a geometry-based routing boundary
<a name="calculate-route-matrix-geometry"></a>

------
#### [ Sample request ]

```
{
    "Origins": [
        {
            "Position": [-123.11679620827039, 49.28147612192166]
        },
        {
            "Position": [-123.11179620827039, 49.3014761219]
        }
    ],
    "Destinations": [
        {
            "Position": [-123.112317039, 49.28897192166]
        }
    ],
    "DepartureTime": "2024-05-28T21:27:56Z",
    "RoutingBoundary": {
        "Geometry": {
            "AutoCircle": {
                "Margin": 10000,
                "MaxRadius": 30000
            }
        }
    }
}
```

------
#### [ Sample response ]

```
{
    "ErrorCount": 0,
    "RouteMatrix": [
        [
            {
                "Distance": 1907,
                "Duration": 344
            }
        ],
        [
            {
                "Distance": 5629,
                "Duration": 950
            }
        ]
    ],
    "RoutingBoundary": {
        "Geometry": {
            "Circle": {
                "Center": [
                    -123.1142962082704,
                    49.29147612191083
                ],
                "Radius": 11127
            }
        },
        "Unbounded": false
    }
}
```

------
#### [ cURL ]

```
curl --request POST \
  --url 'https://routes.geo.eu-central-1.amazonaws.com/v2/route-matrix?key=Your_key' \
  --header 'Content-Type: application/json' \
  --data '{
    "Origins": [
        {
            "Position": [-123.11679620827039, 49.28147612192166]
        },
        {
            "Position": [-123.11179620827039, 49.3014761219]
        }
    ],
    "Destinations": [
        {
            "Position": [-123.112317039, 49.28897192166]
        }
    ],
    "DepartureTime": "2024-05-28T21:27:56Z",
    "RoutingBoundary": {
        "Geometry": {
            "AutoCircle": {
                "Margin": 10000,
                "MaxRadius": 30000
            }
        }
    }
}'
```

------
#### [ AWS CLI ]

```
aws geo-routes calculate-route-matrix --key ${YourKey} \
--origins '[{"Position": [-123.11679620827039, 49.28147612192166]}, {"Position": [-123.11179620827039, 49.3014761219]}]' \
--destinations '[{"Position": [-123.11179620827039, 49.28897192166]}]' \
--departure-time "2024-05-28T21:27:56Z" \
--routing-boundary '{"Geometry": {"AutoCircle": {"Margin": 10000, "MaxRadius": 30000}}}'
```

------

# How to calculate route matrix with avoidance
<a name="calculate-route-matrix-with-avoidance"></a>

The CalculateRouteMatrix API computes routes and returns travel time and distance from each origin to each destination in the specified lists. The response includes `Distance` in meters and `Duration` in seconds. The API can be used to set avoidance options for specific areas or road features, ensuring routes avoid specified zones or conditions. If an alternative route is not feasible, the avoidance preference may be bypassed.

## Potential use cases
<a name="calculate-route-matrix-potential-use"></a>
+ **Route planning and optimization:** Use route matrix as input for software that requires optimized travel routes while avoiding certain areas or road features.

## Examples
<a name="calculate-route-matrix-examples"></a>

### CalculateRouteMatrix with an avoidance area
<a name="calculate-route-matrix-avoidance-area"></a>

------
#### [ Sample request ]

```
{
    "Origins": [
        {
            "Position": [-123.11679620827039, 49.28147612192166]
        }
    ],
    "Destinations": [
        {
            "Position": [-123.112317039, 49.28897192166]
        }
    ],
    "Avoid": {
        "Areas": [
            {
                "Geometry": {
                    "BoundingBox": [
                         -123.116561,
                         49.281517,
                         -123.110165,
                         49.285689
                    ]
                }
            }
        ]
    },
    "RoutingBoundary": {
        "Unbounded": true
    }
}
```

------
#### [ Sample response ]

```
{
    "ErrorCount": 0,
    "RouteMatrix": [
        [
            {
                "Distance": 1855,
                "Duration": 295
            }
        ]
    ],
    "RoutingBoundary": {
        "Unbounded": true
    }
}
```

------
#### [ cURL ]

```
curl --request POST \
  --url 'https://routes.geo.eu-central-1.amazonaws.com/v2/route-matrix?key=Your_key' \
  --header 'Content-Type: application/json' \
  --data '{
    "Origins": [
        {
            "Position": [-123.11679620827039, 49.28147612192166]
        }
    ],
    "Destinations": [
        {
            "Position": [-123.112317039, 49.28897192166]
        }
    ],
    "Avoid": {
        "Areas": [
            {
                "Geometry": {
                    "BoundingBox": [
                         -123.116561,
                         49.281517,
                         -123.110165,
                         49.285689
                    ]
                }
            }
        ]
    },
    "RoutingBoundary": {
        "Unbounded": true
    }
}'
```

------
#### [ AWS CLI ]

```
aws geo-routes calculate-route-matrix --key ${YourKey} \
--origins '[{"Position": [-123.11679620827039, 49.28147612192166]}]' \
--destinations '[{"Position": [-123.112317039, 49.28897192166]}]' \
--avoid '{"Areas": [{"Geometry": {"BoundingBox": [-123.116561, 49.281517, -123.110165, 49.285689]}}]}' \
--routing-boundary '{"Unbounded": true}'
```

------

### CalculateRouteMatrix avoiding toll roads, highways, and ferries
<a name="calculate-route-matrix-avoidance-features"></a>

------
#### [ Sample request ]

```
{
    "Origins": [
        {
            "Position": [-123.11679620827039, 49.28147612192166]
        }
    ],
    "Destinations": [
        {
            "Position": [-123.112317039, 49.28897192166]
        }
    ],
    "Avoid": {
        "TollRoads": true,
        "ControlledAccessHighways": true,
        "Ferries": true    
    },
    "RoutingBoundary": {
        "Unbounded": true
    }
}
```

------
#### [ Sample response ]

```
{
    "ErrorCount": 0,
    "RouteMatrix": [
        [
            {
                "Distance": 1855,
                "Duration": 295
            }
        ]
    ],
    "RoutingBoundary": {
        "Unbounded": true
    }
}
```

------
#### [ cURL ]

```
curl --request POST \
  --url 'https://routes.geo.eu-central-1.amazonaws.com/v2/route-matrix?key=Your_key' \
  --header 'Content-Type: application/json' \
  --data '{
    "Origins": [
        {
            "Position": [-123.11679620827039, 49.28147612192166]
        }
    ],
    "Destinations": [
        {
            "Position": [-123.112317039, 49.28897192166]
        }
    ],
    "Avoid": {
        "TollRoads": true,
        "ControlledAccessHighways": true,
        "Ferries": true    
    },
    "RoutingBoundary": {
        "Unbounded": true
    }
}'
```

------
#### [ AWS CLI ]

```
aws geo-routes calculate-route-matrix --key ${YourKey} \
--origins '[{"Position": [-123.11679620827039, 49.28147612192166]}]' \
--destinations '[{"Position": [-123.112317039, 49.28897192166]}]' \
--avoid '{"TollRoads": true, "ControlledAccessHighways": true, "Ferries": true}' \
--routing-boundary '{"Unbounded": true}'
```

------

# Learn how to use OptimizeWaypoints
<a name="optimize-waypoints-how-to"></a>

Learn how to use `OptimizeWaypoints` to find the best routes for minimizing travel time or distance.

**Topics**
+ [How to optimize waypoints for a route](optimize-waypoints.md)
+ [How to optimize waypoints for a route with traffic awareness](optimize-waypoints-traffic-awareness.md)
+ [How to optimize waypoints for a route with access hours awareness](optimize-waypoints-access-hours.md)

# How to optimize waypoints for a route
<a name="optimize-waypoints"></a>

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
<a name="optimize-waypoints-potential-use"></a>
+ **Analyze service area patterns:** Use waypoint optimization to make informed decisions about business service areas and improve logistics efficiency.

## Examples
<a name="optimize-waypoints-examples"></a>

### Optimize waypoints using Car TravelMode
<a name="optimize-waypoints-car"></a>

------
#### [ 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"
```

------

# How to optimize waypoints for a route with traffic awareness
<a name="optimize-waypoints-traffic-awareness"></a>

The OptimizeWaypoints API calculates the optimal route between multiple waypoints to minimize travel time or total distance. It utilizes advanced algorithms to solve the Traveling Salesman Problem, determining the most efficient path while accounting for factors such as road networks and real-time traffic conditions.

## Potential use cases
<a name="optimize-waypoints-potential-use"></a>
+ **Optimize multi-stop routes for delivery efficiency:** Improve delivery operations by calculating the shortest or fastest route among several stops. This is useful for reducing operational costs, fuel consumption, and travel time in logistics and delivery services.

## Examples
<a name="optimize-waypoints-examples"></a>

### Optimize waypoints with traffic awareness using car TravelMode
<a name="optimize-waypoints-traffic-car"></a>

------
#### [ 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",
    "Traffic": {
        "Usage": "UseTrafficData"
    }
}
```

------
#### [ Sample response ]

```
{
    "Connections": [
        {
            "Distance": 1989,
            "From": "Origin",
            "RestDuration": 0,
            "To": "Waypoint0",
            "TravelDuration": 324,
            "WaitDuration": 0
        },
        {
            "Distance": 2692,
            "From": "Waypoint0",
            "RestDuration": 0,
            "To": "Waypoint1",
            "TravelDuration": 338,
            "WaitDuration": 0
        },
        {
            "Distance": 2371,
            "From": "Waypoint1",
            "RestDuration": 0,
            "To": "Destination",
            "TravelDuration": 395,
            "WaitDuration": 0
        }
    ],
    "Distance": 7052,
    "Duration": 1057,
    "ImpedingWaypoints": [],
    "OptimizedWaypoints": [
        {
            "DepartureTime": "2024-10-25T18:13:42Z",
            "Id": "Origin",
            "Position": [
                -123.09574,
                49.274426
            ]
        },
        {
            "ArrivalTime": "2024-10-25T18:19:06Z",
            "DepartureTime": "2024-10-25T18:19:06Z",
            "Id": "Waypoint0",
            "Position": [
                -123.115193,
                49.280596
            ]
        },
        {
            "ArrivalTime": "2024-10-25T18:24:44Z",
            "DepartureTime": "2024-10-25T18:24:44Z",
            "Id": "Waypoint1",
            "Position": [
                -123.089557,
                49.271774
            ]
        },
        {
            "ArrivalTime": "2024-10-25T18:31:19Z",
            "Id": "Destination",
            "Position": [
                -123.095185,
                49.263728
            ]
        }
    ],
    "TimeBreakdown": {
        "RestDuration": 0,
        "ServiceDuration": 0,
        "TravelDuration": 1057,
        "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",
    "Traffic": {
        "Usage": "UseTrafficData"
    }
}'
```

------
#### [ 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" \
--traffic '{"Usage": "UseTrafficData"}'
```

------

# How to optimize waypoints for a route with access hours awareness
<a name="optimize-waypoints-access-hours"></a>

The OptimizeWaypoints API also calculates the optimal route between a set of waypoints, with the goal of minimizing either the travel time or the total distance covered. It solves the Traveling Salesman Problem of determining the most efficient path, taking into account factors such as the road network and traffic conditions.

## Potential use cases
<a name="optimize-waypoints-access-hours-potential-use"></a>
+ **Analyze customer access hours:** Plan for efficiency around your customer’s access hours.

## Examples
<a name="optimize-waypoints-examples"></a>

### Optimize waypoints with access hours awareness using Car TravelMode
<a name="optimize-waypoints-car"></a>

------
#### [ Sample Request ]

```
{
    "Origin": [
        -123.095740,
        49.274426
    ],
    "Waypoints": [
        {
            "Position": [
                -123.115193,
                49.280596
            ],
            "SideOfStreet": {
                "Position": [
                    -123.089557,
                    49.271774
                ],
                "UseWith": "AnyStreet"
            },
            "AccessHours": {
                "From": {
                    "DayOfWeek": "Saturday",
                    "TimeOfDay": "00:02:42Z"
                },
                "To": {
                    "DayOfWeek": "Friday",
                    "TimeOfDay": "1:33:36+02:50"
                }
            },
            "Heading": "250",
            "ServiceDuration": "200"
        },
        {
            "Position": [
                -123.089557,
                49.271774
            ],
            "AccessHours": {
                "From": {
                    "DayOfWeek": "Monday",
                    "TimeOfDay": "00:02:42Z"
                },
                "To": {
                    "DayOfWeek": "Tuesday",
                    "TimeOfDay": "1:33:36+02:50"
                }
            },
            "ServiceDuration": "200"
        }
    ],
    "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": 20682
        },
        {
            "Distance": 3360,
            "From": "Waypoint0",
            "RestDuration": 0,
            "To": "Waypoint1",
            "TravelDuration": 378,
            "WaitDuration": 172222
        },
        {
            "Distance": 2371,
            "From": "Waypoint1",
            "RestDuration": 0,
            "To": "Destination",
            "TravelDuration": 311,
            "WaitDuration": 0
        }
    ],
    "Distance": 7720,
    "Duration": 194251,
    "ImpedingWaypoints": [],
    "OptimizedWaypoints": [
        {
            "DepartureTime": "2024-10-25T18:13:42Z",
            "Id": "Origin",
            "Position": [
                -123.09574,
                49.274426
            ]
        },
        {
            "ArrivalTime": "2024-10-25T18:18:00Z",
            "DepartureTime": "2024-10-26T00:06:02Z",
            "Id": "Waypoint0",
            "Position": [
                -123.115193,
                49.280596
            ]
        },
        {
            "ArrivalTime": "2024-10-26T00:12:20Z",
            "DepartureTime": "2024-10-28T00:06:02Z",
            "Id": "Waypoint1",
            "Position": [
                -123.089557,
                49.271774
            ]
        },
        {
            "ArrivalTime": "2024-10-28T00:11:13Z",
            "Id": "Destination",
            "Position": [
                -123.095185,
                49.263728
            ]
        }
    ],
    "TimeBreakdown": {
        "RestDuration": 0,
        "ServiceDuration": 400,
        "TravelDuration": 947,
        "WaitDuration": 192904
    }
}
```

------
#### [ 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
            ],
            "SideOfStreet": {
                "Position": [
                    -123.089557,
                    49.271774
                ],
                "UseWith": "AnyStreet"
            },
            "AccessHours": {
                "From": {
                    "DayOfWeek": "Saturday",
                    "TimeOfDay": "00:02:42Z"
                },
                "To": {
                    "DayOfWeek": "Friday",
                    "TimeOfDay": "1:33:36+02:50"
                }
            },
            "Heading": "250",
            "ServiceDuration": "200"
        },
        {
            "Position": [
                -123.089557,
                49.271774
            ],
            "AccessHours": {
                "From": {
                    "DayOfWeek": "Monday",
                    "TimeOfDay": "00:02:42Z"
                },
                "To": {
                    "DayOfWeek": "Tuesday",
                    "TimeOfDay": "1:33:36+02:50"
                }
            },
            "ServiceDuration": "200"
        }
    ],
    "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], "SideOfStreet": {"Position": [-123.089557, 49.271774], "UseWith": "AnyStreet"}, "AccessHours": {"From": {"DayOfWeek": "Saturday", "TimeOfDay": "00:02:42Z"}, "To": {"DayOfWeek": "Friday", "TimeOfDay": "1:33:36+02:50"}}, "Heading": 250, "ServiceDuration": 200}, {"Position": [-123.089557, 49.271774], "AccessHours": {"From": {"DayOfWeek": "Monday", "TimeOfDay": "00:02:42Z"}, "To": {"DayOfWeek": "Tuesday", "TimeOfDay": "1:33:36+02:50"}}, "ServiceDuration": 200}]' \
--destination -123.095185 49.263728 \
--departure-time "2024-10-25T18:13:42Z" \
--travel-mode "Car"
```

------

# Learn how to use SnapToRoads
<a name="snap-to-roads-how-to"></a>

 This topic explains how to use `SnapToRoads` to align GPS traces with road networks, enhancing positional accuracy for navigation and fleet management applications. This API corrects GPS drift and signal loss by snapping coordinates to the nearest road segments, while also respecting travel mode restrictions. Examples illustrate practical uses, such as overlaying GPS traces, filling data gaps, and reducing noise for clearer route visualization.

**Topics**
+ [How to match GPS traces to a road network](how-to-match-gps-traces.md)

# How to match GPS traces to a road network
<a name="how-to-match-gps-traces"></a>

The SnapToRoads API allows you to match GPS traces onto the road network. A GPS trace includes positions and metadata like timestamp, speed, and heading that are recorded using a GPS device. These traces often have a margin of error, making them challenging to use for analysis and visualization directly.

SnapToRoads considers legal and time restrictions for the specified travel mode while matching traces. If the trace strongly suggests a restriction violation, the actual route taken is maintained.

## Potential use cases
<a name="potential-use"></a>
+ **Overlay GPS traces onto the most likely driven roads:** This feature helps align GPS data to the most accurate path on the road network, supporting clearer data visualization.
+ **Interpolate gaps in GPS traces:** SnapToRoads can fill in gaps by snapping coordinates to road segments, creating a more continuous and useful dataset for applications.
+ **Filter noise and outliers:** By snapping to the nearest road, this API can help remove outliers and reduce GPS noise, improving data reliability for analysis.

## Examples
<a name="examples"></a>

### Match GPS trace using car mode
<a name="match-gps-car-mode"></a>

------
#### [ Sample request ]

```
{
  "TracePoints": [
    {
      "Position": [8.53404,50.16364],
      "Timestamp": "2024-05-22T18:13:42Z"
    },
    {
      "Position": [8.53379056,50.16352417],
      "Speed": 20,
      "Timestamp": "2024-05-22T18:13:59Z"
    }
  ],
  "TravelMode": "Car"
}
```

------
#### [ Sample response ]

```
{
    "Notices": [],
    "SnappedGeometry": {
        "Polyline": "Redacted"
    },
    "SnappedGeometryFormat": "FlexiblePolyline",
    "SnappedTracePoints": [
        {
            "Confidence": 1,
            "OriginalPosition": [8.53404, 50.16364],
            "SnappedPosition": [8.53402, 50.16367]
        },
        {
            "Confidence": 0.86,
            "OriginalPosition": [8.53379056, 50.16352417],
            "SnappedPosition": [8.53375, 50.16356]
        }
    ]
}
```

------
#### [ cURL ]

```
curl --request POST \
  --url 'https://routes.geo.eu-central-1.amazonaws.com/v2/snap-to-roads?key=Your_key' \
  --header 'Content-Type: application/json' \
  --data '{
  "TracePoints": [
    {
      "Position": [8.53404,50.16364],
      "Timestamp": "2024-05-22T18:13:42Z"
    },
    {
      "Position": [8.53379056,50.16352417],
      "Speed": 20,
      "Timestamp": "2024-05-22T18:13:59Z"
    }
  ],
  "TravelMode": "Car"
}'
```

------
#### [ AWS CLI ]

```
aws geo-routes snap-to-roads --key ${YourKey} \
--trace-points '[{"Position": [8.53404, 50.16364], "Timestamp": "2024-05-22T18:13:42Z"}, {"Position": [8.53379056, 50.16352417], "Speed": 20, "Timestamp": "2024-05-22T18:13:59Z"}]' \
--travel-mode "Car"
```

------

### Match GPS trace using truck mode with options
<a name="match-gps-truck-mode-options"></a>

------
#### [ Sample request ]

```
{
  "TracePoints": [
    {
      "Position": [8.53404,50.16364],
      "Timestamp": "2024-05-22T18:13:42Z"
    },
    {
      "Position": [8.53379056,50.16352417],
      "Speed": 20,
      "Timestamp": "2024-05-22T18:13:59Z"
    }
  ],
  "TravelMode": "Truck",
  "TravelModeOptions": {
    "Truck": {
      "GrossWeight": 10000
    }
  }
}
```

------
#### [ Sample response ]

```
{
    "Notices": [],
    "SnappedGeometry": {
        "Polyline": "Redacted"
    },
    "SnappedGeometryFormat": "FlexiblePolyline",
    "SnappedTracePoints": [
        {
            "Confidence": 1,
            "OriginalPosition": [8.53404, 50.16364],
            "SnappedPosition": [8.53402, 50.16367]
        },
        {
            "Confidence": 0.86,
            "OriginalPosition": [8.53379056, 50.16352417],
            "SnappedPosition": [8.53375, 50.16356]
        }
    ]
}
```

------
#### [ cURL ]

```
curl --request POST \
  --url 'https://routes.geo.eu-central-1.amazonaws.com/v2/snap-to-roads?key=Your_key' \
  --header 'Content-Type: application/json' \
  --data '{
  "TracePoints": [
    {
      "Position": [8.53404,50.16364],
      "Timestamp": "2024-05-22T18:13:42Z"
    },
    {
      "Position": [8.53379056,50.16352417],
      "Speed": 20,
      "Timestamp": "2024-05-22T18:13:59Z"
    }
  ],
  "TravelMode": "Truck",
  "TravelModeOptions": {
    "Truck": {
      "GrossWeight": 10000
    }
  }
}'
```

------
#### [ AWS CLI ]

```
aws geo-routes snap-to-roads --key ${YourKey} \
--trace-points '[{"Position": [8.53404, 50.16364], "Timestamp": "2024-05-22T18:13:42Z"}, {"Position": [8.53379056, 50.16352417], "Speed": 20, "Timestamp": "2024-05-22T18:13:59Z"}]' \
--travel-mode "Truck" \
--travel-mode-options '{"Truck": {"GrossWeight": 10000}}'
```

------

# Manage costs and usage
<a name="routes-whats-next"></a>

As you continue learning about Amazon Location routes, it's important to understand how to manage service capacity, ensure you follow usage limits, and get the best results through quota and API optimizations. By applying best practices for performance and accuracy, you can tailor your application to handle place-related queries efficiently and maximize your API requests.

**Topics**
+ [Best Practices](routes-best-practices.md)
+ [Routes pricing](routes-pricing.md)
+ [Routes Quota and Usage](routes-quota-usage.md)

# Best Practices
<a name="routes-best-practices"></a>

This section covers best practices for using compression and choosing between Simple (GeoJSON) and FlexiblePolyline formats when interacting with the API, providing guidance on optimizing performance, bandwidth, and data handling.

## Compression
<a name="compression"></a>

To enhance the performance and efficiency of your applications when interacting with our API, it is recommended to enable compression for responses, especially when dealing with large text-based payloads. You can activate compression by including the `Accept-Encoding` header in your API requests, specifying your preferred compression method. We support `gzip` and `deflate` for their compression capabilities, with `gzip` typically offering better compression ratios.

### When to Enable Compression
<a name="when-to-enable-compression"></a>

**Large Responses**  
Enable compression for large text-based responses to reduce bandwidth usage and improve load times.

**Network Constraints**  
If your application operates over limited bandwidth or high-latency networks, compression can enhance data transfer efficiency.

### How to Use Compression Effectively
<a name="how-to-use-compression-effectively"></a>

**Set the Accept-Encoding Header**  
Include `Accept-Encoding: gzip, deflate` in your HTTP requests to inform our API that you support these compression methods. The method to enable and handle compression varies by [AWS SDK](https://docs.aws.amazon.com/sdkref/latest/guide/overview.html) and programming language. For example, the [AWS SDK for Java v1](https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/ClientConfiguration.html#withGzip-boolean-) uses the `withGzip` method in the `ClientConfiguration` class to enable gzip, while the AWS SDK for Go requires adding specific middleware for compression handling. For other SDKs, please refer to the [AWS SDK Reference Guide](https://docs.aws.amazon.com/sdkref/latest/guide/overview.html) for detailed instructions.

**Handle Decompression Properly**  
Ensure your client application can correctly decompress the responses based on the `Content-Encoding` header returned by our API.

**Test and Monitor**  
Regularly evaluate the impact of compression on your application's performance, balancing the benefits of reduced payload sizes against any additional CPU overhead from decompression processes.

## Polyline
<a name="polyline"></a>

Best practices for choosing between Simple (GeoJSON) and FlexiblePolyline formats when interacting with our API, to optimize both performance and usability of your geospatial data.

### Use Simple (GeoJSON) Format
<a name="use-simple-format"></a>

**Readability and Standardization**  
Use when you require a widely recognized and human-readable format for ease of debugging and interoperability with various geospatial tools.

**Precision**  
Choose Simple format when your application needs high precision for coordinates, as GeoJSON maintains full decimal precision without loss.

**Smaller Datasets**  
Simple format is ideal when working with smaller sets of coordinate data where the size reduction benefits of compression are minimal.

### Use FlexiblePolyline Format
<a name="use-flexiblepolyline-format"></a>

**Data Size Reduction**  
FlexiblePolyline is ideal when you need to minimize the amount of data transmitted, especially for large lists of coordinates, by leveraging lossy compression techniques.

**URL Safety**  
FlexiblePolyline provides a compact, URL-safe string that can be used directly in query parameters without additional encoding.

**Performance Optimization**  
FlexiblePolyline helps reduce the payload size, leading to faster data transfer and lower bandwidth usage, making it crucial for high-performance applications or those operating over constrained networks.

# Routes pricing
<a name="routes-pricing"></a>

Please see below for pricing buckets for each API:

## Calculate Routes
<a name="calculate-routes-price"></a>

This price is based on the number of API requests. `CalculateRoutes` has three pricing buckets: Core, Advanced, and Premium.

**Core**  
 This pricing bucket supports the travel modes `Car`, `Truck`, and `Pedestrian`, without toll cost calculation. 

**Advanced**  
 This pricing bucket supports alternative travel modes such as `Scooter`, without toll cost calculation.   
 For [GrabMaps](https://docs.aws.amazon.com/location/latest/developerguide/GrabMaps.html) customers in `ap-southeast-1` and `ap-southeast-5`, the `Scooter` travel mode is part of the Core pricing bucket. 

**Premium**  
 This pricing bucket supports toll cost calculation. You will be charged at Premium price when you request toll cost calculation by setting the request parameters `LegAdditionalFeatures["Tolls"]` or `SpanAdditionalFeatures["TollSystems"]`, regardless of travel mode. 

## Calculate Route Matrix
<a name="calculate-route-matri-price"></a>

This price is based on the number of routes calculated. The number of routes calculated in each request is equal to the number of origins multiplied by the number of destinations, `Number of Routes = Number of origins x Number of Destinations`. For example, when using a matrix size of 300 origins by 100 destinations, the total number of routes calculated is 30,000 (300 x 100 = 30,000).

**Note**  
Route calculations are billed for each origin and destination pair. If you use a large matrix of origins and destinations, your costs will increase accordingly.

`CalculateRouteMatrix` has 2 pricing buckets: Core and Advanced.

**Core**  
 This pricing bucket supports the travel modes `Car`, `Truck`, and `Pedestrian`. 

**Advanced**  
This pricing bucket supports alternative travel modes such as `Scooter`.  
 For [GrabMaps](https://docs.aws.amazon.com/location/latest/developerguide/GrabMaps.html) customers in `ap-southeast-1` and `ap-southeast-5`, the `Scooter` travel mode is part of the Core pricing bucket. 

## Optimize Waypoint
<a name="optimize-waypoint-price"></a>

This price is based on the number of API requests. `OptimizeWaypoint` has 2 pricing buckets: Advanced and Premium.

**Advanced**  
 This pricing bucket supports up to 30 waypoints in a single request; travel modes for Car, Truck and Pedestrian, with the bounding box of the input points within 200km, and with no optional parameters such as `Avoid`, `Clustering`, `Driver`, `Exclude.Countries`, `TravelModeOptions.Truck.HazardousCargos`, `TravelModeOptions.Truck.TunnelRestrictionCode`, and no additional waypoints or destination constraints such as `AccessHours`, `AppointmentTime`, `Before`, `Heading`, `ServiceDuration`, `SideOfStreet`.  
Automatic clustering could occur when waypoints are in close proximity, but it is still considered as advanced pricing bucket.

**Premium**  
 This pricing bucket supports up to 50 waypoints in a single request; with no restrictions on travel modes; bounding box of the input points within 500km; and with optional parameters such as `Avoid`, `Clustering`, `Driver`, `Exclude.Countries`, `TravelModeOptions.Truck.HazardousCargos`, `TravelModeOptions.Truck.TunnelRestrictionCode`. In addition, this pricing bucket supports optional waypoint and destination constraints , such as `AccessHours`, `AppointmentTime`, `Before`, `Heading`, `ServiceDuration`, `SideOfStreet`.   
A single request can only support up to 20 waypoints if any of the optional waypoint and destination constraints is applied.

## Snap-to-road
<a name="snap-to-road-price"></a>

This price is based on the number of API requests. `SnaptoRoad` has 2 pricing buckets: Advanced and Premium.

**Advanced**  
This pricing bucket supports travel modes Car, Truck and Pedestrian, with a `TracePoints` count up to 200 and with a maximum airline distance between `TracePoints` of 100 kilometers.

**Premium**  
This pricing bucket has no restrictions on travel modes, up to 5,000 `TracePoints` points.

## Calculate Isoline
<a name="calculate-isoline-price"></a>

This price is based on the number of Isolines calculated in the response. `CalculateIsolines` has 2 pricing buckets: Advanced and Premium.

**Advanced**  
This pricing bucket supports travel modes Car, Truck and Pedestrian, with `Thresholds.Time` values up to 60 minutes or `Thresholds.Distance` values up to 100 kilometers.

**Premium**  
This pricing bucket has no restrictions on travel modes, with `Thresholds.Time` values up to 180 minutes or `Thresholds.Distance` values up to 300KM.

# Routes Quota and Usage
<a name="routes-quota-usage"></a>

## Service Quota
<a name="service-quota"></a>

Amazon Location Service APIs have default quotas. You can increase quotas using the [service quota console](https://console.aws.amazon.com/servicequotas/home#!/services/geo/quotas). For limits exceeding 2x the default, request via the self-service console or contact support.


**Service Quota Limits**  

| API Name | Default | Max Adjustable Limit | More than Adjustable Max Limit | 
| --- | --- | --- | --- | 
| [Calculate routes](calculate-routes.md) | 20 | 40 | Request on [service quota console](https://console.aws.amazon.com/servicequotas/home#!/services/geo/quotas) or contact support team | 
| [Calculate isolines](calculate-isolines.md) | 20 | 40 | Request on [service quota console](https://console.aws.amazon.com/servicequotas/home#!/services/geo/quotas) or contact support team | 
| [Snap to Roads](snap-to-roads.md) | 20 | 40 | Request on [service quota console](https://console.aws.amazon.com/servicequotas/home#!/services/geo/quotas) or contact support team | 
| [Calculate route matrix](calculate-route-matrix.md) | 5 | 10 | Request on [service quota console](https://console.aws.amazon.com/servicequotas/home#!/services/geo/quotas) or contact support team | 
| [Optimize waypoints](actions-optimize-waypoints.md) | 5 | 10 | Request on [service quota console](https://console.aws.amazon.com/servicequotas/home#!/services/geo/quotas) or contact support team | 

## Other Usage Limits
<a name="other-usage-limits"></a>

In addition to service quotas, the following API usage limits apply:


**Other Usage Limits**  

| API Name | Limit | Value | 
| --- | --- | --- | 
| [Snap to Roads](snap-to-roads.md) | Sum of Geodesic distance between all TracePoints | 500KM | 
| [Optimize waypoints](actions-optimize-waypoints.md) | Sum of Geodesic distance between the Origin, Waypoints in the provided ordering, and Destination | 100KM | 
| [Optimize waypoints](actions-optimize-waypoints.md) | Perimeter of the bounding box surrounding the Origin, Waypoints, and Destination | 500KM | 
| [Calculate route matrix](calculate-route-matrix.md) | Max Distance between Origins and Destinations for Unbounded routing (If Avoid or TravelModeOptions.Truck is used) | 60KM | 
| [Calculate route matrix](calculate-route-matrix.md) | Max Distance between Origins and Destinations for Unbounded routing | 10000KM | 
| [Calculate routes](calculate-routes.md) | Response payload size after compression | 6MB | 
| [Calculate route matrix](calculate-route-matrix.md) | Response payload size after compression | 6MB | 
| [Calculate isolines](calculate-isolines.md) | Response payload size after compression | 6MB | 
| [Optimize waypoints](actions-optimize-waypoints.md) | Response payload size after compression | 6MB | 
| [Snap to Roads](snap-to-roads.md) | Response payload size after compression | 6MB | 

## Next Steps
<a name="next-steps"></a>

Please check the following for further details:
+ [Attribution](https://docs.aws.amazon.com/location/latest/developerguide/data-attribution.html): Information on data attribution requirements for Amazon Location Service.
+ [SLA](https://aws.amazon.com/location/sla/): The service level agreement for Amazon Location Service, including uptime commitments and response times.
+ [Service Terms](https://aws.amazon.com/service-terms/): Terms governing the use of Amazon Location Service, including restrictions and limitations.