openrouteservice
openrouteservice copied to clipboard
Segments of 0 distance not handled properly for hgv profile
Here's what I did
See https://ask.openrouteservice.org/t/what-does-type-stand-for-in-segments-output/2701/17
https://api.openrouteservice.org/v2/directions/driving-car/geojson
{"coordinates":[[16.39933644,48.140432],[16.3986471,48.1405411]],"extra_info":["waytype"]}
Here's what I got
{"type":"FeatureCollection","features":[{"bbox":[16.399427,48.140437,16.399427,48.140437],"type":"Feature","properties":{"segments":[{"distance":0.0,"duration":0.0,"steps":[{"distance":0.0,"duration":0.0,"type":11,"instruction":"Head east","name":"-","way_points":[0,0]}]}],"extras":{"waycategory":{"values":[],"summary":[]}},"summary":{},"way_points":[0,0]},"geometry":{"coordinates":[[16.399427,48.140437]],"type":"LineString"}}],"bbox":[16.399427,48.140437,16.399427,48.140437],"metadata":{"attribution":"openrouteservice.org | OpenStreetMap contributors","service":"routing","timestamp":1619444352645,"query":{"coordinates":[[16.39933644,48.140432],[16.3986471,48.1405411]],"profile":"driving-car","format":"geojson","extra_info":["waycategory"]},"engine":{"version":"6.4.1","build_date":"2021-04-12T11:21:00Z","graph_date":"1970-01-01T00:00:00Z"}}}
The geometry only contains one single point and values for extra information are empty (which should be filled with an no extra info entry similar to https://github.com/GIScience/openrouteservice/issues/636)
But here the segments steps contain "way_points":[0,0]
If you switch to
https://api.openrouteservice.org/v2/directions/driving-hgv/geojson
for the same body:
{"type":"FeatureCollection","features":[{"bbox":[16.399427,48.140437,16.399427,48.140437],"type":"Feature","properties":{"segments":[{"steps":[{"distance":0.0,"duration":0.0,"type":11,"instruction":"Head east","name":"-","way_points":[0,1]}]}],"extras":{"waycategory":{"values":[],"summary":[]}},"summary":{},"way_points":[0,0]},"geometry":{"coordinates":[[16.399427,48.140437]],"type":"LineString"}}],"bbox":[16.399427,48.140437,16.399427,48.140437],"metadata":{"attribution":"openrouteservice.org | OpenStreetMap contributors","service":"routing","timestamp":1619444282167,"query":{"coordinates":[[16.39933644,48.140432],[16.3986471,48.1405411]],"profile":"driving-hgv","format":"geojson","extra_info":["waycategory"]},"engine":{"version":"6.3.6","build_date":"2021-03-26T08:06:42Z","graph_date":"1970-01-01T00:00:00Z"}}}
you get the same geometry, but a "way_points":[0,1]
in segments, even though there is no waypoint 1.
Here's what I was expecting
The waypoint number in the instructions being in line with the geometry.
(no extra information stub for the segment instead of empty array see https://github.com/GIScience/openrouteservice/issues/636)
Here's what I think could be improved
As for the indexing part, the issue should have been fixed with release 6.4.1, it's just that our server is still running v6.3.6 of our code for the HGV profile - locally I get the expected segments step with [0,0]
.
As for the extra info part, it's going to be a bit more complicated and should be tackled together with #636. Will get back to it after @MichaelsJP has had time to look at that one.