Project-OSRM / osrm-backend

Open Source Routing Machine - C++ backend
http://map.project-osrm.org
BSD 2-Clause "Simplified" License
6.35k stars 3.37k forks source link

OSRM sometimes seems to prefer byways instead of main motorways (car), no idea why looking at OSM tags #6114

Open MathiasVersichele opened 3 years ago

MathiasVersichele commented 3 years ago

An example: https://map.project-osrm.org/?z=15&center=51.827888%2C5.253696&loc=51.817635%2C5.260327&loc=51.838111%2C5.247002&hl=en&alt=0&srv=0

image

Why is OSRM routing along the byway (where you also need to cross traffic) instead of continuing along the main motorway ?

This is a segment of the main motorway:

image

This is a segment of the byway:

image

Doesn't look like tags can explain this here...

mjjbell commented 3 years ago

I suspect it's due to the on-ramp being faster than the same section of the motorway. Perhaps the junction is not being penalised enough when performing the routing search.

https://map.project-osrm.org/debug/car.html#15.87/51.8301/5.2555

image

MathiasVersichele commented 3 years ago

it's weird that the main motorway is labeled as 80km/h in your screenshot, while in OSM it's tagged as maxspeed=100 (just double-checked)

mjjbell commented 3 years ago

This is due to the speed_reduction heuristic applied to max speed OSM tags.

https://github.com/Project-OSRM/osrm-backend/blob/dca35dcc8676df6fa93f491a7b157136918173d5/profiles/car.lua#L37

https://github.com/Project-OSRM/osrm-backend/blob/dca35dcc8676df6fa93f491a7b157136918173d5/profiles/lib/way_handlers.lua#L434-L447

The on-ramp has a max speed of 130 km/h, so it's still deemed to be faster after the reduction.