Comments (7)
Hi, these signs have the qualifier direction=forward|backward|both which can be used with direction of road. OSM ways are oriented in OSM and BRouter injects the internal tag reversedirection=yes if the routing and the mapping directions of the ways are opposite )
So one can set
in the global context:
assign stop_penalty = A
assign give_way_penalty = B
In the way context:
assign isreversed = reversedirection=yes
which is forwarded to node context as way:isreversed
In node context:
assign initialcost
( chain evaluations )
else if highway=stop then
( if or ( and not way:isreversed direction=forward|both )
( and way:isreversed direction=backward|both ) then stop_penalty else 0
)
else if highway=give_way then
( if or (and not way:isreversed direction=forward|both )
( and way:isreversed direction=backward|both ) then give_way_penalty else 0
)
else if ( chain evaluations )
Note that I currently do not use it in my bike profiles, addressing it by alternative way via progressively increasing initial way cost for main roads.
from brouter-profiles.
There is another thing to consider:
Is well justified discrimination of crossings with explicitly mapped traffic signs, compared to those with real but not mapped signs ? As there is e.g. almost twice as much mapped stop signs, compared to give_way signs, but reality is very opposite.
Aside of that, limitation by giving way/stopping is much bigger deal for cars than bikes.
from brouter-profiles.
Thank you! I did not know about the reversedirection
node property. Now I can add that to my profile.
Yes, I am aware that there are hardly any mapped give_way signs, but I can add them myself to OSM on my frequent routes to try out other routes in the future.
from brouter-profiles.
Thank you! I did not know about the
reversedirection
node property. Now I can add that to my profile.
@philippguertler Note that reversedirection
is a way property , not a node property.
Well, it is not even a true way property. It is not an OSM tag, but this pseudotag is generated by BRouter during routing calculation. That is why its value has to be assigned to a way context variable and forwarded then from the way context to node context. Then it can be evaluated with the node property tag direction=*
from brouter-profiles.
So one can set in the global context:
set stop_penalty = A set give_way_penalty = B
In the way context:
Set isreversed = reversedirection=yes
which is forwarded to node context as
way:isreversed
In node context:
set initialcost ( chain evaluations ) else if highway=stop then ( if or ( and way:isreversed=false direction=forward|both ) ( and way:isreversed=true direction=backward|both ) then stop_penalty else 0 ) else if highway=give_way then ( if or (and way:isreversed=false direction=forward|both ) ( and way:isreversed=true direction=backward|both ) then give_way_penalty else 0 ) else if ( chain evaluations )
Thank you for showing this hidden trick and sorry for commenting at such an old issue, but I just ran into the same problem and I'm unable to get your solution working.
"set" is an unavailable command (only "assign" is allowed), but even when I use "assign" at way context there is no lookup name "way" available at node context. Is there some other hidden feature is this a problem with my profile...? It would be really nice if we could get this working! I'm able to use "reversedirection=yes" at way context for avoiding oneway streets in the wrong direction.
I'm trying to add this feature to my long distance cycling profile
from brouter-profiles.
@FFMbyBicycle You are right, assign, not set.
I have also used incorrectly way:is_ldcr=false
. Not sure what I was thinking about then,
probably a weird subconscious idea "If there is a colon, it must be a lookups value", while it is a normal variable. :-)
I have just tried insertion of the following code to the standard trekking profile on brouter.de/brouter-web/ , just to verify the feature, and it works:
---context:node # following code refers to node tags
assign nodeis_ldcr = way:is_ldcr
I have fixed the code above, check if it or the idea behind works for you.
from brouter-profiles.
Thanks a lot, now it is working and I learned a lot! I don't know what I made wrong in the first place, but now it is fine and part of my profile
I just added the case where the sign direction is unknown. Just in case...
from brouter-profiles.
Related Issues (20)
- Not avoiding an unpleasant way HOT 3
- cost for routing over "ford" HOT 16
- Profile Hiking/Trekking near nature HOT 17
- Missing route types used in Budapest HOT 13
- traffic_calming nodes not evaluated for cost factor HOT 3
- sidewalk HOT 1
- Main vs dedicated profiles HOT 9
- Missing Commuting profile HOT 2
- Electric bicycle trailer for children HOT 16
- Profiles do not contain expressions for context way (error Osmand 2019/07) HOT 6
- Brouter-profile for touring cyclists with luggage -> long-distance travel HOT 7
- > a script to generate the content of this repo directly might be useful. HOT 1
- Ascent in hiking profile HOT 12
- Road-race bike profile with 5=No-Flats mode HOT 2
- Ignore bicycle=use_sidepath ways HOT 3
- Add penalty for railway crossings?! HOT 2
- Trekking-dry and other profiles select 16%+ descent on grade2 track HOT 4
- profile=hiking-mountain routes over way with foot=no
- Cross-country skiing profile for Android app
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from brouter-profiles.