Skip to content

Commit 2d464da

Browse files
committed
Discourage walking when sidepaths are available
1 parent 30dee5f commit 2d464da

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/main/java/org/opentripplanner/openstreetmap/tagmapping/FinlandMapper.java

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.opentripplanner.openstreetmap.tagmapping;
22

3+
import static org.opentripplanner.openstreetmap.wayproperty.MixinPropertiesBuilder.ofWalkSafety;
34
import static org.opentripplanner.openstreetmap.wayproperty.WayPropertiesBuilder.withModes;
45
import static org.opentripplanner.street.model.StreetTraversalPermission.ALL;
56
import static org.opentripplanner.street.model.StreetTraversalPermission.CAR;
@@ -163,6 +164,12 @@ else if (speedLimit <= 16.65f) {
163164
props.setProperties("highway=service;tunnel=yes;access=destination", withModes(NONE));
164165
props.setProperties("highway=service;access=destination", withModes(ALL).bicycleSafety(1.1));
165166

167+
// Typically if this tag is used on a way, there is also a better option for walking.
168+
// We don't need to set bicycle safety as cycling is not currently allowed on these ways.
169+
props.setMixinProperties("bicycle=use_sidepath", ofWalkSafety(5));
170+
171+
props.setMixinProperties("foot=use_sidepath", ofWalkSafety(8));
172+
166173
// Automobile speeds in Finland.
167174
// General speed limit is 80kph unless signs says otherwise.
168175
props.defaultCarSpeed = 22.22f;

src/test/java/org/opentripplanner/openstreetmap/tagmapping/FinlandMapperTest.java

+15
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,21 @@ public void testSafetyWithMixins() {
162162
wps.getDataForWay(wayWithMixinsAndCustomSafety).walkSafety().forward(),
163163
epsilon
164164
);
165+
166+
OSMWithTags wayWithBicycleSidePath = new OSMWithTags();
167+
wayWithBicycleSidePath.addTag("bicycle", "use_sidepath");
168+
assertEquals(
169+
8,
170+
wps.getDataForWay(wayWithBicycleSidePath).walkSafety().forward(),
171+
epsilon
172+
);
173+
OSMWithTags wayWithFootSidePath = new OSMWithTags();
174+
wayWithFootSidePath.addTag("foot", "use_sidepath");
175+
assertEquals(
176+
12.8,
177+
wps.getDataForWay(wayWithFootSidePath).walkSafety().forward(),
178+
epsilon
179+
);
165180
}
166181

167182
@Test

0 commit comments

Comments
 (0)