v1
latestOpenAPI 3.1.02026-08-0420183200.9 KBRouting
Calculate an optimized route between a known start and end point.
The optimized route API is a mix of the matrix and normal route API. For an optimized route, the start and end point are fixed, but the intermediate points will be re-ordered to form an optimal route visiting all nodes once.
post/optimized_route/v1
Request body
Example request
{
"costing": "auto",
"locations": [
{
"lat": 40.042072,
"lon": -76.306572
},
{
"lat": 39.992115,
"lon": -76.781559
},
{
"lat": 39.984519,
"lon": -76.6956
},
{
"lat": 39.996586,
"lon": -76.769028
},
{
"lat": 39.984322,
"lon": -76.706672
}
],
"units": "miles"
}Response
The optimized route, which looks more or less like a normal route response. The only significant difference is that the locations may be re-ordered and annotated with an original_index.
Example response
{
"trip": {
"language": "en-US",
"legs": [
{
"maneuvers": [
{
"begin_shape_index": 0,
"cost": 15.508,
"end_shape_index": 9,
"instruction": "Drive west on AK 1/Seward Highway.",
"length": 0.176,
"street_names": [
"AK 1",
"Seward Highway"
],
"time": 11.487,
"travel_mode": "drive",
"travel_type": "car",
"type": 1,
"verbal_multi_cue": true,
"verbal_post_transition_instruction": "Continue for 900 feet.",
"verbal_pre_transition_instruction": "Drive west on Alaska 1, Seward Highway. Then You will arrive at your destination."
},
{
"begin_shape_index": 9,
"cost": 0,
"end_shape_index": 9,
"instruction": "You have arrived at your destination.",
"length": 0,
"time": 0,
"travel_mode": "drive",
"travel_type": "car",
"type": 4,
"verbal_pre_transition_instruction": "You have arrived at your destination.",
"verbal_transition_alert_instruction": "You will arrive at your destination."
}
],
"shape": "wzvmrBxalf|GcCrX}A|Nu@jI}@pMkBtZ{@x^_Afj@Inn@`@veB",
"summary": {
"cost": 15.508,
"has_time_restrictions": false,
"length": 0.176,
"max_lat": 60.535008,
"max_lon": -149.543469,
"min_lat": 60.534715,
"min_lon": -149.54858,
"time": 11.487
}
}
],
"locations": [
{
"lat": 60.534715,
"lon": -149.543469,
"original_index": 0,
"type": "break"
},
{
"lat": 60.53499,
"lon": -149.54858,
"original_index": 1,
"type": "break"
}
],
"status": 0,
"status_message": "Found route between points",
"summary": {
"cost": 15.508,
"has_time_restrictions": false,
"length": 0.176,
"max_lat": 60.535008,
"max_lon": -149.543469,
"min_lat": 60.534715,
"min_lon": -149.54858,
"time": 11.487
},
"units": "miles"
}
}