-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add custom walking traversal permissions via TransportNetworkConfig (#…
…943) * Add SidewalkTraversalPermissionLabeler activated via TransportNetworkConfig when building a network from a config JSON * Remove deprecated buildNetworkFromBundleZip Building from .zip files on S3 has not been supported since 2016. * Enable TransportNetworkConfig in non-cluster use such as PointToPointRouterServer * Make sidewalk PermissionLabeler more restrictive Disallow walking anywhere driving is allowed * Set permissionLabeler more cleanly
- Loading branch information
Showing
5 changed files
with
113 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/main/java/com/conveyal/r5/labeling/SidewalkTraversalPermissionLabeler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.conveyal.r5.labeling; | ||
|
||
import com.conveyal.osmlib.Way; | ||
import com.conveyal.r5.streets.EdgeStore; | ||
|
||
/** | ||
* Traversal permission labeler that restricts walking on most driving ways (useful for networks with complete | ||
* sidewalks). Also includes permissions for the United States (see USTraversalPermissionLabeler). | ||
*/ | ||
public class SidewalkTraversalPermissionLabeler extends TraversalPermissionLabeler { | ||
static { | ||
addPermissions("pedestrian", "bicycle=yes"); | ||
addPermissions("bridleway", "bicycle=yes;foot=yes"); //horse=yes but we don't support horse | ||
addPermissions("cycleway", "bicycle=yes;foot=yes"); | ||
addPermissions("trunk|primary|secondary|tertiary|unclassified|residential|living_street|road|service|track", | ||
"access=yes"); | ||
} | ||
|
||
@Override | ||
public RoadPermission getPermissions(Way way) { | ||
RoadPermission rp = super.getPermissions(way); | ||
if (rp.forward.contains(EdgeStore.EdgeFlag.ALLOWS_CAR) || | ||
rp.forward.contains(EdgeStore.EdgeFlag.NO_THRU_TRAFFIC_CAR) || | ||
rp.backward.contains(EdgeStore.EdgeFlag.ALLOWS_CAR) || | ||
rp.backward.contains(EdgeStore.EdgeFlag.NO_THRU_TRAFFIC_CAR) | ||
) { | ||
rp.forward.remove(EdgeStore.EdgeFlag.ALLOWS_PEDESTRIAN); | ||
rp.forward.remove(EdgeStore.EdgeFlag.NO_THRU_TRAFFIC_PEDESTRIAN); | ||
rp.backward.remove(EdgeStore.EdgeFlag.ALLOWS_PEDESTRIAN); | ||
rp.backward.remove(EdgeStore.EdgeFlag.NO_THRU_TRAFFIC_PEDESTRIAN); | ||
} | ||
return rp; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters