Open ajay-gh opened 2 years ago
Brouter uses freely configurable routing profiles. Routing works by assigning a cost for each type of way which can be either an initialcost which is applied once per way or a costfactor which is multipled by the distance and therefore increases for larger ways.
You should be able to extend an existing profile to also avoid tunnels.
More details can be found in the Profile Developers Guide
Thank you Zod, I looked at the structure of the existing profiles, but have to admit, I would need to know where the data (for the tunnels) would come from, and how they are labelled or addressed, and ideally a simple example. Based on my limited knowledge and skills, I am afraid I am stuck. But I 'll carefully check the prifile dev guide again.
BRouter uses OSM as source and therefore uses the same tags. Not all tags are available, but a limited subset which has been proven suitable for routing. The easiest way would be to adapt an existing profile and check the data tab in brouter-web (instructions).
Just plan an example route and see which tags are on the tunnels and create a custom profile which assigns ways with those tags a higher cost.
@ajay-gh: Which profile are you using as motorcycle rider?
I would know how to add a reasonable penalty in trekking.brf cycling profile but looking (for the first time) in car-eco.brf it is far clear to me how to do that based on that profile
assign costfactor = if equal maxspeed 0 then 10000 else 0
As far as I understand the costfactor should be >=1 but not much larger than one, not something 0 or 10000 is.
If we consider the istunnel as logical expression determining if the road segment is a tunnel, we can replace expression
assign costfactor ...
by
assign costfactor_raw ....
and behind that write:
assign costfactor = if istunnel then costfactor_raw else add costfactor_raw tunnel_penalty
tunnel_penalty
is number >0 pretending the given length of a tunnel is long ( <current expression for costfactor> + <tunnel penalty>)
times it's physical length.
The penalty should not be too high, otherwise it would avoid even short tunnels, choosing eventually long detours instead. For the value 99, a 100 m long tunnel is considered as 10+ km long and could be avoided up to about 10 km long detour.
Thank you all for your inputs. I learned a lot over the last two weeks (about how these things work in brouter, as well as in Graphhopper). I could plough my way through and develop a usable profile. But when I tried to work it out, I come to realize that I am missing something. It is a complete guide to the syntax used (not examples or partial lists), and a complete list of allowed tags (again not just examples). The above mentioned profile developers guide seems to me "incomplete". Is this because the developers or typical users of this guide are using additional reference documents (some not listed under "other ressources") ? Thanks
Another aspect is that costs and penalties do always involve a lot of trial and error. There is no way to know "how much of it" (typically a number set) does let you go through a 500m long tunnel, and avoids routing through a 5km long tunnel. I wonder how the ADAC map / routing engine does actually avoid such problem (they let you choose "do not use tunnels longer than"). Could it be that such a routing limitation cannot be implemented with OSM, regardless of what brouter is able to do because it requires tags simply not available with OSM ?
IMHO, the syntax description is like complete. Allowed tags/tagvalues are exhaustedly listed ( with Brouter-defined synonyms ) in the text file lookups.dat, that is usually at the same folder as profiles.
Theoretically, tunnel length info could be extracted or calculated from OSM data, but currently such info is not available to profiles to work with.
I do not see much reason for hard cut off after some length. Like why e.g. 4.99 km tunnel is OK, but 5.00 km tunnel must be avoided? I think a high cost per length is better, approaching tunnels the same way as other undesired, but sometimes unavoidable roads.
Ask yourself what maximal length of detour is acceptable for you to avoid a tunnel of a unit length. Then use such a value as the ( minimal) tunnel costfactor.
@poutnikl, that is all possible, or shall I say likely ? My comment wasn't meant as a critique (of a great service). All I was saying is, that I can't find it a) in the "guide" or in the "resources" at the end. So when an expert says it is all there it either means I should check again (and likely find it next time), OR it means that enough information is in the docs but only for the reader with enough background knowledge (which I do not have it appears). Remember, everything has 3 sides, the one you see, the one I see, and the one we both don't see.
@ajay-gh I may should formulate it rather: What about syntax do you miss particularly?
A feature request, I hope it's okay to list it as an issue. My apology if not.
Is there a way that the functionality of brouter could (easily) be extended in such a way that in a profile the user cannot only request "avoid tolls" or "avoid highways", but also "avoid tunnels", or even better "avoid tunnels longer than ...". The table provided through this link ( https://wiki.openstreetmap.org/wiki/Routing/online_routers ) seems to indicate that this can be configured in brouter, but I do not see where and how.
Long Tunnels can be a serious thread to the safety of motorcycle riders for several reasons. A way to route around them (offline with brouter) would be a great feature.