Skip to content

Commit 4b16394

Browse files
authored
Merge pull request opentripplanner#7598 from HSLdevcom/remove-finland-double-walk-penalty
(Finland) Avoid applying x5 penalty for walking twice, once from foot=use_sidepath and once from bicycle=use_sidepath
2 parents b158df4 + 4d37877 commit 4b16394

3 files changed

Lines changed: 16 additions & 2 deletions

File tree

application/src/main/java/org/opentripplanner/osm/tagmapping/FinlandMapper.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
import org.opentripplanner.framework.functional.FunctionUtils.TriFunction;
1313
import org.opentripplanner.osm.model.OsmEntity;
1414
import org.opentripplanner.osm.wayproperty.WayPropertySet;
15+
import org.opentripplanner.osm.wayproperty.specifier.Condition.Equals;
16+
import org.opentripplanner.osm.wayproperty.specifier.Condition.Not;
17+
import org.opentripplanner.osm.wayproperty.specifier.ExactMatchSpecifier;
1518
import org.opentripplanner.street.model.StreetTraversalPermission;
1619

1720
/**
@@ -182,7 +185,13 @@ else if (speedLimit <= 16.65f) {
182185

183186
// Typically if this tag is used on a way, there is also a better option for walking.
184187
// We don't need to set bicycle safety as cycling is not currently allowed on these ways.
185-
props.setMixinProperties("bicycle=use_sidepath", ofWalkSafety(5));
188+
props.setMixinProperties(
189+
new ExactMatchSpecifier(
190+
new Not(new Equals("foot", "use_sidepath")),
191+
new Equals("bicycle", "use_sidepath")
192+
),
193+
ofWalkSafety(5)
194+
);
186195

187196
// Automobile speeds in Finland.
188197
// General speed limit is 80kph unless signs says otherwise.

application/src/test/java/org/opentripplanner/osm/tagmapping/FinlandMapperTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,11 @@ void testUseSidePath() {
174174
assertEquals(9, wps.getDataForWay(wayWithBicycleSidePath).forward().walkSafety(), EPSILON);
175175
var wayWithFootSidePath = OsmWay.of().withTag("foot", "use_sidepath").build();
176176
assertEquals(9, wps.getDataForWay(wayWithFootSidePath).forward().walkSafety(), EPSILON);
177+
var wayWithBoth = OsmWay.of()
178+
.withTag("foot", "use_sidepath")
179+
.withTag("bicycle", "use_sidepath")
180+
.build();
181+
assertEquals(9, wps.getDataForWay(wayWithBoth).forward().walkSafety(), EPSILON);
177182
}
178183

179184
@Test

doc/user/osm/Finland.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ Multiple mixins can apply to the same way and their effects compound.
127127

128128
| matcher | add permission | remove permission | bicycle safety | walk safety |
129129
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|------------------------|-----------------------------------------------------|-------------|
130-
| `bicycle=use_sidepath` | | | | 5.0 |
130+
| `not(foot=use_sidepath); bicycle=use_sidepath` | | | | 5.0 |
131131
| `motorroad=yes` | | PEDESTRIAN_AND_BICYCLE | | |
132132
| `cycleway=lane; not(highway=cycleway)` | BICYCLE | | 0.87 | |
133133
| `cycleway=share_busway; not(highway=cycleway)` | BICYCLE | | 0.92 | |

0 commit comments

Comments
 (0)