GithubHelp home page GithubHelp logo

Comments (7)

poutnikl avatar poutnikl commented on June 5, 2024

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.

poutnikl avatar poutnikl commented on June 5, 2024

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.

philippguertler avatar philippguertler commented on June 5, 2024

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.

poutnikl avatar poutnikl commented on June 5, 2024

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.

FFMbyBicycle avatar FFMbyBicycle commented on June 5, 2024

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.

poutnikl avatar poutnikl commented on June 5, 2024

@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.

FFMbyBicycle avatar FFMbyBicycle commented on June 5, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.