From 0d826d7ae96c5508a966aa5878c03c9864a6d9c4 Mon Sep 17 00:00:00 2001 From: Michael Tsang Date: Thu, 24 Oct 2024 15:44:27 +0100 Subject: [PATCH] only enable pedestrian indoor routing in the UK --- .../osm/tagmapping/DefaultMapper.java | 2 -- .../osm/tagmapping/UKMapper.java | 6 +++++ .../osm/tagmapping/DefaultMapperTest.java | 8 ------ .../osm/tagmapping/UKMapperTest.java | 26 +++++++++++++++++++ doc/user/osm/Default.md | 2 -- doc/user/osm/Finland.md | 2 -- doc/user/osm/Germany.md | 2 -- doc/user/osm/UK.md | 4 +-- 8 files changed, 34 insertions(+), 18 deletions(-) create mode 100644 application/src/test/java/org/opentripplanner/osm/tagmapping/UKMapperTest.java diff --git a/application/src/main/java/org/opentripplanner/osm/tagmapping/DefaultMapper.java b/application/src/main/java/org/opentripplanner/osm/tagmapping/DefaultMapper.java index 532b2569d45..faa666c750a 100644 --- a/application/src/main/java/org/opentripplanner/osm/tagmapping/DefaultMapper.java +++ b/application/src/main/java/org/opentripplanner/osm/tagmapping/DefaultMapper.java @@ -67,8 +67,6 @@ public void populateProperties(WayPropertySet props) { props.setProperties("public_transport=platform", pedestrianWayProperties); props.setProperties("railway=platform", pedestrianWayProperties); props.setProperties("footway=sidewalk;highway=footway", pedestrianWayProperties); - props.setProperties("indoor=area", pedestrianWayProperties); - props.setProperties("indoor=corridor", pedestrianWayProperties); props.setProperties("mtb:scale=1", pedestrianWayProperties); props.setProperties("mtb:scale=2", pedestrianWayProperties); diff --git a/application/src/main/java/org/opentripplanner/osm/tagmapping/UKMapper.java b/application/src/main/java/org/opentripplanner/osm/tagmapping/UKMapper.java index bef0be4101b..08531ce051d 100644 --- a/application/src/main/java/org/opentripplanner/osm/tagmapping/UKMapper.java +++ b/application/src/main/java/org/opentripplanner/osm/tagmapping/UKMapper.java @@ -2,7 +2,9 @@ import static org.opentripplanner.osm.wayproperty.WayPropertiesBuilder.withModes; import static org.opentripplanner.street.model.StreetTraversalPermission.ALL; +import static org.opentripplanner.street.model.StreetTraversalPermission.PEDESTRIAN; +import org.opentripplanner.osm.wayproperty.WayProperties; import org.opentripplanner.osm.wayproperty.WayPropertySet; /** @@ -73,6 +75,10 @@ public void populateProperties(WayPropertySet props) { props.setCarSpeed("highway=secondary_link", 13.4f); // ~= 30mph props.setCarSpeed("highway=tertiary", 15.7f); // ~= 35mph + WayProperties pedestrianWayProperties = withModes(PEDESTRIAN).build(); + props.setProperties("indoor=area", pedestrianWayProperties); + props.setProperties("indoor=corridor", pedestrianWayProperties); + // Read the rest from the default set new DefaultMapper().populateProperties(props); } diff --git a/application/src/test/java/org/opentripplanner/osm/tagmapping/DefaultMapperTest.java b/application/src/test/java/org/opentripplanner/osm/tagmapping/DefaultMapperTest.java index 31073f87e92..87e23acbf12 100644 --- a/application/src/test/java/org/opentripplanner/osm/tagmapping/DefaultMapperTest.java +++ b/application/src/test/java/org/opentripplanner/osm/tagmapping/DefaultMapperTest.java @@ -122,14 +122,6 @@ void stairs() { assertEquals(PEDESTRIAN, props.getPermission()); } - @Test - void indoor() { - var corridor = wps.getDataForWay(WayTestData.indoor("corridor")); - assertEquals(PEDESTRIAN, corridor.getPermission()); - var area = wps.getDataForWay(WayTestData.indoor("area")); - assertEquals(PEDESTRIAN, area.getPermission()); - } - @Test void footDiscouraged() { var regular = WayTestData.pedestrianTunnel(); diff --git a/application/src/test/java/org/opentripplanner/osm/tagmapping/UKMapperTest.java b/application/src/test/java/org/opentripplanner/osm/tagmapping/UKMapperTest.java new file mode 100644 index 00000000000..3e9e46618fd --- /dev/null +++ b/application/src/test/java/org/opentripplanner/osm/tagmapping/UKMapperTest.java @@ -0,0 +1,26 @@ +package org.opentripplanner.osm.tagmapping; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.opentripplanner.street.model.StreetTraversalPermission.PEDESTRIAN; + +import org.junit.jupiter.api.Test; +import org.opentripplanner.osm.wayproperty.WayPropertySet; +import org.opentripplanner.osm.wayproperty.specifier.WayTestData; + +public class UKMapperTest { + + static WayPropertySet wps = new WayPropertySet(); + + static { + var source = new UKMapper(); + source.populateProperties(wps); + } + + @Test + void indoor() { + var corridor = wps.getDataForWay(WayTestData.indoor("corridor")); + assertEquals(PEDESTRIAN, corridor.getPermission()); + var area = wps.getDataForWay(WayTestData.indoor("area")); + assertEquals(PEDESTRIAN, area.getPermission()); + } +} diff --git a/doc/user/osm/Default.md b/doc/user/osm/Default.md index 1373b499579..814420b791f 100644 --- a/doc/user/osm/Default.md +++ b/doc/user/osm/Default.md @@ -35,8 +35,6 @@ Lower safety values make an OSM way more desirable and higher values less desira | `public_transport=platform` | `PEDESTRIAN` | | | | `railway=platform` | `PEDESTRIAN` | | | | `footway=sidewalk; highway=footway` | `PEDESTRIAN` | | | -| `indoor=area` | `PEDESTRIAN` | | | -| `indoor=corridor` | `PEDESTRIAN` | | | | `mtb:scale=1` | `PEDESTRIAN` | | | | `mtb:scale=2` | `PEDESTRIAN` | | | | `mtb:scale=0` | `PEDESTRIAN_AND_BICYCLE` | | | diff --git a/doc/user/osm/Finland.md b/doc/user/osm/Finland.md index 820e47c46e0..8a60b5f0b13 100644 --- a/doc/user/osm/Finland.md +++ b/doc/user/osm/Finland.md @@ -79,8 +79,6 @@ Lower safety values make an OSM way more desirable and higher values less desira | `public_transport=platform` | `PEDESTRIAN` | | | | `railway=platform` | `PEDESTRIAN` | | | | `footway=sidewalk; highway=footway` | `PEDESTRIAN` | | | -| `indoor=area` | `PEDESTRIAN` | | | -| `indoor=corridor` | `PEDESTRIAN` | | | | `mtb:scale=1` | `PEDESTRIAN` | | | | `mtb:scale=2` | `PEDESTRIAN` | | | | `mtb:scale=0` | `PEDESTRIAN_AND_BICYCLE` | | | diff --git a/doc/user/osm/Germany.md b/doc/user/osm/Germany.md index f422022d4f2..922aa3af836 100644 --- a/doc/user/osm/Germany.md +++ b/doc/user/osm/Germany.md @@ -44,8 +44,6 @@ Lower safety values make an OSM way more desirable and higher values less desira | `public_transport=platform` | `PEDESTRIAN` | | | | `railway=platform` | `PEDESTRIAN` | | | | `footway=sidewalk; highway=footway` | `PEDESTRIAN` | | | -| `indoor=area` | `PEDESTRIAN` | | | -| `indoor=corridor` | `PEDESTRIAN` | | | | `mtb:scale=1` | `PEDESTRIAN` | | | | `mtb:scale=2` | `PEDESTRIAN` | | | | `mtb:scale=0` | `PEDESTRIAN_AND_BICYCLE` | | | diff --git a/doc/user/osm/UK.md b/doc/user/osm/UK.md index d5e401e40cc..34c4d1c1778 100644 --- a/doc/user/osm/UK.md +++ b/doc/user/osm/UK.md @@ -38,6 +38,8 @@ Lower safety values make an OSM way more desirable and higher values less desira | `highway=trunk_link; cycleway=opposite_track` | `ALL` | forward: 2.06
back: 0.85 | | | `highway=trunk; bicycle=designated` | `ALL` | 7.25 | | | `highway=trunk_link; bicycle=designated` | `ALL` | 2.0 | | +| `indoor=area` | `PEDESTRIAN` | | | +| `indoor=corridor` | `PEDESTRIAN` | | | | `mtb:scale=3` | `NONE` | | | | `mtb:scale=4` | `NONE` | | | | `mtb:scale=5` | `NONE` | | | @@ -49,8 +51,6 @@ Lower safety values make an OSM way more desirable and higher values less desira | `public_transport=platform` | `PEDESTRIAN` | | | | `railway=platform` | `PEDESTRIAN` | | | | `footway=sidewalk; highway=footway` | `PEDESTRIAN` | | | -| `indoor=area` | `PEDESTRIAN` | | | -| `indoor=corridor` | `PEDESTRIAN` | | | | `mtb:scale=1` | `PEDESTRIAN` | | | | `mtb:scale=2` | `PEDESTRIAN` | | | | `mtb:scale=0` | `PEDESTRIAN_AND_BICYCLE` | | |