Consider the following request which is POST /v2/directions/driving-hgv
-
It contains 25 coordinates (all resolved by nominatim)
-
It imposes specific limits on highways/tolls/ferries
-
It imposes restrictions on large truck height/weight/axle
{“coordinates”:[[-71.073278,42.386637],[-71.118776,42.332433],[-71.118776,42.332433],[-71.073278,42.386637],[-71.073278,42.386637],[-71.070274,42.357265],[-71.070274,42.357265],[-71.073278,42.386637],[-71.073278,42.386637],[-71.12078,42.374085],[-71.12078,42.374085],[-71.073278,42.386637],[-71.073278,42.386637],[-71.095024,42.379925],[-71.095024,42.379925],[-71.073278,42.386637],[-71.073278,42.386637],[-71.073278,42.386637],[-71.073278,42.386637],[-71.073278,42.386637],[-71.073278,42.386637],[-71.118776,42.332433],[-71.118776,42.332433],[-71.070274,42.357265],[-71.070274,42.357265],[-71.118776,42.332433]],“options”:{“avoid_features”:[“highways”,“tollways”,“ferries”],“profile_params”:{“restrictions”:{“axleload”:3.3,“hazmat”:“true”,“height”:6,“length”:3.1,“weight”:1.7,“width”:3.7}},“vehicle_type”:“hgv”},“units”:“mi”}
It yields the following response which i have abbreviated.
I submitted 25 coordinates and I’m receiving 24 segments which does makes sense.
What I find interesting / confusing about this response is the inconsistency in the segment data.
- Is it correct to assume the order of the segments return always correlates with the order of the coordinates (e.g. I submit A,B,C and the segments returned are always {A → B}, {B → C}? I THINK this is true but want to verify.
- The first segment has a distance, a duration, and multiple steps which makes sense. The second (and fourth) segment does not have distance nor duration, and it contains a single step which seems to be of a “departure” type. When there is no distance/duration for a segment does this signify ORS could not determine directions?
{
“routes”: [
{
“summary”: {
“distance”: 48.812,
“duration”: 8027.700000000001
},
“segments”: [
{
“distance”: 6.254,
“duration”: 1074,
“steps”: [
{
“distance”: 0.023,
“duration”: 8.8,
“type”: 11,
“instruction”: “Head southeast on Arlington Avenue”,
“name”: “Arlington Avenue”,
“way_points”: [
0,
2
]
},
{
“distance”: 0.075,
“duration”: 19.5,
“type”: 1,
“instruction”: “Turn right onto Alford Street”,
“name”: “Alford Street”,
“way_points”: [
2,
6
]
},
{
“distance”: 0.657,
“duration”: 87.5,
“type”: 7,
“instruction”: “Enter the roundabout and take the 4th exit onto Rutherford Avenue”,
“name”: “Rutherford Avenue”,
“exit_number”: 4,
“way_points”: [
6,
30
]
},
{
“distance”: 0.154,
“duration”: 22.3,
“type”: 13,
“instruction”: “Keep right”,
“name”: “-”,
“way_points”: [
30,
36
]
},
{
“distance”: 0.959,
“duration”: 164.9,
“type”: 13,
“instruction”: “Keep right”,
“name”: “-”,
“way_points”: [
36,
83
]
},
{
“distance”: 0.062,
“duration”: 17.9,
“type”: 6,
“instruction”: “Continue straight onto Land Boulevard”,
“name”: “Land Boulevard”,
“way_points”: [
83,
89
]
},
{
“distance”: 0.054,
“duration”: 12.4,
“type”: 13,
“instruction”: “Keep right”,
“name”: “-”,
“way_points”: [
89,
96
]
},
{
“distance”: 0.25,
“duration”: 50.8,
“type”: 1,
“instruction”: “Turn right onto Main Street”,
“name”: “Main Street”,
“way_points”: [
96,
107
]
},
{
“distance”: 0.299,
“duration”: 50.5,
“type”: 0,
“instruction”: “Turn left onto Third Street”,
“name”: “Third Street”,
“way_points”: [
107,
121
]
},
{
“distance”: 0.31,
“duration”: 48.9,
“type”: 0,
“instruction”: “Turn left onto Vassar Street”,
“name”: “Vassar Street”,
“way_points”: [
121,
134
]
},
{
“distance”: 0.226,
“duration”: 40.6,
“type”: 2,
“instruction”: “Turn sharp left onto Massachusetts Avenue, MA 2A”,
“name”: “Massachusetts Avenue, MA 2A”,
“way_points”: [
134,
146
]
},
{
“distance”: 0.839,
“duration”: 116.8,
“type”: 1,
“instruction”: “Turn right”,
“name”: “-”,
“way_points”: [
146,
172
]
},
{
“distance”: 0.128,
“duration”: 18.6,
“type”: 13,
“instruction”: “Keep right”,
“name”: “-”,
“way_points”: [
172,
179
]
},
{
“distance”: 0.372,
“duration”: 99.8,
“type”: 7,
“instruction”: “Enter the roundabout and take the 3rd exit onto MA 2”,
“name”: “MA 2”,
“exit_number”: 3,
“way_points”: [
179,
213
]
},
{
“distance”: 0.256,
“duration”: 40.1,
“type”: 12,
“instruction”: “Keep left onto Mountfort Street, MA 2”,
“name”: “Mountfort Street, MA 2”,
“way_points”: [
213,
231
]
},
{
“distance”: 0.168,
“duration”: 27.8,
“type”: 1,
“instruction”: “Turn right onto Saint Mary’s Street”,
“name”: “Saint Mary’s Street”,
“way_points”: [
231,
246
]
},
{
“distance”: 0.413,
“duration”: 62.9,
“type”: 1,
“instruction”: “Turn right onto Beacon Street”,
“name”: “Beacon Street”,
“way_points”: [
246,
255
]
},
{
“distance”: 0.799,
“duration”: 133.3,
“type”: 0,
“instruction”: “Turn left onto Powell Street”,
“name”: “Powell Street”,
“way_points”: [
255,
296
]
},
{
“distance”: 0.158,
“duration”: 30.4,
“type”: 1,
“instruction”: “Turn right onto Kent Street”,
“name”: “Kent Street”,
“way_points”: [
296,
308
]
},
{
“distance”: 0.022,
“duration”: 8.5,
“type”: 0,
“instruction”: “Turn left onto Harvard Street”,
“name”: “Harvard Street”,
“way_points”: [
308,
309
]
},
{
“distance”: 0.018,
“duration”: 7.1,
“type”: 4,
“instruction”: “Turn slight left onto Washington Street”,
“name”: “Washington Street”,
“way_points”: [
309,
312
]
},
{
“distance”: 0.012,
“duration”: 4.7,
“type”: 1,
“instruction”: “Turn right onto Davis Court”,
“name”: “Davis Court”,
“way_points”: [
312,
313
]
},
{
“distance”: 0,
“duration”: 0,
“type”: 10,
“instruction”: “Arrive at Davis Court, on the left”,
“name”: “-”,
“way_points”: [
313,
313
]
}
]
},
{
“steps”: [
{
“distance”: 0,
“duration”: 0,
“type”: 11,
“instruction”: “Head east”,
“name”: “-”,
“way_points”: [
313,
314
]
}
]
},
{
“distance”: 6.852,
“duration”: 1062.3,
“steps”: [
{
“distance”: 0.012,
“duration”: 4.7,
“type”: 11,
“instruction”: “Head east on Davis Court”,
“name”: “Davis Court”,
“way_points”: [
314,
315
]
},
{
“distance”: 0.093,
“duration”: 28.9,
“type”: 1,
“instruction”: “Turn right onto Washington Street”,
“name”: “Washington Street”,
“way_points”: [
315,
328
]
},
{
“distance”: 0.713,
“duration”: 71.9,
“type”: 2,
“instruction”: “Turn sharp left onto Washington Street, MA 9”,
“name”: “Washington Street, MA 9”,
“way_points”: [
328,
389
]
},
{
“distance”: 0.531,
“duration”: 94.5,
“type”: 12,
“instruction”: “Keep left onto Huntington Avenue, MA 9”,
“name”: “Huntington Avenue, MA 9”,
“way_points”: [
389,
416
]
},
{
“distance”: 0.136,
“duration”: 25,
“type”: 2,
“instruction”: “Turn sharp left onto Louis Prang Street”,
“name”: “Louis Prang Street”,
“way_points”: [
416,
429
]
},
{
“distance”: 0.57,
“duration”: 60.1,
“type”: 3,
“instruction”: “Turn sharp right onto Fenway”,
“name”: “Fenway”,
“way_points”: [
429,
471
]
},
{
“distance”: 0.111,
“duration”: 14.3,
“type”: 4,
“instruction”: “Turn slight left onto Fenway”,
“name”: “Fenway”,
“way_points”: [
471,
480
]
},
{
“distance”: 0.048,
“duration”: 11.1,
“type”: 13,
“instruction”: “Keep right”,
“name”: “-”,
“way_points”: [
480,
484
]
},
{
“distance”: 0.143,
“duration”: 32.5,
“type”: 5,
“instruction”: “Turn slight right onto Boylston Street”,
“name”: “Boylston Street”,
“way_points”: [
484,
491
]
},
{
“distance”: 0.967,
“duration”: 206.5,
“type”: 0,
“instruction”: “Turn left onto Massachusetts Avenue”,
“name”: “Massachusetts Avenue”,
“way_points”: [
491,
544
]
},
{
“distance”: 1.154,
“duration”: 215.8,
“type”: 3,
“instruction”: “Turn sharp right onto Vassar Street”,
“name”: “Vassar Street”,
“way_points”: [
544,
598
]
},
{
“distance”: 0.367,
“duration”: 71.7,
“type”: 0,
“instruction”: “Turn left onto Land Boulevard”,
“name”: “Land Boulevard”,
“way_points”: [
598,
617
]
},
{
“distance”: 0.425,
“duration”: 68.7,
“type”: 13,
“instruction”: “Keep right onto Charlestown Avenue”,
“name”: “Charlestown Avenue”,
“way_points”: [
617,
633
]
},
{
“distance”: 0.037,
“duration”: 14.1,
“type”: 6,
“instruction”: “Continue straight onto Austin Street”,
“name”: “Austin Street”,
“way_points”: [
633,
636
]
},
{
“distance”: 0.293,
“duration”: 39.3,
“type”: 0,
“instruction”: “Turn left”,
“name”: “-”,
“way_points”: [
636,
647
]
},
{
“distance”: 0.912,
“duration”: 66.1,
“type”: 12,
“instruction”: “Keep left onto Sullivan Square Underpass, MA 99”,
“name”: “Sullivan Square Underpass, MA 99”,
“way_points”: [
647,
666
]
},
{
“distance”: 0.221,
“duration”: 16,
“type”: 2,
“instruction”: “Turn sharp left onto Alford Street, MA 99”,
“name”: “Alford Street, MA 99”,
“way_points”: [
666,
674
]
},
{
“distance”: 0.095,
“duration”: 12.2,
“type”: 13,
“instruction”: “Keep right onto Alford Street”,
“name”: “Alford Street”,
“way_points”: [
674,
677
]
},
{
“distance”: 0.023,
“duration”: 8.8,
“type”: 3,
“instruction”: “Turn sharp right onto Arlington Avenue”,
“name”: “Arlington Avenue”,
“way_points”: [
677,
679
]
},
{
“distance”: 0,
“duration”: 0,
“type”: 10,
“instruction”: “Arrive at Arlington Avenue, on the left”,
“name”: “-”,
“way_points”: [
679,
679
]
}
]
},
{
“steps”: [
{
“distance”: 0,
“duration”: 0,
“type”: 11,
“instruction”: “Head east”,
“name”: “-”,
“way_points”: [
679,
680
]
}
]
},
…ETC… ],
“bbox”: [
-71.12148,
42.331439,
-71.056946,
42.390391
],
“way_points”: [
0,
313,
313,
678,
678,
848,
848,
1049,
1049,
1313,
1313,
1588,
1588,
1679,
1679,
1826,
1826,
1826,
1826,
1826,
1826,
2139,
2139,
2421,
2421,
2692
]
}
]
}