bikehopper / graphhopper

Open source routing engine for OpenStreetMap. Use it as Java library or standalone web server.
https://www.graphhopper.com/open-source/
Apache License 2.0
3 stars 0 forks source link

GH #86: Add LANE to withTrafficCyclewayTags #142

Open rsarathy opened 4 months ago

rsarathy commented 4 months ago

Fixes #86:

Screenshot 2024-05-07 at 23 40 17

A painted bike lane is still cycling infrastructure that is shared with car traffic. As such, ways that have cycleway=lane tags but also accommodate car traffic should receive a highway-based penalty.

Adding LANE to withTrafficCyclewayTags allows existing BikeCommonFlagEncoder code to levy a highway-based penalty to the way. This penalty will be p - 1, where p is the highway-based PenaltyCode's level.

graue commented 3 months ago

a highway-based penalty... will be p - 1, where p is the highway-based PenaltyCode's level.

How did you arrive at this formula? What sort of testing have you done to ensure this still gives reasonable routes elsewhere in SF, East Bay, etc?

rsarathy commented 3 months ago

We assign the p - 1 penalty in existing BikeCommonFlagEncoder code:

if (withTrafficCyclewayTags.contains(cyclewayForward))
  cyclewayForwardPenalty = PenaltyCode.from(highwayPenalty).tickDownBy(1).getValue();
if (withTrafficCyclewayTags.contains(cyclewayBackward))
  cyclewayBackwardPenalty = PenaltyCode.from(highwayPenalty).tickDownBy(1).getValue();

I'll play around with other bike-only routes to make sure this doesn't break things.

abhumbla commented 3 months ago

We assign the p - 1 penalty

to be clear, the tickDownBy function goes to the next lower penalty, whatever the value is. it doesn't subtract 1 from the penalty