abrensch / brouter

configurable OSM offline router with elevation awareness, Java + Android
MIT License
510 stars 123 forks source link

bicycle routing should never route against the oneway in roundabouts #229

Closed voschix closed 1 year ago

voschix commented 4 years ago

Under certain circumstances the bicycle profiles in the web BRouter web instance route agins the oneway in roundabouts. This is seems to be a consequence of the the relatively low penalty for going the wrong way in lower level roads. The idea, which I condivide, is to accept short stretches of wrong-way roads being overcome by pushing your bike. Unfortnately the same behaviour is applied to roundab'uts, wher it is not a good idea. Example.

Note that the existing sidewalk is not (yet) mapped in the example, neither as a sidewalk=* nor as a separate footway. A future version of the profile could take into account the existence of a sidewalk where you could push your bike for a short distance instead of going the long way around the roundabout.

polyscias commented 4 years ago

What I think would be nice is to do a real life experiment that measures the normal way and this "shortcut", is it really faster? If not, the current parameters are not right, maybe time/distance should be added to mount/dismount the bike.

Very similar problems arise when adding traffic signals, it almost looks like we need special rules for crossings/junctions.

Phyks commented 4 years ago

I don't have a perfect example at hand since there is a separate footway drawn, but I know about this roundabout hbrouter.de/brouter-web/#map=18/45.74855/3.09461/cyclosm&lonlats=3.09307,45.748211;3.094577,45.748506 which is both very large and very dangerous with a bicycle.

Imagine the separate footway was not mapped, it definitely makes sense to have an incline to go walking backwards rather than doing a full (long) loop on a dangerous roundabout.

Best

voschix commented 4 years ago

What I think would be nice is to do a real life experiment that measures the normal way and this "shortcut", is it really faster? If not, the current parameters are not right, maybe time/distance should be added to mount/dismount the bike.

We can discuss this when we have mapped sidewalks. But in the case I have indicated, where there are no mapped sidewalk, the routing should always be clockwise around the centre of the roundabout - no exceptions.

polyscias commented 4 years ago

the routing should always be clockwise around the centre of the roundabout - no exceptions.

No exception, so also if people decide to walk, counter-clockwise?

For this it is good to think a bit like a router and see if you can, using only the OSM data, make the right decision.

voschix commented 4 years ago

On Sat, 14 Mar 2020 at 09:39, polyscias notifications@github.com wrote:

the routing should always be clockwise around the centre of the roundabout

  • no exceptions.

No exception, so also if people decide to walk, counter-clockwise?

We are talking here about the trekking bicycle profile, not about pedestrian or other vehicles

For this it is good to think a bit like a router and see if you can, using only the OSM data, make the right decision.

I think a lot like an end user of the product. In this case the bicycle router should not send me against the traffic flow in a roundabout for which it does not know about the existence of sidewalks (missing data in OSM in the specific example, admittedly). And even if there were a sidewalk=right it would still not know about any pedestrian crossings. Again, in reality in the example roundabout there are sidewalks and the necessary pedestrian crossings with islands, but all that is not yet mapped, hence the bicycle router should produce a route that is compatible with the highway code, and based on what it is available data in OSM.

https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virus-free. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#m_3951179926673976880_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

polyscias commented 3 years ago

I had a look at the trekking profile:

#
# handle one-ways. On primary roads, wrong-oneways should
# be close to forbidden, while on other ways we just add
# 4 to the costfactor (making it at least 5 - you are allowed
# to push your bike)
#
assign badoneway =
       if reversedirection=yes then
         if oneway:bicycle=yes then true
         else if oneway= then junction=roundabout
         else oneway=yes|true|1
       else oneway=-1

assign onewaypenalty =
       if ( badoneway ) then
       (
         if ( cycleway=opposite|opposite_lane|opposite_track ) then 0
         else if ( oneway:bicycle=no                         ) then 0
         else if ( highway=primary|primary_link              ) then 50
         else if ( highway=secondary|secondary_link          ) then 30
         else if ( highway=tertiary|tertiary_link            ) then 20
         else 4.0
       )
       else 0.0

If the agreement is that bicycle routing should never route against the oneway in roundabouts then I think it is just a matter of adding something like else if ( junction=roundabout ) then 50 just before the else 4.0 at the end of the code snippet

quaelnix commented 1 year ago

Done: https://github.com/abrensch/brouter/commit/5e217ff67bfe4612e94299ea301806e08c77d144