Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/fix-constanspeed-shortcuts' into…
Browse files Browse the repository at this point in the history
… dev-2.x
  • Loading branch information
vesameskanen committed Nov 14, 2024
2 parents 7a754ec + 88eaafb commit ded233d
Show file tree
Hide file tree
Showing 3 changed files with 222 additions and 201 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ static StyleSpec build(
ListUtils.combine(
List.of(StyleBuilder.ofId("background").typeRaster().source(BACKGROUND_SOURCE).minZoom(0)),
wheelchair(edges),
edges(edges),
traversalPermissions(edges),
noThruTraffic(edges),
traversalPermissions(edges),
edges(edges),
vertices(vertices),
stops(regularStops, areaStops, groupStops)
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.opentripplanner.osm.tagmapping;

import java.util.Set;
import org.opentripplanner.osm.model.OsmWithTags;
import org.opentripplanner.osm.wayproperty.WayPropertySet;

Expand All @@ -8,6 +9,14 @@
*/
class ConstantSpeedFinlandMapper extends FinlandMapper {

private static final Set<String> NOTHROUGH_DRIVING_TAGS = Set.of(
"parking_aisle",
"driveway",
"alley",
"emergency_access",
"drive-through"
);

private float speed;

public ConstantSpeedFinlandMapper() {
Expand Down Expand Up @@ -42,4 +51,16 @@ public Float getMaxUsedCarSpeed(WayPropertySet wayPropertySet) {
// than what is used for the street edge car speeds.
return speed;
}

@Override
public boolean isMotorVehicleThroughTrafficExplicitlyDisallowed(OsmWithTags way) {
if (super.isMotorVehicleThroughTrafficExplicitlyDisallowed(way)) {
return true;
}
/*
* Constant speed routing tends to use unrecommended shortcuts
* through parking areas etc. Prevent this.
*/
return way.isOneOfTags("service", NOTHROUGH_DRIVING_TAGS);
}
}
Loading

0 comments on commit ded233d

Please sign in to comment.