Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Road bike speeds #778

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,24 +80,24 @@ 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 ...
setTrackTypeSpeed("grade3", PUSHING_SECTION_SPEED);
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);
Expand All @@ -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");
Expand All @@ -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();
}

Expand Down