Skip to content

Commit

Permalink
consider tracktype speed for ways designated for bikes (graphhopper#3047
Browse files Browse the repository at this point in the history
)

* Improvement for bicycle speed for designated path with tracktype

* Update core/src/main/java/com/graphhopper/routing/util/parsers/BikeCommonAverageSpeedParser.java

Co-authored-by: Peter <[email protected]>

* Remove a new test which passes without the improvement

---------

Co-authored-by: Peter <[email protected]>
  • Loading branch information
ratrun and karussell authored Aug 29, 2024
1 parent 87cd0f3 commit aade9fa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,9 @@ public void handleWayTags(int edgeId, EdgeIntAccess edgeIntAccess, ReaderWay way
speed = PUSHING_SECTION_SPEED;
} else if (pushingSectionsHighways.contains(highwayValue)) {
if (way.hasTag("bicycle", "designated") || way.hasTag("bicycle", "official") || way.hasTag("segregated", "yes")
|| CYCLEWAY_KEYS.stream().anyMatch(k -> way.getTag(k, "").equals("track")))
speed = highwaySpeeds.get("cycleway");
|| CYCLEWAY_KEYS.stream().anyMatch(k -> way.getTag(k, "").equals("track"))) {
speed = trackTypeSpeeds.getOrDefault(trackTypeValue, highwaySpeeds.get("cycleway"));
}
else if (way.hasTag("bicycle", "yes"))
speed = 12;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,12 @@ public void testSpeedAndPriority() {
way.setTag("surface", "ground");
assertPriorityAndSpeed(SLIGHT_AVOID, PUSHING_SECTION_SPEED, way);

way.clearTags();
way.setTag("highway", "path");
way.setTag("bicycle", "designated");
way.setTag("tracktype", "grade4");
assertPriorityAndSpeed(VERY_NICE, 6, way);

way.clearTags();
way.setTag("highway", "platform");
way.setTag("surface", "paved");
Expand All @@ -199,6 +205,12 @@ public void testSpeedAndPriority() {
way.setTag("surface", "paved");
way.setTag("bicycle", "designated");
assertPriorityAndSpeed(VERY_NICE, cyclewaySpeed, way);
way.clearTags();

way.setTag("highway", "footway");
way.setTag("tracktype", "grade4");
way.setTag("bicycle", "designated");
assertPriorityAndSpeed(VERY_NICE, 6, way);

way.clearTags();
way.setTag("highway", "platform");
Expand Down

0 comments on commit aade9fa

Please sign in to comment.