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

Add default radius for OSRM snapping #922

Closed
jcoupey opened this issue May 5, 2023 · 3 comments
Closed

Add default radius for OSRM snapping #922

jcoupey opened this issue May 5, 2023 · 3 comments

Comments

@jcoupey
Copy link
Collaborator

jcoupey commented May 5, 2023

Not sure about Valhalla, but IIRC ORS has some kind of default threshold on allowed snapping distance. The result is that if one of the used coordinates is clearly outside the underlying OSM extract (it would require snapping to a "too far" edge), then a routing error is raised.

OSRM does not have this behavior, thus using plain wrong coordinates can slip unnoticed at the routing level. This typically occurs with switched lon,lat, resulting in all locations being snapped to the same point. This gets bad at the optimization layer, since getting matrices full of zeros result in arbitrary ordering decisions and inconsistent routes.

That last situation is always a pain to explain (see #921 and a bunch of older issues) and should definitely be fixed by issuing a plain routing error. It seems all we have to do is add radiuses options to OSRM queries. Hard-coding a sensible value would probably catch most of the problems.

@nilsnolde
Copy link
Contributor

nilsnolde commented May 5, 2023

Maybe also a (future) case for #903 to add a radius to vehicles & jobs? Though a sensible default maybe makes more sense, less burden on users.

Valhalla is pretty sophisticated with "limits" on snapping:

  • radius: limits the search for correlated edges around input locations to the radius. Which will also mean it'll find multiple edges where it'll expand from all at once. Default is 0, which means, find the closest eligible edge fitting all other constraints (profile, params below, many others)
  • search_cutoff: similar to radius, just another constraint and esp useful when radius is 0. Default is 35 km.
  • minimum_reachability: limits how many nodes need to be minimally reachable from a correlated edge to not be considered part of a network island. Default is 50.

See https://valhalla.github.io/valhalla/api/turn-by-turn/api-reference/#locations.

@jcoupey
Copy link
Collaborator Author

jcoupey commented May 5, 2023

The Valhalla search_cutoff param sounds exactly like what I mentioned for ORS and what is missing in our current use of OSRM. My understanding is that we'd get that same behavior using the OSRM radiuses option. Except if I'm missing some subtlety related to the connected components logic.

Default is 35 km

Something like this would avoid being too strict on snapping (may maybe help for small connected components?) while filtering out obvious coordinates mismatch.

a sensible default maybe makes more sense

Agreed, especially since the defaults could be lowered at the routing stack level if need be.

@jcoupey
Copy link
Collaborator Author

jcoupey commented Aug 12, 2023

Landed with #964.

@jcoupey jcoupey closed this as completed Aug 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants