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

Remove banDiscouragedCycling and banDiscouragedWalking #5341

Merged

Conversation

leonardehrenfried
Copy link
Member

Summary

This PR removes the configuration options banDiscouragedWalking and banDiscouragedCycling and replaces them with safety factors in the DefaultMapper.

This is more to the spirit of the tag which means that these ways are avoided if possible.

Unit tests

Added.

Documentation

Automatically generated.

@codecov
Copy link

codecov bot commented Aug 31, 2023

Codecov Report

Patch coverage: 77.77% and project coverage change: +0.02% 🎉

Comparison is base (ea7b80b) 66.35% compared to head (00ce283) 66.38%.
Report is 16 commits behind head on dev-2.x.

Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #5341      +/-   ##
=============================================
+ Coverage      66.35%   66.38%   +0.02%     
- Complexity     15182    15187       +5     
=============================================
  Files           1787     1787              
  Lines          69263    69241      -22     
  Branches        7339     7337       -2     
=============================================
+ Hits           45957    45963       +6     
+ Misses         20825    20796      -29     
- Partials        2481     2482       +1     
Files Changed Coverage Δ
..._builder/module/configure/GraphBuilderModules.java 0.00% <ø> (ø)
...ripplanner/graph_builder/module/osm/OsmModule.java 93.43% <ø> (-0.06%) ⬇️
...ner/graph_builder/module/osm/OsmModuleBuilder.java 92.85% <ø> (+10.50%) ⬆️
...module/osm/parameters/OsmProcessingParameters.java 100.00% <ø> (ø)
...opentripplanner/standalone/config/BuildConfig.java 98.36% <ø> (-0.08%) ⬇️
...entripplanner/openstreetmap/model/OSMWithTags.java 89.01% <60.00%> (-0.46%) ⬇️
...ripplanner/graph_builder/module/osm/OsmFilter.java 77.31% <100.00%> (+3.06%) ⬆️
...lanner/openstreetmap/tagmapping/DefaultMapper.java 100.00% <100.00%> (ø)

... and 5 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

vesameskanen
vesameskanen previously approved these changes Sep 1, 2023
void footDiscouraged() {
var regular = WayTestData.pedestrianTunnel();
var props = wps.getDataForWay(regular);
assertEquals(PEDESTRIAN_AND_BICYCLE, props.getPermission());
Copy link
Contributor

Choose a reason for hiding this comment

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

It is a bit surprising that highway=footway gets BICYCLE permission by default, even when bicycle=no is set. Anyway, that issue is out of the scope of this PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

Where do you see bicycle=no?

public static OSMWithTags pedestrianTunnel() {
// https://www.openstreetmap.org/way/127288293
OSMWithTags tunnel = new OSMWithTags();
tunnel.addTag("highway", "footway");
tunnel.addTag("indoor", "yes");
tunnel.addTag("layer", "-1");
tunnel.addTag("lit", "yes");
tunnel.addTag("name", "Lamar Tunnel");
tunnel.addTag("tunnel", "yes");
return tunnel;
}

However, highway=footway should probably not allow bicycles: https://wiki.openstreetmap.org/wiki/Tag:highway=footway?uselang=en

We should indeed change it in a separate PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

I tested adding bicycle=no myself, just for curiosity :) It did not change anything.

Copy link
Member Author

Choose a reason for hiding this comment

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

I believe that it's this piece of code taking care of it:

StreetTraversalPermission permissions = OsmFilter.getPermissionsForWay(
way,
wayData.getPermission(),
params.banDiscouragedWalking(),
params.banDiscouragedBiking(),
issueStore
);

I would be in favour of moving that somehow together with the other code figuring out the permissions.

Copy link
Contributor

Choose a reason for hiding this comment

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

I started working on that, and also fixing some known errors in traversal permission processing.

@leonardehrenfried leonardehrenfried added the bump serialization id Add this label if you want the serialization id automatically bumped after merging the PR label Sep 12, 2023
public void addTag(String key, String value) {
if (key == null || value == null) return;
public OSMWithTags addTag(String key, String value) {
if (key == null || value == null) return this;
Copy link
Member

Choose a reason for hiding this comment

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

Can you split the return to its own line or at least wrap it with {}

public void addTag(String key, String value) {
if (key == null || value == null) return;
public OSMWithTags addTag(String key, String value) {
if (key == null || value == null) return this;

if (tags == null) tags = new HashMap<>();
Copy link
Member

Choose a reason for hiding this comment

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

Same here

Comment on lines +622 to +623
props.setMixinProperties("foot=discouraged", ofWalkSafety(3));
props.setMixinProperties("bicycle=discouraged", ofBicycleSafety(3));
Copy link
Member

Choose a reason for hiding this comment

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

I checked that this wasn't handled in the NorwayMapper either and it doesn't rely on the default mapper. I can ask if the norwegians have interest in this too.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, you can ask but I see very, very few instances of this tag in the Nordics: https://taginfo.openstreetmap.org/tags/bicycle=discouraged#map

@t2gran t2gran added this to the 2.5 (next release) milestone Sep 13, 2023
Copy link
Member

@optionsome optionsome left a comment

Choose a reason for hiding this comment

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

I asked Entur if they needed this change in norway mapper as well but since the tagging is rarely ever used it's not needed.

@leonardehrenfried leonardehrenfried merged commit b5cbc95 into opentripplanner:dev-2.x Sep 14, 2023
5 checks passed
t2gran pushed a commit that referenced this pull request Sep 14, 2023
t2gran pushed a commit that referenced this pull request Sep 14, 2023
@leonardehrenfried leonardehrenfried deleted the ban-discouraged branch September 15, 2023 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bump serialization id Add this label if you want the serialization id automatically bumped after merging the PR config change technical debt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants