From 15656d586aae8ab56f225b2937cfe823ff90e2ff Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Wed, 4 Dec 2024 15:41:33 +0100 Subject: [PATCH 1/2] Add fallback names for corridors --- .../osm/tagmapping/OsmTagMapper.java | 3 ++- .../main/resources/WayProperties.properties | 1 + .../main/resources/WayProperties_de.properties | 1 + .../osm/tagmapping/OsmTagMapperTest.java | 18 +++++++++++++++--- 4 files changed, 19 insertions(+), 4 deletions(-) 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 55bc87f5cad..e2debf79916 100644 --- a/application/src/main/java/org/opentripplanner/osm/tagmapping/OsmTagMapper.java +++ b/application/src/main/java/org/opentripplanner/osm/tagmapping/OsmTagMapper.java @@ -624,7 +624,7 @@ public void populateProperties(WayPropertySet props) { props.setSlopeOverride(new BestMatchSpecifier("indoor=yes"), true); } - public void populateNotesAndNames(WayPropertySet props) { + static void populateNotesAndNames(WayPropertySet props) { /* and the notes */ // TODO: The curly brackets in the string below mean that the CreativeNamer should substitute in OSM tag values. // However they are not taken into account when passed to the translation function. @@ -667,6 +667,7 @@ public void populateNotesAndNames(WayPropertySet props) { props.createNames("highway=footway", "name.pedestrian_path"); props.createNames("highway=bridleway", "name.bridleway"); props.createNames("highway=footway;bicycle=no", "name.pedestrian_path"); + props.createNames("highway=corridor", "name.corridor"); // Platforms props.createNames("otp:route_ref=*", "name.otp_route_ref"); diff --git a/application/src/main/resources/WayProperties.properties b/application/src/main/resources/WayProperties.properties index a7e7d73fc34..8ff0590e0d4 100644 --- a/application/src/main/resources/WayProperties.properties +++ b/application/src/main/resources/WayProperties.properties @@ -8,6 +8,7 @@ name.pedestrian_path=path name.pedestrian_area=open area name.path=path name.bridleway=bridleway +name.corridor=corridor name.otp_route_ref=Route {otp:route_ref} name.platform_ref=Platform {ref} diff --git a/application/src/main/resources/WayProperties_de.properties b/application/src/main/resources/WayProperties_de.properties index c741c8dc991..ecb537a5186 100644 --- a/application/src/main/resources/WayProperties_de.properties +++ b/application/src/main/resources/WayProperties_de.properties @@ -9,6 +9,7 @@ name.pedestrian_path=Fu\u00dfweg name.pedestrian_area=Fu\u00dfg\u00e4ngerzone name.path=Weg name.bridleway=Reitweg +name.corridor=Korridor name.otp_route_ref=Route {otp:route_ref} name.platform_ref=Plattform {ref} 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 5448f84294d..8d699e38843 100644 --- a/application/src/test/java/org/opentripplanner/osm/tagmapping/OsmTagMapperTest.java +++ b/application/src/test/java/org/opentripplanner/osm/tagmapping/OsmTagMapperTest.java @@ -184,9 +184,7 @@ public static List roadCases() { @ParameterizedTest @MethodSource("roadCases") void motorroad(OsmWithTags way) { - OsmTagMapper osmTagMapper = new OsmTagMapper(); - WayPropertySet wps = new WayPropertySet(); - osmTagMapper.populateProperties(wps); + final WayPropertySet wps = wayProperySet(); assertEquals(ALL, wps.getDataForWay(way).getPermission()); @@ -194,9 +192,23 @@ void motorroad(OsmWithTags way) { assertEquals(CAR, wps.getDataForWay(way).getPermission()); } + @Test + void corridorName() { + final WayPropertySet wps = wayProperySet(); + var way = way("highway", "corridor"); + assertEquals("corridor", wps.getCreativeNameForWay(way).toString()); + } + public OsmWithTags way(String key, String value) { var way = new OsmWithTags(); way.addTag(key, value); return way; } + + private static WayPropertySet wayProperySet() { + OsmTagMapper osmTagMapper = new OsmTagMapper(); + WayPropertySet wps = new WayPropertySet(); + osmTagMapper.populateProperties(wps); + return wps; + } } From d7fd1d85050fe5c1708aaa6a26fb6ae34e5aa56c Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Wed, 4 Dec 2024 21:57:41 +0100 Subject: [PATCH 2/2] Add translations for all languages --- application/src/main/resources/WayProperties_fi.properties | 1 + application/src/main/resources/WayProperties_fr.properties | 1 + application/src/main/resources/WayProperties_hu.properties | 1 + application/src/main/resources/WayProperties_nl.properties | 1 + application/src/main/resources/WayProperties_no.properties | 1 + application/src/main/resources/WayProperties_sv.properties | 1 + .../org/opentripplanner/osm/tagmapping/OsmTagMapperTest.java | 3 +++ 7 files changed, 9 insertions(+) diff --git a/application/src/main/resources/WayProperties_fi.properties b/application/src/main/resources/WayProperties_fi.properties index b4f7330b737..725580c6c1a 100644 --- a/application/src/main/resources/WayProperties_fi.properties +++ b/application/src/main/resources/WayProperties_fi.properties @@ -8,6 +8,7 @@ name.pedestrian_path=polku name.pedestrian_area=aukio name.path=polku name.bridleway=ratsupolku +name.corridor=käytävä name.otp_route_ref=linja {otp:route_ref} name.platform_ref=laituri {ref} diff --git a/application/src/main/resources/WayProperties_fr.properties b/application/src/main/resources/WayProperties_fr.properties index 0c926a8c357..566ba586e18 100644 --- a/application/src/main/resources/WayProperties_fr.properties +++ b/application/src/main/resources/WayProperties_fr.properties @@ -9,6 +9,7 @@ name.pedestrian_path=chemin pi\u00e9tonnier name.pedestrian_area=plateau pi\u00e9tonnier name.path=chemin name.bridleway=sentier \u00e9questre +name.corridor=couloir name.otp_route_ref=Ligne {otp:route_ref} name.platform_ref=Plate-forme {ref} diff --git a/application/src/main/resources/WayProperties_hu.properties b/application/src/main/resources/WayProperties_hu.properties index 13539374eb2..e61bc8dbf1a 100644 --- a/application/src/main/resources/WayProperties_hu.properties +++ b/application/src/main/resources/WayProperties_hu.properties @@ -8,6 +8,7 @@ name.pedestrian_path=gyalog\u00FAt name.pedestrian_area=t\u00E9r name.path=path name.bridleway=nyomvonal +name.corridor=folyoso name.otp_route_ref={otp:route_ref} name.platform_ref={ref} diff --git a/application/src/main/resources/WayProperties_nl.properties b/application/src/main/resources/WayProperties_nl.properties index 501287506d2..dc7597c898e 100644 --- a/application/src/main/resources/WayProperties_nl.properties +++ b/application/src/main/resources/WayProperties_nl.properties @@ -9,6 +9,7 @@ name.pedestrian_path=voetpad name.pedestrian_area=open ruimte name.path=pad name.bridleway=ruiterpad +name.corridor=gang name.otp_route_ref=Lijn {otp:route_ref} name.platform_ref=Spoor {ref} diff --git a/application/src/main/resources/WayProperties_no.properties b/application/src/main/resources/WayProperties_no.properties index 95883c60af3..3cb19cdac76 100644 --- a/application/src/main/resources/WayProperties_no.properties +++ b/application/src/main/resources/WayProperties_no.properties @@ -8,6 +8,7 @@ name.pedestrian_path=gangvei name.pedestrian_area=plass name.path=sti name.bridleway=bridleway +name.corridor=korridor name.otp_route_ref=Rute {otp:route_ref} name.platform_ref=Plattform {ref} diff --git a/application/src/main/resources/WayProperties_sv.properties b/application/src/main/resources/WayProperties_sv.properties index 31529e1416b..3ba8bda6849 100644 --- a/application/src/main/resources/WayProperties_sv.properties +++ b/application/src/main/resources/WayProperties_sv.properties @@ -8,6 +8,7 @@ name.pedestrian_path=gångbanan name.pedestrian_area=torget name.path=stigen name.bridleway=ridvägem +name.corridor=korridor name.otp_route_ref=linje {otp:route_ref} name.platform_ref=plattform {ref} 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 8d699e38843..0c8583c02db 100644 --- a/application/src/test/java/org/opentripplanner/osm/tagmapping/OsmTagMapperTest.java +++ b/application/src/test/java/org/opentripplanner/osm/tagmapping/OsmTagMapperTest.java @@ -7,6 +7,7 @@ import static org.opentripplanner.street.model.StreetTraversalPermission.CAR; import java.util.List; +import java.util.Locale; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; @@ -197,6 +198,8 @@ void corridorName() { final WayPropertySet wps = wayProperySet(); var way = way("highway", "corridor"); assertEquals("corridor", wps.getCreativeNameForWay(way).toString()); + assertEquals("Korridor", wps.getCreativeNameForWay(way).toString(Locale.GERMANY)); + assertEquals("käytävä", wps.getCreativeNameForWay(way).toString(Locale.of("FI"))); } public OsmWithTags way(String key, String value) {