diff --git a/CHANGELOG.md b/CHANGELOG.md index f2bf533827..445bd45b43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,8 @@ RELEASING: --> ## [Unreleased] +### Changed +- Improved road bike average speed to be faster on cycleways and slower on bad road surface or certain road types such as footways. ## [6.5.0] - 2021-05-17 ### Added diff --git a/openrouteservice/src/main/java/org/heigit/ors/routing/graphhopper/extensions/flagencoders/bike/CommonBikeFlagEncoder.java b/openrouteservice/src/main/java/org/heigit/ors/routing/graphhopper/extensions/flagencoders/bike/CommonBikeFlagEncoder.java index ae2e0dde7c..46bab75023 100644 --- a/openrouteservice/src/main/java/org/heigit/ors/routing/graphhopper/extensions/flagencoders/bike/CommonBikeFlagEncoder.java +++ b/openrouteservice/src/main/java/org/heigit/ors/routing/graphhopper/extensions/flagencoders/bike/CommonBikeFlagEncoder.java @@ -842,6 +842,9 @@ protected void setTrackTypeSpeed(String tracktype, SpeedValue speed) { protected void setSurfaceSpeed(String surface, int speed) { surfaceSpeeds.put(surface, new SpeedValue(speed)); } + protected void setSurfaceSpeed(String surface, int speed, UpdateType type) { + surfaceSpeeds.put(surface, new SpeedValue(speed, type)); + } protected void setSurfaceSpeed(String surface, SpeedValue speed) { surfaceSpeeds.put(surface, speed); } diff --git a/openrouteservice/src/main/java/org/heigit/ors/routing/graphhopper/extensions/flagencoders/bike/RoadBikeFlagEncoder.java b/openrouteservice/src/main/java/org/heigit/ors/routing/graphhopper/extensions/flagencoders/bike/RoadBikeFlagEncoder.java index 6f7e6cada7..bb3b10ffce 100644 --- a/openrouteservice/src/main/java/org/heigit/ors/routing/graphhopper/extensions/flagencoders/bike/RoadBikeFlagEncoder.java +++ b/openrouteservice/src/main/java/org/heigit/ors/routing/graphhopper/extensions/flagencoders/bike/RoadBikeFlagEncoder.java @@ -80,7 +80,7 @@ public RoadBikeFlagEncoder(int speedBits, double speedFactor, int maxTurnCosts, preferHighwayTags.add(VAL_SECONDARY_LINK); preferHighwayTags.add(VAL_TERTIARY); preferHighwayTags.add(VAL_TERTIARY_LINK); - preferHighwayTags.add(VAL_RESIDENTIAL); + preferHighwayTags.add(VAL_UNCLASSIFIED); setTrackTypeSpeed(VAL_GRADE_1, 20); // paved setTrackTypeSpeed("grade2", 10); // now unpaved ... @@ -88,16 +88,16 @@ public RoadBikeFlagEncoder(int speedBits, double speedFactor, int maxTurnCosts, setTrackTypeSpeed("grade4", PUSHING_SECTION_SPEED); setTrackTypeSpeed("grade5", PUSHING_SECTION_SPEED); - setSurfaceSpeed("paved", 20); - setSurfaceSpeed("asphalt", 20); - setSurfaceSpeed("cobblestone", 10); - setSurfaceSpeed("cobblestone:flattened", 10); - setSurfaceSpeed("sett", 10); - setSurfaceSpeed("concrete", 20); - setSurfaceSpeed("concrete:lanes", 16); - setSurfaceSpeed("concrete:plates", 16); - setSurfaceSpeed("paving_stones", 10); - setSurfaceSpeed("paving_stones:30", 10); + setSurfaceSpeed("paved", 26, UpdateType.DOWNGRADE_ONLY); + setSurfaceSpeed("asphalt", 26, UpdateType.DOWNGRADE_ONLY); + setSurfaceSpeed("cobblestone", 10, UpdateType.DOWNGRADE_ONLY); + setSurfaceSpeed("cobblestone:flattened", 10, UpdateType.DOWNGRADE_ONLY); + setSurfaceSpeed("sett", 10, UpdateType.DOWNGRADE_ONLY); + setSurfaceSpeed("concrete", 26, UpdateType.DOWNGRADE_ONLY); + setSurfaceSpeed("concrete:lanes", 16, UpdateType.DOWNGRADE_ONLY); + setSurfaceSpeed("concrete:plates", 16, UpdateType.DOWNGRADE_ONLY); + setSurfaceSpeed("paving_stones", 10, UpdateType.DOWNGRADE_ONLY); + setSurfaceSpeed("paving_stones:30", 10, UpdateType.DOWNGRADE_ONLY); setSurfaceSpeed("unpaved", PUSHING_SECTION_SPEED / 2); setSurfaceSpeed("compacted", PUSHING_SECTION_SPEED / 2); setSurfaceSpeed("dirt", PUSHING_SECTION_SPEED / 2); @@ -122,17 +122,17 @@ public RoadBikeFlagEncoder(int speedBits, double speedFactor, int maxTurnCosts, setHighwaySpeed("road", 12); setHighwaySpeed(VAL_TRACK, PUSHING_SECTION_SPEED / 2); // assume unpaved setHighwaySpeed(VAL_SERVICE, 12); - setHighwaySpeed(VAL_UNCLASSIFIED, 16); - setHighwaySpeed(VAL_RESIDENTIAL, 16); + setHighwaySpeed(VAL_UNCLASSIFIED, 20); + setHighwaySpeed(VAL_RESIDENTIAL, 18); setHighwaySpeed("trunk", 20); setHighwaySpeed("trunk_link", 20); - setHighwaySpeed("primary", 20); - setHighwaySpeed("primary_link", 20); - setHighwaySpeed(VAL_SECONDARY, 20); - setHighwaySpeed(VAL_SECONDARY_LINK, 20); - setHighwaySpeed(VAL_TERTIARY, 20); - setHighwaySpeed(VAL_TERTIARY_LINK, 20); + setHighwaySpeed("primary", 22); + setHighwaySpeed("primary_link", 22); + setHighwaySpeed(VAL_SECONDARY, 24); + setHighwaySpeed(VAL_SECONDARY_LINK, 24); + setHighwaySpeed(VAL_TERTIARY, 26); + setHighwaySpeed(VAL_TERTIARY_LINK, 26); addPushingSection("path"); addPushingSection("footway"); @@ -150,56 +150,12 @@ public RoadBikeFlagEncoder(int speedBits, double speedFactor, int maxTurnCosts, setAvoidSpeedLimit(81); setSpecificClassBicycle("roadcycling"); - // MARQ24 MOD START - //********************************************************************** - // REQUIRED ADDON OR OVERWRITE OF Default GH-RoadBikeProfile - // created by MARQ24 - //********************************************************************** - preferHighwayTags.remove(VAL_RESIDENTIAL); - preferHighwayTags.add(VAL_UNCLASSIFIED); - - // adjusted speeds... - setHighwaySpeed("trunk", 20); - setHighwaySpeed("trunk_link", 20); - setHighwaySpeed("primary", 22); - setHighwaySpeed("primary_link", 22); - setHighwaySpeed(VAL_SECONDARY, 24); - setHighwaySpeed(VAL_SECONDARY_LINK, 24); - setHighwaySpeed(VAL_TERTIARY, 26); - setHighwaySpeed(VAL_TERTIARY_LINK, 26); - setHighwaySpeed("road", 20); - setHighwaySpeed(VAL_UNCLASSIFIED, 20); - setHighwaySpeed(VAL_RESIDENTIAL, new SpeedValue(18, UpdateType.DOWNGRADE_ONLY)); - - // make sure that we will avoid 'cycleway' & 'service' ways where ever - // it is possible... - setHighwaySpeed("cycleway", new SpeedValue(8, UpdateType.DOWNGRADE_ONLY)); - setHighwaySpeed(VAL_SERVICE, new SpeedValue(8, UpdateType.DOWNGRADE_ONLY)); - - // overwriting also the SurfaceSpeeds... to the "max" of the residential speed - setSurfaceSpeed("paved", new SpeedValue(18, UpdateType.UPGRADE_ONLY)); - setSurfaceSpeed("asphalt", new SpeedValue(18, UpdateType.UPGRADE_ONLY)); - setSurfaceSpeed("concrete", new SpeedValue(18, UpdateType.UPGRADE_ONLY)); - - setSurfaceSpeed("concrete:lanes", new SpeedValue(16, UpdateType.UPGRADE_ONLY)); - setSurfaceSpeed("concrete:plates", new SpeedValue(16, UpdateType.UPGRADE_ONLY)); - setSurfaceSpeed("paving_stones", new SpeedValue(10, UpdateType.UPGRADE_ONLY)); - setSurfaceSpeed("paving_stones:30", new SpeedValue(10, UpdateType.UPGRADE_ONLY)); - setSurfaceSpeed("cobblestone", new SpeedValue(10, UpdateType.UPGRADE_ONLY)); - setSurfaceSpeed("cobblestone:flattened", new SpeedValue(10, UpdateType.UPGRADE_ONLY)); - setSurfaceSpeed("sett", new SpeedValue(10, UpdateType.UPGRADE_ONLY)); - - // overwriting also the trackTypeSpeeds... to the "max" of the residential speed - setTrackTypeSpeed(VAL_GRADE_1, new SpeedValue(18, UpdateType.UPGRADE_ONLY)); - setTrackTypeSpeed("grade2", new SpeedValue(10, UpdateType.UPGRADE_ONLY)); - // HSW - asphalt cycleway vs asphalt roundabout // http://localhost:3035/directions?n1=51.965101&n2=8.24595&n3=18&a=51.965555,8.243968,51.964878,8.245057&b=1c&c=0&g1=-1&g2=0&h2=3&k1=en-US&k2=km // Aschloh roundabout vs cycleway (cycle relation) & service shortcut // http://localhost:3035/directions?n1=52.064701&n2=8.386386&n3=19&a=52.065407,8.386171,52.064821,8.386833&b=1c&c=0&g1=-1&g2=0&h2=3&k1=en-US&k2=km - LOGGER.info("NextGen RoadBike FlagEncoder is active..."); - // MARQ24 MOD END + this.init(); }