Skip to content

Commit 261fd2f

Browse files
authored
Improve bike handling for highway=living_street (graphhopper#3032)
* Improve bike handling for highway=living_street * Run bicycles at tagged maxspeed if allowed and possible * Fix test * Revert allow maxspeed if possible and only increase living_street highway speed to 6 for bicycles as suggested in review * Fix test
1 parent b5edf20 commit 261fd2f

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

core/src/main/java/com/graphhopper/routing/util/parsers/BikeCommonAverageSpeedParser.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ protected BikeCommonAverageSpeedParser(DecimalEncodedValue speedEnc, EnumEncoded
6868
setSurfaceSpeed("sand", PUSHING_SECTION_SPEED);
6969
setSurfaceSpeed("wood", PUSHING_SECTION_SPEED);
7070

71-
setHighwaySpeed("living_street", PUSHING_SECTION_SPEED);
71+
setHighwaySpeed("living_street", 6);
7272
setHighwaySpeed("steps", MIN_SPEED);
7373

7474
setHighwaySpeed("cycleway", 18);
@@ -156,10 +156,9 @@ else if (way.hasTag("bicycle", "yes"))
156156
if (way.hasTag("surface") && surfaceSpeed == null
157157
|| way.hasTag("bicycle", "dismount")
158158
|| way.hasTag("railway", "platform")
159-
|| pushingRestriction && !way.hasTag("bicycle", INTENDED)) {
159+
|| pushingRestriction && !way.hasTag("bicycle", INTENDED)
160+
|| way.hasTag("service")) {
160161
speed = PUSHING_SECTION_SPEED;
161-
} else if (way.hasTag("service")) {
162-
speed = highwaySpeeds.get("living_street");
163162
} else if ("track".equals(highwayValue) ||
164163
"bridleway".equals(highwayValue) ) {
165164
if (surfaceSpeed != null)

core/src/test/java/com/graphhopper/routing/util/parsers/BikeTagParserTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ public void testSpeedAndPriority() {
7676
way.setTag("scenic", "yes");
7777
assertPriorityAndSpeed(AVOID_MORE, 18, way);
7878

79+
way.clearTags();
80+
way.setTag("highway", "living_street");
81+
assertPriorityAndSpeed(UNCHANGED, 6, way);
82+
7983
// Pushing section: this is fine as we obey the law!
8084
way.clearTags();
8185
way.setTag("highway", "footway");

0 commit comments

Comments
 (0)