Skip to content

Conversation

@ansoncfit
Copy link
Member

@ansoncfit ansoncfit commented Aug 14, 2025

We've had a few requests for custom routing profiles, including:

  • Disallow biking on sidewalks (NoSidewalkCyclingTraversalPermissionLabeler in 7f4282a)
  • Disallow walking on links where custom tags indicate steep inclines, and optionally prevent traversal of steps/raise curbs (NoSteepInclinesTraversalPermissionLabeler)

This PR adds these capabilities as custom TraversalPermissionLabelers, which can be applied at network build using TransportNetworkConfig options.

@ansoncfit ansoncfit requested a review from abyrd August 14, 2025 21:00
case "sidewalk" -> new SidewalkTraversalPermissionLabeler();
case "noSidewalkCycling" -> new NoSidewalkCyclingTraversalPermissionLabeler();
case null -> new USTraversalPermissionLabeler();
case null -> new NoSidewalkCyclingTraversalPermissionLabeler();
Copy link
Member

Choose a reason for hiding this comment

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

Is the intent here to make the default NoSidewalkCycling? Does this mean that now there's no way to select USTraversalPermissionLabeler?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, the intent is to keep USTraversalPermissionLabeler. This default case was just set for testing but should be reverted before final review of this PR:

49a205a forces use of the NoSidewalkCyclingTraversalPermissionLabeler and should be reverted before merging.

@ansoncfit ansoncfit force-pushed the sidewalk-traversal-options branch from 60c0ea8 to 552975a Compare September 30, 2025 16:42
@ansoncfit ansoncfit force-pushed the sidewalk-traversal-options branch from 0195be3 to dc178d5 Compare November 10, 2025 20:39
@ansoncfit ansoncfit marked this pull request as ready for review November 10, 2025 20:40
}

if (permissionLabeler instanceof StepFreeTraversalPermissionLabeler) {
stepFree = ((StepFreeTraversalPermissionLabeler) permissionLabeler).requireStepFree;
Copy link
Member

Choose a reason for hiding this comment

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

It feels strange to set this via a way permission labeler, as the labeler instance can't take the action itself and we need to detect its type here. Could stepFree just be considered another separate TransportNetworkConfig option? The boolean field could be pulled up out of StepFreeTraversalPermissionLabeler into TransportNetworkConfig itself. This would then become stepFree = config.stepFree with no instanceof or conditional. The purpose of the field here seems to be only blocking kerbs (not stair/step ways) so perhaps it should be renamed accordingly (e.g. kerbFree or requireKerbCuts).

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it makes sense to make stepFree another TransportNetworkConfig option.

Ways with highway=steps tags are filtered out where appropriate in the custom TraversalPermissionLabelers.

* USTraversalPermissionLabeler, except walking is disallowed on ways that allow cars, ways with inclines
* steeper than a specified limit, and ways with steps.
*/
public class StepFreeTraversalPermissionLabeler extends USTraversalPermissionLabeler {
Copy link
Member

Choose a reason for hiding this comment

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

Ideally we should avoid the duplicate code between this and NoSteepInclinesTraversalPermissionLabeler. Could this class just extend NoSteepInclinesTraversalPermissionLabeler? Could they just be a single class with a boolean for disallowing steps (stairs) passed into the constructor? This might be further simplified by pulling the requireStepFree field up to the enclosing NetworkConfig.

@ansoncfit ansoncfit requested a review from abyrd November 22, 2025 13:27
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