Skip to content

Move DirectTransferAnalyzer logic into street module and parallelise it - #8312

Open
leonardehrenfried wants to merge 6 commits into
opentripplanner:dev-2.xfrom
leonardehrenfried:transfer-analyzer-cleanup
Open

leonardehrenfried wants to merge 6 commits into
opentripplanner:dev-2.xfrom
leonardehrenfried:transfer-analyzer-cleanup

Conversation

@leonardehrenfried

@leonardehrenfried leonardehrenfried commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

Summary

@JohanEntur asked for DirectTransferAnalyzer to stay in OTP, so instead of deleting it I moved its logic into the street module and removed its dependency on VertexLinker and the routing layer.

  • New StopDistanceCalculator API in street.api.stopdistance (stop ids in, StopDistances out) with DefaultStopDistanceCalculator as the implementation: a spatial index of stop vertices plus one street search per stop, starting at its TransitStopVertex.
  • DirectTransferAnalyzer analyses the stops in parallel and logs progress with ProgressTracker. Its runtime has dropped from 8 minutes to under 1 minute on the Norway graph. The issues it reports are unchanged.

Results

I was a little sceptical about its usefulness but I has found some real mapping issues in Norway:

image

I think the limits are not well calibrated, but I leave this for Entur.

Issue

Ref #8081

@leonardehrenfried
leonardehrenfried requested a review from a team as a code owner December 4, 2026 09:26
@leonardehrenfried leonardehrenfried added +Sandbox This will be implemented as a Sandbox feature !Technical Debt Improve code quality, no functional changes. +Skip Changelog This is not a relevant change for a product owner since last release. labels Dec 4, 2026
@codecov

codecov Bot commented Dec 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 59.45946% with 45 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.21%. Comparing base (f79f17b) to head (a92b7ef).
⚠️ Report is 8 commits behind head on dev-2.x.

Files with missing lines Patch % Lines
...r/ext/transferanalyzer/DirectTransferAnalyzer.java 0.00% 41 Missing ⚠️
...et/stopdistance/DefaultStopDistanceCalculator.java 94.82% 1 Missing and 2 partials ⚠️
...pplanner/street/api/stopdistance/StopDistance.java 91.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #8312      +/-   ##
=============================================
+ Coverage      76.17%   76.21%   +0.03%     
- Complexity     24851    24866      +15     
=============================================
  Files           2658     2660       +2     
  Lines          93078    93122      +44     
  Branches        9288     9288              
=============================================
+ Hits           70905    70969      +64     
+ Misses         19034    19006      -28     
- Partials        3139     3147       +8     

☔ View full report in Codecov by Harness.
📢 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.

@optionsome optionsome left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I did not do the most thorough review since this is not the most important feature. It's a bit confusing that the feature is about transfers, but we don't actually use the transfers but rather just find random stops from stops. However, I can see how this approach might be needed to find the ones that we can't route to, but this also finds "transfers" that are not actually ever used (which might also still be somehow useful for fixing OSM problems).

public StopDistance(
FeedScopedId from,
FeedScopedId to,
double directDistanc_m,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Distance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

+Sandbox This will be implemented as a Sandbox feature +Skip Changelog This is not a relevant change for a product owner since last release. !Technical Debt Improve code quality, no functional changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants