diff --git a/config-example.yml b/config-example.yml index 4f929f28345..a276c0d51d8 100644 --- a/config-example.yml +++ b/config-example.yml @@ -189,7 +189,7 @@ graphhopper: # motorized vehicles. This leads to a smaller and less dense graph, because there are fewer ways (obviously), # but also because there are fewer crossings between highways (=junctions). # Another typical example is excluding 'motorway', 'trunk' and maybe 'primary' highways for bicycle or pedestrian routing. - import.osm.ignored_highways: footway,cycleway,path,pedestrian,steps # typically useful for motorized-only routing + import.osm.ignored_highways: footway,cycleway,path,steps # typically useful for motorized-only routing # import.osm.ignored_highways: motorway,trunk # typically useful for non-motorized routing # configure the memory access, use RAM_STORE for well equipped servers (default and recommended) diff --git a/core/src/main/java/com/graphhopper/routing/util/countryrules/europe/DenmarkCountryRule.java b/core/src/main/java/com/graphhopper/routing/util/countryrules/europe/DenmarkCountryRule.java index ddec29d0adc..c56f96a0030 100644 --- a/core/src/main/java/com/graphhopper/routing/util/countryrules/europe/DenmarkCountryRule.java +++ b/core/src/main/java/com/graphhopper/routing/util/countryrules/europe/DenmarkCountryRule.java @@ -23,7 +23,7 @@ import com.graphhopper.routing.util.countryrules.CountryRule; /** - * Defines the default rules for Polish roads + * Defines the default rules for Danish roads * * @author Thomas Butz */ diff --git a/core/src/main/java/com/graphhopper/routing/util/parsers/CarAccessParser.java b/core/src/main/java/com/graphhopper/routing/util/parsers/CarAccessParser.java index e4832e5b170..454e688657c 100644 --- a/core/src/main/java/com/graphhopper/routing/util/parsers/CarAccessParser.java +++ b/core/src/main/java/com/graphhopper/routing/util/parsers/CarAccessParser.java @@ -30,6 +30,7 @@ public class CarAccessParser extends AbstractAccessParser implements TagParser { protected final Set trackTypeValues = new HashSet<>(); protected final Set highwayValues = new HashSet<>(); + protected final Set pedestrianAccessValues = new HashSet<>(); protected final BooleanEncodedValue roundaboutEnc; public CarAccessParser(EncodedValueLookup lookup, PMap properties) { @@ -71,7 +72,9 @@ public CarAccessParser(BooleanEncodedValue accessEnc, highwayValues.addAll(Arrays.asList("motorway", "motorway_link", "trunk", "trunk_link", "primary", "primary_link", "secondary", "secondary_link", "tertiary", "tertiary_link", - "unclassified", "residential", "living_street", "service", "road", "track")); + "unclassified", "residential", "living_street", "service", "road", "track", "pedestrian")); + + pedestrianAccessValues.addAll(Arrays.asList("destination", "yes", "customers")); trackTypeValues.addAll(Arrays.asList("grade1", "grade2", "grade3", null)); } @@ -155,6 +158,20 @@ public void handleWayTags(int edgeId, EdgeIntAccess edgeIntAccess, ReaderWay way List> nodeTags = way.getTag("node_tags", Collections.emptyList()); handleBarrierEdge(edgeId, edgeIntAccess, nodeTags.get(0)); } + + if("pedestrian".equals(way.getTag("highway"))) { + boolean allowed = way.hasTag("motor_vehicle", pedestrianAccessValues) || + way.hasTag("vehicle", pedestrianAccessValues); + if (isOneway(way)) { + if (isForwardOneway(way)) + accessEnc.setBool(false, edgeId, edgeIntAccess, allowed); + if (isBackwardOneway(way)) + accessEnc.setBool(true, edgeId, edgeIntAccess, allowed); + } else { + accessEnc.setBool(false, edgeId, edgeIntAccess, allowed); + accessEnc.setBool(true, edgeId, edgeIntAccess, allowed); + } + } } /** diff --git a/core/src/main/resources/com/graphhopper/routing/util/legal_default_speeds.json b/core/src/main/resources/com/graphhopper/routing/util/legal_default_speeds.json index 64ed39f7d45..b2beb90a963 100644 --- a/core/src/main/resources/com/graphhopper/routing/util/legal_default_speeds.json +++ b/core/src/main/resources/com/graphhopper/routing/util/legal_default_speeds.json @@ -3149,6 +3149,11 @@ ], "DK": [ { + "name": "pedestrian", + "tags": { + "maxspeed": "walk" + } + },{ "name": "living street", "tags": { "maxspeed": "15" diff --git a/core/src/test/java/com/graphhopper/routing/util/parsers/CarTagParserTest.java b/core/src/test/java/com/graphhopper/routing/util/parsers/CarTagParserTest.java index 7236c0bd2e0..d6c449d3072 100644 --- a/core/src/test/java/com/graphhopper/routing/util/parsers/CarTagParserTest.java +++ b/core/src/test/java/com/graphhopper/routing/util/parsers/CarTagParserTest.java @@ -167,6 +167,21 @@ public void testAccess() { way.setTag("highway", "service"); way.setTag("service", "emergency_access"); assertTrue(parser.getAccess(way).canSkip()); + + way.clearTags(); + way.setTag("highway", "pedestrian"); + way.setTag("motor_vehicle", "yes"); + assertTrue(parser.getAccess(way).isWay()); + + way.clearTags(); + way.setTag("highway", "pedestrian"); + way.setTag("motor_vehicle", "destination"); + assertTrue(parser.getAccess(way).isWay()); + + way.clearTags(); + way.setTag("highway", "pedestrian"); + way.setTag("motor_vehicle", "customer"); + assertTrue(parser.getAccess(way).isWay()); } @Test @@ -701,7 +716,7 @@ public void testIssue_1256() { @ValueSource(strings = {"mofa", "moped", "motorcar", "motor_vehicle", "motorcycle"}) void footway_etc_not_allowed_despite_vehicle_yes(String vehicle) { // these highways are blocked, even when we set one of the vehicles to yes - for (String highway : Arrays.asList("footway", "cycleway", "steps", "pedestrian")) { + for (String highway : Arrays.asList("footway", "cycleway", "steps")) { ReaderWay way = new ReaderWay(1); way.setTag("highway", highway); way.setTag(vehicle, "yes");