OptimizeWaypoints
OptimizeWaypoints
calculates the optimal order to travel between a set of waypoints to minimize either the
travel time or the distance travelled during the journey, based on road network
restrictions and the traffic pattern data.
Request Syntax
POST /optimize-waypoints?key=Key
HTTP/1.1
Content-type: application/json
{
"Avoid": {
"Areas": [
{
"Geometry": {
"BoundingBox": [ number
]
}
}
],
"CarShuttleTrains": boolean
,
"ControlledAccessHighways": boolean
,
"DirtRoads": boolean
,
"Ferries": boolean
,
"TollRoads": boolean
,
"Tunnels": boolean
,
"UTurns": boolean
},
"DepartureTime": "string
",
"Destination": [ number
],
"DestinationOptions": {
"AccessHours": {
"From": {
"DayOfWeek": "string
",
"TimeOfDay": "string
"
},
"To": {
"DayOfWeek": "string
",
"TimeOfDay": "string
"
}
},
"AppointmentTime": "string
",
"Heading": number
,
"Id": "string
",
"ServiceDuration": number
,
"SideOfStreet": {
"Position": [ number
],
"UseWith": "string
"
}
},
"Driver": {
"RestCycles": {
"LongCycle": {
"RestDuration": number
,
"WorkDuration": number
},
"ShortCycle": {
"RestDuration": number
,
"WorkDuration": number
}
},
"RestProfile": {
"Profile": "string
"
},
"TreatServiceTimeAs": "string
"
},
"Exclude": {
"Countries": [ "string
" ]
},
"OptimizeSequencingFor": "string
",
"Origin": [ number
],
"OriginOptions": {
"Id": "string
"
},
"Traffic": {
"Usage": "string
"
},
"TravelMode": "string
",
"TravelModeOptions": {
"Pedestrian": {
"Speed": number
},
"Truck": {
"GrossWeight": number
,
"HazardousCargos": [ "string
" ],
"Height": number
,
"Length": number
,
"Trailer": {
"TrailerCount": number
},
"TruckType": "string
",
"TunnelRestrictionCode": "string
",
"WeightPerAxle": number
,
"Width": number
}
},
"Waypoints": [
{
"AccessHours": {
"From": {
"DayOfWeek": "string
",
"TimeOfDay": "string
"
},
"To": {
"DayOfWeek": "string
",
"TimeOfDay": "string
"
}
},
"AppointmentTime": "string
",
"Before": [ number
],
"Heading": number
,
"Id": "string
",
"Position": [ number
],
"ServiceDuration": number
,
"SideOfStreet": {
"Position": [ number
],
"UseWith": "string
"
}
}
]
}
URI Request Parameters
The request uses the following URI parameters.
- Key
-
Optional: The API key to be used for authorization. Either an API key or valid SigV4 signature must be provided when making a request.
Length Constraints: Minimum length of 0. Maximum length of 1000.
Request Body
The request accepts the following data in JSON format.
- Avoid
-
Features that are avoided. Avoidance is on a best-case basis. If an avoidance can't be satisfied for a particular case, this setting is ignored.
Type: WaypointOptimizationAvoidanceOptions object
Required: No
- DepartureTime
-
Departure time from the waypoint.
Time format:
YYYY-MM-DDThh:mm:ss.sssZ | YYYY-MM-DDThh:mm:ss.sss+hh:mm
Examples:
2020-04-22T17:57:24Z
2020-04-22T17:57:24+02:00
Type: String
Pattern:
([1-2][0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]{0,9})?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])
Required: No
- Destination
-
The final position for the route in the World Geodetic System (WGS 84) format:
[longitude, latitude]
.Type: Array of doubles
Array Members: Fixed number of 2 items.
Required: No
- DestinationOptions
-
Destination related options.
Type: WaypointOptimizationDestinationOptions object
Required: No
- Driver
-
Driver related options.
Type: WaypointOptimizationDriverOptions object
Required: No
- Exclude
-
Features to be strictly excluded while calculating the route.
Type: WaypointOptimizationExclusionOptions object
Required: No
- OptimizeSequencingFor
-
Specifies the optimization criteria for the calculated sequence.
Default Value:
FastestRoute
.Type: String
Valid Values:
FastestRoute | ShortestRoute
Required: No
- Origin
-
The start position for the route.
Type: Array of doubles
Array Members: Fixed number of 2 items.
Required: Yes
- OriginOptions
-
Origin related options.
Type: WaypointOptimizationOriginOptions object
Required: No
- Traffic
-
Traffic-related options.
Type: WaypointOptimizationTrafficOptions object
Required: No
- TravelMode
-
Specifies the mode of transport when calculating a route. Used in estimating the speed of travel and road compatibility.
Default Value:
Car
Type: String
Valid Values:
Car | Pedestrian | Scooter | Truck
Required: No
- TravelModeOptions
-
Travel mode related options for the provided travel mode.
Type: WaypointOptimizationTravelModeOptions object
Required: No
- Waypoints
-
List of waypoints between the
Origin
andDestination
.Type: Array of WaypointOptimizationWaypoint objects
Required: No
Response Syntax
HTTP/1.1 200
x-amz-geo-pricing-bucket: PricingBucket
Content-type: application/json
{
"Connections": [
{
"Distance": number,
"From": "string",
"RestDuration": number,
"To": "string",
"TravelDuration": number,
"WaitDuration": number
}
],
"Distance": number,
"Duration": number,
"ImpedingWaypoints": [
{
"FailedConstraints": [
{
"Constraint": "string",
"Reason": "string"
}
],
"Id": "string",
"Position": [ number ]
}
],
"OptimizedWaypoints": [
{
"ArrivalTime": "string",
"DepartureTime": "string",
"Id": "string",
"Position": [ number ]
}
],
"TimeBreakdown": {
"RestDuration": number,
"ServiceDuration": number,
"TravelDuration": number,
"WaitDuration": number
}
}
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The response returns the following HTTP headers.
- PricingBucket
-
The pricing bucket for which the query is charged at.
The following data is returned in JSON format by the service.
- Connections
-
Details about the connection from one waypoint to the next, within the optimized sequence.
Type: Array of WaypointOptimizationConnection objects
- Distance
-
Overall distance to travel the whole sequence.
Type: Long
Valid Range: Minimum value of 0. Maximum value of 4294967295.
- Duration
-
Overall duration to travel the whole sequence.
Unit:
seconds
Type: Long
Valid Range: Minimum value of 0. Maximum value of 4294967295.
- ImpedingWaypoints
-
Returns waypoints that caused the optimization problem to fail, and the constraints that were unsatisfied leading to the failure.
Type: Array of WaypointOptimizationImpedingWaypoint objects
- OptimizedWaypoints
-
Waypoints in the order of the optimized sequence.
Type: Array of WaypointOptimizationOptimizedWaypoint objects
- TimeBreakdown
-
Time breakdown for the sequence.
Type: WaypointOptimizationTimeBreakdown object
Errors
For information about the errors that are common to all actions, see Common Errors.
- AccessDeniedException
-
You don't have sufficient access to perform this action.
HTTP Status Code: 403
- InternalServerException
-
The request processing has failed because of an unknown error, exception or failure.
HTTP Status Code: 500
- ThrottlingException
-
The request was denied due to request throttling.
HTTP Status Code: 429
- ValidationException
-
The input fails to satisfy the constraints specified by an AWS service.
HTTP Status Code: 400
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: