GIScience / openrouteservice

🌍 The open source route planner api with plenty of features.
https://openrouteservice.org
GNU General Public License v3.0
1.33k stars 379 forks source link

hgv route avoids 'hazmat:no' ways #1813

Open TheGreatRefrigerator opened 3 days ago

TheGreatRefrigerator commented 3 days ago

Is there an existing issue for this?

Where did you encounter this issue?

live API, self-hosted instance

Request URL

https://api.openrouteservice.org/v2/directions/driving-hgv/geojson

POST Request Body

{"coordinates":[[6.962918043136598,45.81735246762025],[6.963899731636048,45.81758800649111]],"elevation":true,"instructions_format":"html","extra_info":["surface","steepness","waytype"],"language":"en","units":"km","preference":"recommended","options":{"profile_params":{"restrictions":{"hazmat":false}},"avoid_polygons":{"type":"MultiPolygon","coordinates":[]}}}

Response

Response ![grafik](https://github.com/GIScience/openrouteservice/assets/23240110/cfe2da7e-b0e5-461c-b132-049bca201334)

Current behavior

The route won't use way : https://www.openstreetmap.org/way/189481307#map=19/45.81754/6.96363 due to the hazmat:no tag.

It can use https://www.openstreetmap.org/way/4525912#map=13/45.8735/6.8924 which has a hazmat value of E (which probably just gets ignored entirely...)

probably due to vehicle type being set to -128 here instead of 128 ?? (but maybe thats some byte value magic) https://github.com/GIScience/openrouteservice/blob/5ded0a3f827915377339a07003ac1d4bfec4a31c/ors-engine/src/main/java/org/heigit/ors/routing/graphhopper/extensions/storages/HeavyVehicleAttributesGraphStorage.java#L102

For the example requests, the edge for the way with id 189481307 this expression will be true and return false in the next lne https://github.com/GIScience/openrouteservice/blob/78ec9adf6bc9214417fa3eca7d35c76ea9a1d4a8/ors-engine/src/main/java/org/heigit/ors/routing/graphhopper/extensions/edgefilters/HeavyVehicleEdgeFilter.java#L158

And therefore assign infinity in https://github.com/GIScience/openrouteservice/blob/27a2e1f80fecd1c6b6667e787bc5cee8dd72c853/ors-engine/src/main/java/org/heigit/ors/routing/graphhopper/extensions/weighting/HgvAccessWeighting.java#L19

For reproducible example click export in the osm link for the way above.

Expected behavior

Properly use hazmat:no ways if hazmat is not set as a vehicle restriction.

Openrouteservice Version

8.1.0

Build date

2024-06-05T10:07:23Z

Graph date

2024-06-25T06:07:40Z

Forum Topic Link

https://ask.openrouteservice.org/t/route-planning-for-hgv-trough-tunnel-mont-blanc/6284/1