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

Fix one-way boarding location processing #6388

Open
wants to merge 2 commits into
base: dev-2.x
Choose a base branch
from

Conversation

miklcct
Copy link
Contributor

@miklcct miklcct commented Jan 16, 2025

PR Instructions

Summary

This adds @Nullable annotations to StreetEdge and its users.

It also fixes the processing for linear one-way platforms which crashed OSM ( https://www.openstreetmap.org/way/656712860 )

Issue

#6387

Unit tests

The original code can't be unit tested but can only be tested by using OSM data, which I added one test for it.

Documentation

None needed

Changelog

None

Bumping the serialization version id

None

Copy link

codecov bot commented Jan 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.74%. Comparing base (4c3983b) to head (4849d5b).
Report is 101 commits behind head on dev-2.x.

Additional details and impacted files
@@            Coverage Diff             @@
##             dev-2.x    #6388   +/-   ##
==========================================
  Coverage      69.73%   69.74%           
- Complexity     17957    17960    +3     
==========================================
  Files           2049     2049           
  Lines          76756    76757    +1     
  Branches        7832     7832           
==========================================
+ Hits           53529    53533    +4     
+ Misses         20493    20491    -2     
+ Partials        2734     2733    -1     

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

@miklcct miklcct marked this pull request as ready for review January 16, 2025 14:01
@miklcct miklcct requested a review from a team as a code owner January 16, 2025 14:01
@leonardehrenfried
Copy link
Member

leonardehrenfried commented Jan 16, 2025

@miklcct I experimented with making OsmModule more testable: leonardehrenfried@a8adf06

I think it's the right way to go.

Can you clean this up and add the correct test cases?

  • move the provider into a separate file in a _support directory
  • add nodes to the way
  • ...

@leonardehrenfried
Copy link
Member

Here is the complete setup: https://github.com/leonardehrenfried/OpenTripPlanner/tree/testable-osm

Can you take it do some clean up?

@leonardehrenfried
Copy link
Member

What I missed in the previous review: we don't actually need to store a Platform if it doesn't contain any references. Can you implement it in this method?

private Optional<Platform> getPlatform(OsmWay way) {
if (way.isBoardingLocation()) {
var nodeRefs = way.getNodeRefs();
var size = nodeRefs.size();
var nodes = new Coordinate[size];
for (int i = 0; i < size; i++) {
nodes[i] = osmdb.getNode(nodeRefs.get(i)).getCoordinate();
}
var geometryFactory = GeometryUtils.getGeometryFactory();
var geometry = geometryFactory.createLineString(nodes);
var references = way.getMultiTagValues(params.boardingAreaRefTags());
return Optional.of(
new Platform(
params.edgeNamer().getNameForWay(way, "platform " + way.getId()),
geometry,
references
)
);
} else {
return Optional.empty();
}
}

@leonardehrenfried leonardehrenfried changed the title Add null annotations to StreetEdge Fix one-way boarding location processing Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants