diff --git a/application/src/main/java/org/opentripplanner/osm/tagmapping/FinlandMapper.java b/application/src/main/java/org/opentripplanner/osm/tagmapping/FinlandMapper.java index e9ac9478552..d9ddd1ede76 100644 --- a/application/src/main/java/org/opentripplanner/osm/tagmapping/FinlandMapper.java +++ b/application/src/main/java/org/opentripplanner/osm/tagmapping/FinlandMapper.java @@ -84,9 +84,6 @@ else if (speedLimit <= 16.65f) { // Don't recommend walking in trunk road tunnels props.setProperties("highway=trunk;tunnel=yes", withModes(CAR).bicycleSafety(7.47)); - // Do not walk on "moottoriliikennetie" - props.setProperties("motorroad=yes", withModes(CAR).bicycleSafety(7.47)); - // Remove informal and private roads props.setProperties("highway=*;informal=yes", withModes(NONE)); props.setProperties("highway=service;access=private", withModes(NONE)); diff --git a/application/src/main/java/org/opentripplanner/osm/tagmapping/OsmTagMapper.java b/application/src/main/java/org/opentripplanner/osm/tagmapping/OsmTagMapper.java index 2df3c22d6a9..60cd8d0ac74 100644 --- a/application/src/main/java/org/opentripplanner/osm/tagmapping/OsmTagMapper.java +++ b/application/src/main/java/org/opentripplanner/osm/tagmapping/OsmTagMapper.java @@ -14,7 +14,6 @@ import org.opentripplanner.osm.wayproperty.WayProperties; import org.opentripplanner.osm.wayproperty.WayPropertySet; import org.opentripplanner.osm.wayproperty.specifier.BestMatchSpecifier; -import org.opentripplanner.osm.wayproperty.specifier.Condition; import org.opentripplanner.osm.wayproperty.specifier.ExactMatchSpecifier; import org.opentripplanner.osm.wayproperty.specifier.LogicalOrSpecifier; import org.opentripplanner.routing.services.notes.StreetNotesService; @@ -104,6 +103,9 @@ public void populateProperties(WayPropertySet props) { props.setProperties("highway=trunk", withModes(CAR).bicycleSafety(7.47)); props.setProperties("highway=motorway", withModes(CAR).bicycleSafety(8)); + // Do not walk on "moottoriliikennetie"/"Kraftfahrstrasse" + props.setProperties(new ExactMatchSpecifier("motorroad=yes"), withModes(CAR)); + /* cycleway=lane */ props.setProperties( "highway=*;cycleway=lane", diff --git a/application/src/test/java/org/opentripplanner/osm/tagmapping/OsmTagMapperTest.java b/application/src/test/java/org/opentripplanner/osm/tagmapping/OsmTagMapperTest.java index b3ee57f9710..c5124fbd55a 100644 --- a/application/src/test/java/org/opentripplanner/osm/tagmapping/OsmTagMapperTest.java +++ b/application/src/test/java/org/opentripplanner/osm/tagmapping/OsmTagMapperTest.java @@ -3,15 +3,18 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.opentripplanner.street.model.StreetTraversalPermission.ALL; import static org.opentripplanner.street.model.StreetTraversalPermission.CAR; import org.junit.jupiter.api.Test; import org.opentripplanner.osm.model.OsmWithTags; +import org.opentripplanner.osm.wayproperty.WayPropertySet; +import org.opentripplanner.osm.wayproperty.specifier.WayTestData; -public class OsmTagMapperTest { +class OsmTagMapperTest { @Test - public void isMotorThroughTrafficExplicitlyDisallowed() { + void isMotorThroughTrafficExplicitlyDisallowed() { OsmWithTags o = new OsmWithTags(); OsmTagMapper osmTagMapper = new OsmTagMapper(); @@ -34,7 +37,7 @@ public void isMotorThroughTrafficExplicitlyDisallowed() { } @Test - public void isBicycleThroughTrafficExplicitlyDisallowed() { + void isBicycleThroughTrafficExplicitlyDisallowed() { OsmTagMapper osmTagMapper = new OsmTagMapper(); assertTrue( osmTagMapper.isBicycleThroughTrafficExplicitlyDisallowed(way("bicycle", "destination")) @@ -45,14 +48,14 @@ public void isBicycleThroughTrafficExplicitlyDisallowed() { } @Test - public void isWalkThroughTrafficExplicitlyDisallowed() { + void isWalkThroughTrafficExplicitlyDisallowed() { OsmTagMapper osmTagMapper = new OsmTagMapper(); assertTrue(osmTagMapper.isWalkThroughTrafficExplicitlyDisallowed(way("foot", "destination"))); assertTrue(osmTagMapper.isWalkThroughTrafficExplicitlyDisallowed(way("access", "destination"))); } @Test - public void testAccessNo() { + void testAccessNo() { OsmWithTags tags = new OsmWithTags(); OsmTagMapper osmTagMapper = new OsmTagMapper(); @@ -64,7 +67,7 @@ public void testAccessNo() { } @Test - public void testAccessPrivate() { + void testAccessPrivate() { OsmWithTags tags = new OsmWithTags(); OsmTagMapper osmTagMapper = new OsmTagMapper(); @@ -76,7 +79,7 @@ public void testAccessPrivate() { } @Test - public void testFootModifier() { + void testFootModifier() { OsmWithTags tags = new OsmWithTags(); OsmTagMapper osmTagMapper = new OsmTagMapper(); @@ -89,7 +92,7 @@ public void testFootModifier() { } @Test - public void testVehicleDenied() { + void testVehicleDenied() { OsmWithTags tags = new OsmWithTags(); OsmTagMapper osmTagMapper = new OsmTagMapper(); @@ -101,7 +104,7 @@ public void testVehicleDenied() { } @Test - public void testVehicleDeniedMotorVehiclePermissive() { + void testVehicleDeniedMotorVehiclePermissive() { OsmWithTags tags = new OsmWithTags(); OsmTagMapper osmTagMapper = new OsmTagMapper(); @@ -114,7 +117,7 @@ public void testVehicleDeniedMotorVehiclePermissive() { } @Test - public void testVehicleDeniedBicyclePermissive() { + void testVehicleDeniedBicyclePermissive() { OsmWithTags tags = new OsmWithTags(); OsmTagMapper osmTagMapper = new OsmTagMapper(); @@ -127,7 +130,7 @@ public void testVehicleDeniedBicyclePermissive() { } @Test - public void testMotorcycleModifier() { + void testMotorcycleModifier() { OsmWithTags tags = new OsmWithTags(); OsmTagMapper osmTagMapper = new OsmTagMapper(); @@ -140,7 +143,7 @@ public void testMotorcycleModifier() { } @Test - public void testBicycleModifier() { + void testBicycleModifier() { OsmWithTags tags = new OsmWithTags(); OsmTagMapper osmTagMapper = new OsmTagMapper(); @@ -153,7 +156,7 @@ public void testBicycleModifier() { } @Test - public void testBicyclePermissive() { + void testBicyclePermissive() { OsmWithTags tags = new OsmWithTags(); OsmTagMapper osmTagMapper = new OsmTagMapper(); @@ -165,6 +168,19 @@ public void testBicyclePermissive() { assertTrue(osmTagMapper.isWalkThroughTrafficExplicitlyDisallowed(tags)); } + @Test + void motorroad() { + OsmTagMapper osmTagMapper = new OsmTagMapper(); + WayPropertySet wps = new WayPropertySet(); + osmTagMapper.populateProperties(wps); + + var way = WayTestData.carTunnel(); + assertEquals(ALL, wps.getDataForWay(way).getPermission()); + + way.addTag("motorroad","yes"); + assertEquals(CAR, wps.getDataForWay(way).getPermission()); + } + public OsmWithTags way(String key, String value) { var way = new OsmWithTags(); way.addTag(key, value); diff --git a/doc/user/osm/Finland.md b/doc/user/osm/Finland.md index 8a60b5f0b13..a5a0341bf94 100644 --- a/doc/user/osm/Finland.md +++ b/doc/user/osm/Finland.md @@ -41,7 +41,6 @@ Lower safety values make an OSM way more desirable and higher values less desira | `highway=trunk_link` | `ALL` | 2.06 | | | `highway=trunk` | `ALL` | 7.47 | | | `highway=trunk; tunnel=yes` | `CAR` | 7.47 | | -| `motorroad=yes` | `CAR` | 7.47 | | | `present(highway); informal=yes` | `NONE` | | | | `highway=service; access=private` | `NONE` | | | | `highway=trail` | `NONE` | | | @@ -105,6 +104,7 @@ Lower safety values make an OSM way more desirable and higher values less desira | `highway=motorway_link` | `CAR` | 2.06 | | | `highway=trunk` | `CAR` | 7.47 | | | `highway=motorway` | `CAR` | 8.0 | | +| `motorroad=yes` | `CAR` | | | | `present(highway); cycleway=lane` | `PEDESTRIAN_AND_BICYCLE` | 0.87 | | | `highway=service; cycleway=lane` | `ALL` | 0.77 | | | `highway=residential; cycleway=lane` | `ALL` | 0.77 | | diff --git a/doc/user/osm/Germany.md b/doc/user/osm/Germany.md index 922aa3af836..ee9e3982362 100644 --- a/doc/user/osm/Germany.md +++ b/doc/user/osm/Germany.md @@ -70,6 +70,7 @@ Lower safety values make an OSM way more desirable and higher values less desira | `highway=motorway_link` | `CAR` | 2.06 | | | `highway=trunk` | `CAR` | 7.47 | | | `highway=motorway` | `CAR` | 8.0 | | +| `motorroad=yes` | `CAR` | | | | `present(highway); cycleway=lane` | `PEDESTRIAN_AND_BICYCLE` | 0.87 | | | `highway=service; cycleway=lane` | `ALL` | 0.77 | | | `highway=residential; cycleway=lane` | `ALL` | 0.77 | | diff --git a/doc/user/osm/OsmTag.md b/doc/user/osm/OsmTag.md index 814420b791f..9456dbc9fa5 100644 --- a/doc/user/osm/OsmTag.md +++ b/doc/user/osm/OsmTag.md @@ -61,6 +61,7 @@ Lower safety values make an OSM way more desirable and higher values less desira | `highway=motorway_link` | `CAR` | 2.06 | | | `highway=trunk` | `CAR` | 7.47 | | | `highway=motorway` | `CAR` | 8.0 | | +| `motorroad=yes` | `CAR` | | | | `present(highway); cycleway=lane` | `PEDESTRIAN_AND_BICYCLE` | 0.87 | | | `highway=service; cycleway=lane` | `ALL` | 0.77 | | | `highway=residential; cycleway=lane` | `ALL` | 0.77 | | diff --git a/doc/user/osm/UK.md b/doc/user/osm/UK.md index 34c4d1c1778..f9d8678fd3c 100644 --- a/doc/user/osm/UK.md +++ b/doc/user/osm/UK.md @@ -77,6 +77,7 @@ Lower safety values make an OSM way more desirable and higher values less desira | `highway=motorway_link` | `CAR` | 2.06 | | | `highway=trunk` | `CAR` | 7.47 | | | `highway=motorway` | `CAR` | 8.0 | | +| `motorroad=yes` | `CAR` | | | | `present(highway); cycleway=lane` | `PEDESTRIAN_AND_BICYCLE` | 0.87 | | | `highway=service; cycleway=lane` | `ALL` | 0.77 | | | `highway=residential; cycleway=lane` | `ALL` | 0.77 | |