Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

driving-hgv routing over way with hgv=no #816

Closed
TheGreatRefrigerator opened this issue Oct 9, 2020 · 8 comments · Fixed by #1126
Closed

driving-hgv routing over way with hgv=no #816

TheGreatRefrigerator opened this issue Oct 9, 2020 · 8 comments · Fixed by #1126
Assignees
Labels
bug 🐞 Erroneous behavior of the backend

Comments

@TheGreatRefrigerator
Copy link
Contributor

TheGreatRefrigerator commented Oct 9, 2020

Here's what I did

curl 'https://api.openrouteservice.org/v2/directions/driving-hgv/geojson?api_key=xxx' -H 'Accept: application/json, text/plain, */*' -H 'Accept-Language: de,en-US;q=0.7,en;q=0.3' --compressed -H 'Content-Type: application/json;charset=utf-8' --data-raw '{"preference":"recommended","instructions":true,"geometry":true,"units":"m","attributes":["detourfactor","percentage"],"instructions_format":"html","elevation":true,"coordinates":[[-73.916973,40.878103],[-73.971437,40.794616]],"alternative_routes":{"target_count":2},"extra_info":["steepness","waytype","surface"]}'

Here's what I got

{"type":"FeatureCollection","features":[{"bbox":[-73.978616,40.79393,0.68,-73.914543,40.884623,66.5],"type":"Feature","properties":{"ascent":140.1,"descent":150.5,"segments":[{"distance":13261.4,"duration":721.7,"steps":[{"distance":53.7,"duration":13.9,"type":11,"instruction":"Head northeast","name":"-","way_points":[0,6]},{"distance":114.8,"duration":23.3,"type":1,"instruction":"Turn right onto <b>Kappock Street</b>","name":"Kappock Street","way_points":[6,17]},{"distance":668.3,"duration":48.1,"type":13,"instruction":"Keep right onto <b>Henry Hudson Parkway East</b>","name":"Henry Hudson Parkway East","way_points":[17,47]},{"distance":33.0,"duration":7.9,"type":2,"instruction":"Turn sharp left onto <b>West 232nd Street</b>","name":"West 232nd Street","way_points":[47,50]},{"distance":126.7,"duration":13.0,"type":0,"instruction":"Turn left onto <b>Henry Hudson Parkway West</b>","name":"Henry Hudson Parkway West","way_points":[50,55]},{"distance":11250.5,"duration":484.5,"type":12,"instruction":"Keep left","name":"-","way_points":[55,177]},{"distance":542.2,"duration":65.1,"type":13,"instruction":"Keep right","name":"-","way_points":[177,204]},{"distance":367.9,"duration":46.9,"type":13,"instruction":"Keep right onto <b>West 95th Street</b>","name":"West 95th Street","way_points":[204,212]},{"distance":86.9,"duration":15.9,"type":0,"instruction":"Turn left onto <b>Broadway</b>","name":"Broadway","way_points":[212,214]},{"distance":17.3,"duration":3.1,"type":1,"instruction":"Turn right onto <b>West 96th Street</b>","name":"West 96th Street","way_points":[214,216]},{"distance":0.0,"duration":0.0,"type":10,"instruction":"Arrive at West 96th Street, on the left","name":"-","way_points":[216,216]}],"detourfactor":1.28,"percentage":100.0,"ascent":140.10839578700558,"descent":150.48339578700563}],"extras":{"surface":{"values":[[0,216,3]],"summary":[{"value":3.0,"distance":13261.4,"amount":100.0}]},"waytypes":{"values":[[0,6,3],[6,47,2],[47,50,3],[50,55,2],[55,204,1],[204,212,2],[212,214,1],[214,216,2]],"summary":[{"value":1.0,"distance":11879.7,"amount":89.58},{"value":2.0,"distance":1295.0,"amount":9.77},{"value":3.0,"distance":86.7,"amount":0.65}]},"steepness":{"values":[[0,39,1],[39,90,-1],[90,94,3],[94,205,0],[205,216,1]],"summary":[{"value":0.0,"distance":8799.7,"amount":66.36},{"value":-1.0,"distance":3057.1,"amount":23.05},{"value":1.0,"distance":1090.1,"amount":8.22},{"value":3.0,"distance":314.5,"amount":2.37}]}},"summary":{"distance":13261.4,"duration":721.7},"way_points":[0,216]},"geometry":{"coordinates":[[-73.917039,40.878171,48.0],[-73.916953,40.878218,48.0],[-73.916878,40.878263,48.0],[-73.916814,40.878323,48.0],[-73.916806,40.878376,48.0],[-73.916842,40.878434,48.0],[-73.916979,40.878522,48.0],[-73.916952,40.87855,47.7],[-73.916853,40.878685,47.3],[-73.916805,40.878787,47.0],[-73.916764,40.878873,46.4],[-73.916728,40.879103,48.4],[-73.916729,40.879143,49.6],[-73.916726,40.879253,50.6],[-73.916725,40.879316,51.5],[-73.916743,40.87939,52.3],[-73.916739,40.879434,53.0],[-73.916759,40.879512,53.6],[-73.91685,40.879731,54.9],[-73.916944,40.879867,55.7],[-73.916966,40.879889,56.4],[-73.91701,40.879936,57.2],[-73.91723,40.880113,58.7],[-73.917288,40.880149,59.4],[-73.91736,40.880193,60.3],[-73.917627,40.880378,63.3],[-73.917697,40.880512,63.8],[-73.9177,40.880591,63.7],[-73.917695,40.880662,63.6],[-73.917654,40.880751,63.5],[-73.917584,40.880827,63.4],[-73.917302,40.881059,63.0],[-73.917058,40.881286,62.8],[-73.916804,40.88154,63.0],[-73.916487,40.881807,63.5],[-73.916177,40.882087,64.3],[-73.915913,40.882344,65.0],[-73.915779,40.882489,65.2],[-73.915547,40.882802,65.8],[-73.915383,40.883072,66.5],[-73.915301,40.883228,66.4],[-73.915183,40.883475,65.9],[-73.915136,40.883596,65.7],[-73.91504,40.883925,64.8],[-73.914937,40.884107,64.2],[-73.914807,40.884273,63.6],[-73.914602,40.884473,63.1],[-73.914543,40.884526,62.9],[-73.91459,40.884538,62.8],[-73.914863,40.884609,62.1],[-73.914915,40.884623,61.7],[-73.914969,40.884565,61.3],[-73.915169,40.884334,60.7],[-73.915308,40.884132,60.6],[-73.915512,40.883762,60.2],[-73.915576,40.883606,60.1],[-73.915602,40.883478,60.2],[-73.91564,40.883306,60.3],[-73.915707,40.883138,60.5],[-73.915894,40.882815,60.6],[-73.916091,40.882482,61.9],[-73.916224,40.882338,62.3],[-73.916413,40.882158,63.1],[-73.916718,40.88189,64.3],[-73.917279,40.881379,66.4],[-73.919323,40.879696,55.0],[-73.919749,40.879396,52.3],[-73.919949,40.879269,51.2],[-73.924162,40.876491,47.8],[-73.924529,40.876301,47.3],[-73.925641,40.875836,44.3],[-73.925823,40.875779,43.8],[-73.926271,40.875507,41.6],[-73.927105,40.874897,37.9],[-73.927629,40.874482,35.7],[-73.928135,40.874028,34.5],[-73.92859,40.873535,32.8],[-73.928959,40.873061,30.2],[-73.929346,40.872483,26.1],[-73.929706,40.871886,21.9],[-73.930091,40.871122,19.0],[-73.930323,40.870674,19.2],[-73.930554,40.87022,20.2],[-73.930759,40.869824,21.1],[-73.930889,40.869571,21.7],[-73.931705,40.86802,19.2],[-73.932666,40.866508,13.1],[-73.932791,40.866317,12.4],[-73.932946,40.866035,11.3],[-73.933745,40.864513,5.1],[-73.933985,40.864075,5.2],[-73.934414,40.8634,9.8],[-73.935207,40.862262,27.3],[-73.935378,40.861983,30.3],[-73.935933,40.860946,30.2],[-73.936228,40.860497,26.0],[-73.936374,40.860302,24.7],[-73.93791,40.85851,18.0],[-73.938914,40.857205,18.8],[-73.939601,40.856277,24.5],[-73.940313,40.855251,24.1],[-73.94142,40.853518,25.5],[-73.941807,40.852966,24.7],[-73.94209,40.852622,22.6],[-73.94233,40.852362,21.3],[-73.942554,40.852135,19.9],[-73.942768,40.851947,19.0],[-73.943305,40.851498,21.2],[-73.943521,40.851334,23.7],[-73.943884,40.851051,26.7],[-73.944107,40.850869,26.9],[-73.944545,40.850454,26.8],[-73.944765,40.850182,26.0],[-73.944928,40.849893,23.4],[-73.945124,40.849436,18.0],[-73.945213,40.84905,17.0],[-73.945256,40.84862,16.7],[-73.945263,40.848251,16.4],[-73.945237,40.847884,16.3],[-73.945234,40.847692,16.4],[-73.945211,40.846949,17.0],[-73.945087,40.844637,18.6],[-73.945087,40.844215,19.0],[-73.945121,40.843657,20.0],[-73.945173,40.843209,21.1],[-73.94537,40.842319,24.7],[-73.945508,40.841865,26.3],[-73.945679,40.84141,28.6],[-73.945774,40.841209,29.1],[-73.94592,40.840904,29.1],[-73.946289,40.8403,27.3],[-73.946589,40.839839,24.6],[-73.946881,40.839449,21.6],[-73.948081,40.838113,12.2],[-73.94873,40.837411,6.3],[-73.948994,40.837068,4.6],[-73.949202,40.83662,3.4],[-73.949811,40.834654,1.7],[-73.950168,40.833397,0.7],[-73.950807,40.831394,1.1],[-73.950962,40.831086,2.1],[-73.95172,40.829582,8.7],[-73.951896,40.829344,9.0],[-73.952083,40.829082,8.9],[-73.952389,40.828709,8.3],[-73.956274,40.824491,5.3],[-73.957871,40.822417,5.5],[-73.959821,40.819964,6.8],[-73.960851,40.818791,7.7],[-73.961808,40.817878,8.4],[-73.962965,40.816776,5.4],[-73.963239,40.81651,4.8],[-73.963971,40.815636,5.5],[-73.964065,40.815519,5.8],[-73.964336,40.815125,7.1],[-73.965114,40.81382,6.2],[-73.96568,40.813031,5.3],[-73.966244,40.812306,7.0],[-73.966652,40.81175,8.4],[-73.966965,40.811285,8.1],[-73.968511,40.808845,6.2],[-73.968939,40.808206,6.0],[-73.969976,40.806806,6.2],[-73.97165,40.804661,7.4],[-73.97248,40.803548,7.6],[-73.973462,40.802164,7.1],[-73.974243,40.800982,6.6],[-73.974672,40.800222,9.2],[-73.97505,40.79939,12.8],[-73.97511,40.799229,13.3],[-73.975212,40.798956,13.2],[-73.97535,40.798585,11.8],[-73.975908,40.79722,6.8],[-73.976092,40.79687,7.9],[-73.976235,40.796635,8.4],[-73.976436,40.796355,9.0],[-73.976626,40.796135,9.3],[-73.976735,40.796025,9.4],[-73.977436,40.795582,9.6],[-73.978302,40.795122,9.1],[-73.978434,40.795025,9.1],[-73.978532,40.794928,9.1],[-73.978592,40.794837,9.0],[-73.978616,40.794759,9.0],[-73.978602,40.794635,9.0],[-73.978533,40.794515,9.0],[-73.978442,40.794439,9.0],[-73.978315,40.794372,9.1],[-73.978198,40.794339,9.2],[-73.978127,40.794335,9.2],[-73.97795,40.794362,9.3],[-73.977862,40.794395,9.5],[-73.977717,40.794491,9.6],[-73.977209,40.79506,10.3],[-73.977107,40.795186,11.2],[-73.977019,40.795293,12.0],[-73.976859,40.795475,13.8],[-73.976693,40.795602,14.6],[-73.976587,40.795654,15.5],[-73.976484,40.795673,16.3],[-73.976344,40.795662,17.2],[-73.976278,40.795633,18.0],[-73.976182,40.795561,18.9],[-73.976123,40.795545,19.7],[-73.975985,40.79552,20.5],[-73.975793,40.795467,21.3],[-73.97572,40.795436,22.2],[-73.974587,40.794946,28.1],[-73.973704,40.794578,29.3],[-73.973072,40.79431,30.4],[-73.972416,40.794038,32.5],[-73.972305,40.793992,32.9],[-73.972155,40.79393,33.4],[-73.971867,40.794345,35.6],[-73.971669,40.79462,36.9],[-73.971578,40.794576,37.3],[-73.971492,40.79454,37.6]],"type":"LineString"}}],"bbox":[-73.978616,40.79393,0.68,-73.914543,40.884623,66.5],"metadata":{"attribution":"openrouteservice.org | OpenStreetMap contributors","service":"routing","timestamp":1602282570229,"query":{"coordinates":[[-73.916973,40.878103],[-73.971437,40.794616]],"profile":"driving-hgv","preference":"recommended","format":"geojson","units":"m","geometry":true,"instructions":true,"instructions_format":"html","attributes":["detourfactor","percentage"],"elevation":true,"extra_info":["steepness","waytype","surface"],"alternative_routes":{"target_count":2}},"engine":{"version":"6.3.0","build_date":"2020-09-21T01:00:26Z","graph_date":"1970-01-01T00:00:00Z"}}}

Here's what I was expecting

The route avoiding a way with tag hgv=no

See also

https://maps.openrouteservice.org/directions?n1=40.746702&n2=-73.912582&n3=10&a=40.878103,-73.916973,40.794616,-73.971437&b=4a&c=0&k1=en-US&k2=km

https://www.openstreetmap.org/way/8608691#map=16/40.8135/-73.9649

@TheGreatRefrigerator TheGreatRefrigerator added the bug 🐞 Erroneous behavior of the backend label Oct 9, 2020
@aoles
Copy link
Member

aoles commented Oct 10, 2020

Thanks for reporting this! I can confirm the problem and I will look into it.

@aoles aoles self-assigned this Oct 10, 2020
@aoles
Copy link
Member

aoles commented Oct 12, 2020

Access restrictions for hgv driving profiles are currently not resolved on ORS maps because of a missing vehicle_type parameter under route options of the request. The restrictions are evaluated by the HeavyVehicleEdgeFilter which is enabled only when this parameter is set.

I couldn't find any recent changes in handling of vehicle_type in the backend. @TheGreatRefrigerator have there been any changes to the hgv subprofiles in the maps client maybe?

@TheGreatRefrigerator
Copy link
Contributor Author

TheGreatRefrigerator commented Oct 13, 2020

have there been any changes to the hgv subprofiles in the maps client maybe?

No recent. See GIScience/openrouteservice-app@8c54a64

I've changed it back then to only add the vehicle_type if there are actual vehicle restrictions (length, width) set.

The documentation is kind of ambigous for this, as it says the default value for vehicle_type is hgv
which would make sense if the driving-hgv profile is chosen.

@aoles do you think it's feasible to have vehicle_type set to hgv by default and only read other vehicle types if they are passed with this parameter?
in here i guess

@aoles
Copy link
Member

aoles commented Oct 14, 2020

We certainly could introduce a default value for vehicle_type. I don't think this has ever been the case before, though, so I'm not sure why the documentation would say otherwise.

@koebi
Copy link
Collaborator

koebi commented Feb 4, 2022

I'd assume that the changes in #1054 also fix this issue, but it seems that they don't, as the query above still happily routes over the hgv=no-way as well as an example query will route via Saupfercheckweg mentioned in #1006.

@koebi koebi closed this as completed Feb 4, 2022
@koebi koebi reopened this Feb 4, 2022
@aoles
Copy link
Member

aoles commented Feb 4, 2022

#1054 fixes the problem that setting both vehicle_type and options.profile_params.restrictions was required in order to resolve vehicle_type-specific access restrictions. The remaining issue observed in the maps client originates from the fact that vehicle_type is not set by the client unless some vehicle parameters are used. As long as we want to have CH as the default routing algorithm setting a default vehicle_type value seems unfeasible as it would require the use of a flexible routing algorithm different than CH.

@koebi
Copy link
Collaborator

koebi commented Feb 8, 2022

It seems a bit unintuitive that hgv access restrictions are not checked when using the driving-hgv-profile.
In fact, the API docs state that the default vehicle_type is hgv, so at least that should be changed.

IMO, when using the hgv-profile without any further settings, OSMs hgv:*-access restrictions should be considered.
If not, what even is the difference between the hgv and the car profiles?

@aoles
Copy link
Member

aoles commented Feb 10, 2022

Thanks, these are all fair points!

IMO, when using the hgv-profile without any further settings, OSMs hgv:*-access restrictions should be considered. If not, what even is the difference between the hgv and the car profiles?

While hgv-specific access restrictions are certainly important, there is still a number of other differences between these two profiles. Apart from a distinct set of default road speeds, the main difference between car and hgv profiles is that for the latter one the recommended weighting uses additional prioritization of certain road types.

It seems a bit unintuitive that hgv access restrictions are not checked when using the driving-hgv-profile. In fact, the API docs state that the default vehicle_type is hgv, so at least that should be changed.

I couldn't agree more on this. In particular, I'm not sure where the statement in the API docs about the default vehicle_type = hgv comes from? As far as I could tell this has never been the case. There are, however, some technical constrains which need to be taken into account when settling on a default value, see below.

The main challenge here is to take these default hgv restrictions into account when performing routing with CH which is the default algorithm when no additional parameters are set. This is not entirely easily to implement because CH does not allow for setting any additional edge filters, both during contraction and routing. I've solved this by introducing an additional HgvAccessWeighting to the pipeline which acts as a wrapper calling the HeavyVehicleEdgeFilter before the actual call to the underlying weighting. This allows to exclude edges with hgv:no from CH routing while still keeping them in the main graph available to the rest of the routing algorithms.

blackbirdem added a commit to GIScience/openrouteservice-js that referenced this issue Jan 9, 2023
…hgv'

when profile is 'driving-hgv' and no vehicle type is given, the API will default to hgv itself
therefore it is unnecessary to set it as a default parameter in the request
see also GIScience/openrouteservice#816
blackbirdem added a commit to GIScience/openrouteservice-js that referenced this issue Jan 10, 2023
…hgv'

when profile is 'driving-hgv' and no vehicle type is given, the API will default to hgv itself
therefore it is unnecessary to set it as a default parameter in the request
see also GIScience/openrouteservice#816
blackbirdem added a commit to GIScience/openrouteservice-js that referenced this issue Jan 10, 2023
…hgv'

when profile is 'driving-hgv' and no vehicle type is given, the API will default to hgv itself
therefore it is unnecessary to set it as a default parameter in the request
see also GIScience/openrouteservice#816
blackbirdem added a commit to GIScience/openrouteservice-js that referenced this issue Feb 1, 2023
…hgv'

when profile is 'driving-hgv' and no vehicle type is given, the API will default to hgv itself
therefore it is unnecessary to set it as a default parameter in the request
see also GIScience/openrouteservice#816
blackbirdem added a commit to GIScience/openrouteservice-js that referenced this issue Mar 21, 2023
…hgv'

when profile is 'driving-hgv' and no vehicle type is given, the API will default to hgv itself
therefore it is unnecessary to set it as a default parameter in the request
see also GIScience/openrouteservice#816
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Erroneous behavior of the backend
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants