Skip to content

Conversation

@miklcct
Copy link
Contributor

@miklcct miklcct commented Jul 30, 2025

Summary

This simplifies the OSM mappers by using mixins to add permissions and multiply safety values. It removes a large number of matches just to override the safety numbers and to add bicycle mode.

This will be a follow up for #6764.

Issue

None yet

Unit tests

Existing tests are updated. In particular, tests which plan journeys need to have their expectation changed as the routing results are changed due to the simplified safety values, which approximate but not exactly equal the old values.

Documentation

Updated

Changelog

Needed

Bumping the serialization version id

@codecov
Copy link

codecov bot commented Jul 30, 2025

Codecov Report

❌ Patch coverage is 95.94595% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.11%. Comparing base (ca8971f) to head (b05290f).

Files with missing lines Patch % Lines
...lanner/osm/wayproperty/MixinPropertiesBuilder.java 80.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #6767      +/-   ##
=============================================
- Coverage      72.20%   72.11%   -0.09%     
- Complexity     20134    20142       +8     
=============================================
  Files           2183     2183              
  Lines          81108    80868     -240     
  Branches        8144     8146       +2     
=============================================
- Hits           58561    58316     -245     
- Misses         19666    19672       +6     
+ Partials        2881     2880       -1     

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

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor Author

@miklcct miklcct left a comment

Choose a reason for hiding this comment

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

Wip

@t2gran t2gran added this to the 2.8 (next release) milestone Aug 11, 2025
# Conflicts:
#	application/src/main/java/org/opentripplanner/osm/tagmapping/OsmTagMapper.java
#	application/src/test/java/org/opentripplanner/generate/doc/OsmMapperDocTest.java
#	application/src/test/java/org/opentripplanner/osm/tagmapping/GermanyMapperTest.java
#	application/src/test/java/org/opentripplanner/osm/tagmapping/OsmTagMapperTest.java
#	application/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/TransitSnapshotTest.snap
#	application/src/test/resources/speedtest/travelSearch-expected-results-bd.csv
#	doc/user/osm/Finland.md
#	doc/user/osm/Germany.md
#	doc/user/osm/OsmTag.md
#	doc/user/osm/UK.md
# Conflicts:
#	application/src/test/java/org/opentripplanner/generate/doc/OsmMapperDocTest.java
@miklcct miklcct marked this pull request as ready for review September 1, 2025 11:55
@miklcct miklcct requested a review from a team as a code owner September 1, 2025 11:55
@miklcct miklcct marked this pull request as draft September 1, 2025 11:56
@t2gran t2gran modified the milestones: 2.8, 2.9 (next release) Sep 10, 2025
# Conflicts:
#	application/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/BikeRentalSnapshotTest.snap
#	application/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/CarSnapshotTest.snap
#	application/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/ElevationSnapshotTest.snap
#	application/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/TransitSnapshotTest.snap
#	application/src/test/resources/speedtest/travelSearch-expected-results-bd.csv
#	application/src/test/resources/speedtest/travelSearch-expected-results-mc.csv
#	application/src/test/resources/speedtest/travelSearch-expected-results-md.csv
#	application/src/test/resources/speedtest/travelSearch-expected-results-sr.csv
@miklcct miklcct marked this pull request as ready for review September 30, 2025 12:08
@miklcct
Copy link
Contributor Author

miklcct commented Sep 30, 2025

I think this is ready now but a thorough discussion is needed among stakeholders for the desired values. It also has implication on #6782 as well.

@optionsome
Copy link
Member

Could the addition of walk safety be split into a separate pr so this would be simpler to review?

@miklcct miklcct changed the title Simplify handling of safety values and add walk safety Simplify handling of safety values Oct 7, 2025
@miklcct
Copy link
Contributor Author

miklcct commented Oct 7, 2025

Could the addition of walk safety be split into a separate pr so this would be simpler to review?

I have removed walk safety here and drafted #6944

@miklcct miklcct marked this pull request as draft October 7, 2025 14:03
# Conflicts:
#	application/src/main/java/org/opentripplanner/osm/tagmapping/OsmTagMapper.java
#	application/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/ElevationSnapshotTest.snap
#	doc/user/osm/Finland.md
#	doc/user/osm/Germany.md
#	doc/user/osm/OsmTag.md
#	doc/user/osm/UK.md
@miklcct miklcct marked this pull request as ready for review October 7, 2025 14:19
@optionsome
Copy link
Member

optionsome commented Oct 24, 2025

I tested this a bit with HSL data and FinlandMapper. I noticed that on ways ways like https://www.openstreetmap.org/way/23571016 the bicycle safety value changed quite a bit (it was 5.95 before, now it is 2.38). Is this expected change? I think the key thing here is the highway=footway and bicycle=yes combo, but I think the surface also affects the values a bit but I'm not sure if in the same proportion as before. I'll have to talk to our OSM guy what sort of safety values we would actually expect from these ways. The original 5.95 feels a bit high and there were some like https://www.openstreetmap.org/way/229825375 which had 7.02 bicycle safety, which is starting to approach the safety values on some car streets which we don't people to cycle on.

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 like these changes in general. The configuration and documentation seem cleaner now. However, there are some changes to safety values which seem more than just minor changes.

Comment on lines +144 to +146
} else if (value == forward && value == backward) {
return value.toString();
} else {
Copy link
Member

Choose a reason for hiding this comment

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

You don't need to use the elses when you always have a return in the condition.

@optionsome
Copy link
Member

I discussed the changes to the highway=footway + bicycle=yes ways with our OSM editor and he also throught that previously they had slightly too high safety values. However, we noticed that https://www.openstreetmap.org/way/235220367 has now a higher bicycle safety value than the road that its crossing which might be slightly problematic as it could lead to avoidance of the cycleway in some cases.

@miklcct
Copy link
Contributor Author

miklcct commented Oct 27, 2025

I tested this a bit with HSL data and FinlandMapper. I noticed that on ways ways like https://www.openstreetmap.org/way/23571016 the bicycle safety value changed quite a bit (it was 5.95 before, now it is 2.38). Is this expected change? I think the key thing here is the highway=footway and bicycle=yes combo, but I think the surface also affects the values a bit but I'm not sure if in the same proportion as before. I'll have to talk to our OSM guy what sort of safety values we would actually expect from these ways. The original 5.95 feels a bit high and there were some like https://www.openstreetmap.org/way/229825375 which had 7.02 bicycle safety, which is starting to approach the safety values on some car streets which we don't people to cycle on.

I discussed the changes to the highway=footway + bicycle=yes ways with our OSM editor and he also throught that previously they had slightly too high safety values. However, we noticed that https://www.openstreetmap.org/way/235220367 has now a higher bicycle safety value than the road that its crossing which might be slightly problematic as it could lead to avoidance of the cycleway in some cases.

The current version is so complicated that it is hard to set the appropriate value when tags interact each others in a way which we didn't expect. If the simplification results in more sensible values for more sensible tags combination that is my intention.

And thanks for finding out the crossing value is problematic, in the current version it also has a high safety value to deter using them (when it is a footway crossing which you are allowed to cycle through) but you have now mentioned that you don't want this, so I will adjust it to be much lower.

@optionsome
Copy link
Member

This pr looks ok to me, but we need a second reviewer.

# Conflicts:
#	application/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/ElevationSnapshotTest.snap
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like a nice simplification. It's impossible to foresee all the consequences of this, but if any specific issues show up they shouldn't be very difficult to address.

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.

4 participants