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

Add custom walking traversal permissions via TransportNetworkConfig #943

Merged
merged 12 commits into from
Oct 4, 2024

Conversation

ansoncfit
Copy link
Member

Users want the ability to configure different traversal permission labeling approaches (e.g., disallowing walking on any links that allow driving, under the assumption complete and separate sidewalk networks are available, see #643)

This PR should be considered together with #941. Together with those changes, this PR allows users to build networks using a new experimental SidewalkTraversalPermissionLabeler with stricter walking permissions that are likely to be appropriate as more complete sidewalk networks become available.

Based on discussions in a work session a couple months ago, this PR removes the buildNetworkFromBundleZip method that has been unsupported since 2016.

This PR partly addresses #751 by passing TransportNetworkConfig values in PointToPointRouterServer use. The remaining piece of that r5r-related issue is allowing users to specify whether to save detailed GTFS shapes (which will be useful for us in publishing Taui sites, see #644)

public StreetLayer(TransportNetworkConfig config) {
this();
if (config != null && config.traversalPermissionLabeler != null) {
// TODO cleaner mapping
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be done with switch expressions, for example:

        if (config != null) {
            permissionLabeler = switch (config.traversalPermissionLabeler) {
                case "sidewalk" -> new SidewalkTraversalPermissionLabeler();
                case null -> new USTraversalPermissionLabeler();
                default -> throw new IllegalArgumentException("Unknown traversal permission labeler: " + config.traversalPermissionLabeler);
            };
        } else {
            permissionLabeler = new USTraversalPermissionLabeler();
        }

Copy link
Member

@trevorgerhardt trevorgerhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Config setting appears to work as intended when testing walk times.

@ansoncfit ansoncfit merged commit 8720aa6 into dev Oct 4, 2024
3 checks passed
@ansoncfit ansoncfit deleted the force-sidewalk-use branch October 4, 2024 18:00
@trevorgerhardt trevorgerhardt mentioned this pull request Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants