Project-OSRM / osrm-backend

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

Ferry ignored for all profiles #6530

Open nilsnolde opened 1 year ago

nilsnolde commented 1 year ago

I was debugging a ferry issue with Valhalla and looks like OSRM has the same problem. E.g. this route from ferry to ferry (Denmark -> Sweden) is ignored and a huge detour is proposed: https://www.openstreetmap.org/directions?engine=fossgis_osrm_foot&route=57.43404%2C10.53637%3B57.70073%2C11.97682#map=9/57.0612/11.4890

If you switch to Graphhopper or Valhalla, it's taking the ferry. Valhalla falsely ignores it for car & truck as well though.. Hence the debugging. Makes me think it's data-driven, but couldn't make out the problem yet.. I'll update here when I find the issue, maybe it's a common problem for both engines.

SiarheiFedartsou commented 1 year ago

Not sure what is a reason of the bug, but what seems to be suspicious is that we are not checking value of route to be equal to ferry here. 🤔 https://github.com/Project-OSRM/osrm-backend/blob/41dda32546399f1dc12af1de41668993de44c7dc/profiles/lib/way_handlers.lua#L122

EDIT: actually we do, but a bit implicitly via checking this table https://github.com/Project-OSRM/osrm-backend/blob/41dda32546399f1dc12af1de41668993de44c7dc/profiles/foot.lua#L114

nilsnolde commented 1 year ago

For Valhalla, I think I found the problem, but not sure how OSRM handles that: https://github.com/valhalla/valhalla/issues/3941#issuecomment-1407713742. Basically a data issue and in fact could be pointing to an issue with Graphhopper, rather than us, seems like it doesn't respect access=customers (which Valhalla interprets as "destination only", IMO correctly).

SiarheiFedartsou commented 1 year ago

seems like it doesn't respect access=customers

Hm, I don't see access=customers here. Am I looking at wrong place?

Screenshot 2023-01-29 at 18 35 31 Screenshot 2023-01-29 at 18 36 31
nilsnolde commented 1 year ago

Not on the ferry way, but all edges which were around the ferry terminal on the Danish side, had access=customers tagged. That made Valhalla think they're destination_only, which it doesn't route through on the first pass with bidir A*, only on second pass. However, it never gets there, because the first pass does find a route, it's just a crazy detour. I already changed it to access=permissive which is what it really is IMO, see the changeset.

SiarheiFedartsou commented 1 year ago

Got it, thanks :+1: @nilsnolde

nilsnolde commented 1 year ago

Even if OSRM has a similar problem with the car profile, pedestrian shouldn't respect access=customers IMO, so smth seems to be wrong either with the foot.lua or the way it handles ferry connections. Even if the start point is right on the connection edge to the ferry, it won't take it: https://www.openstreetmap.org/directions?engine=fossgis_osrm_foot&route=57.4347%2C10.5441%3B57.7225%2C11.9675.

nilsnolde commented 1 year ago

Just encountered another one where car doesn't see the ferry (or assumes it's too high cost, though duration tag is 4 h, proposed route is 8 h): https://www.openstreetmap.org/directions?engine=fossgis_osrm_car&route=44.1014%2C-87.6764%3B43.9464%2C-86.4212#map=8/42.858/-87.017

RoutingAPI commented 5 months ago

This is not really a problem of OSRM but the profile used at the OSRM demo instance (routing.openstreetmap.de or router.project-osrm.org). The demo instance just does not have the hardware needed to run the full profile and the changes to the profile at the demo instance result in a lot of ferry routes not being used.

E.g. for the car profile you can check another OSRM example here: https://fast-routing-api.demo.routingapi.net/ that will route from Manitowoc to Ludington via the ferry as it does use the full capabilites of an OSRM car profile.