Project-OSRM / osrm-backend

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

Feature: Add Road type/surface costs to the API #5713

Closed simonberger closed 2 months ago

simonberger commented 4 years ago

I would like to be able to avoid road types at a changeable priority instead of completely excluding them (I read that the excluding parameters was wrongly named avoid previously).

The feature is mainly interesting for biking or walking. I could for example set high(er) costs on primary or secondary roads in order to receive an improved experience at the cost of a dynamically increased length.

systemed commented 4 years ago

This is ultimately #5332, I think, though note the provisos ("It also assumes that the edges that behave this way are fairly sparse, and the overall hierarchy of the graph isn't significantly changed by modifying their weights").

Ultimately OSRM's approach of precomputing shortcuts makes it less suitable for fully customisable weightings, and you may be better off using a traditional algorithm like A. brouter is a good example of using (slightly improved) A for customisable weightings.

simonberger commented 4 years ago

Thank you for your reply. I did not find this pull request when I did my search for a similar issue. It indeed is the right direction. This PR seems in a dead end though. :/ I don' really understand what and the overall hierarchy of the graph isn't significantly changed by modifying their weights means or how small the changes are it can handle. It sounds contrary to what you want to achieve with adding additional weights. I also read some documentation and pull requests to get an idea how OSRM works, what it does differently and where its limitations are. I currently run some tests with valhalla. It supports at least a part of this feature.

systemed commented 4 years ago

It sounds contrary to what you want to achieve with adding additional weights.

Depends what you want to achieve. The scenario outlined in #5332 is when you optionally want to avoid relatively small parts of the road network (private roads, motorways, ferries). That's an entirely legit thing to do and that's what that PR achieves. On the other hand, if you wanted to run the same graph for road biking and gravel biking, that would be a massive difference (probably 40%+ of the graph in some cases) and OSRM is probably not the right solution for that.

simonberger commented 4 years ago

Sure. That is perfectly legit as well. Please close this issue if this won't be implemented at any time in a more complex form as requested here either because it can't be done or is outside the project scope. Otherwise I'll leave it open for a possible feature in the future.

github-actions[bot] commented 3 months ago

This issue seems to be stale. It will be closed in 30 days if no further activity occurs.