Better fallback in shape geometry processing - #4617
Conversation
…of using straight lines between stops
Codecov ReportBase: 60.49% // Head: 60.54% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #4617 +/- ##
=============================================
+ Coverage 60.49% 60.54% +0.04%
- Complexity 12190 12221 +31
=============================================
Files 1583 1583
Lines 63364 63462 +98
Branches 6990 7006 +16
=============================================
+ Hits 38335 38424 +89
- Misses 22846 22856 +10
+ Partials 2183 2182 -1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
|
What kind of error do we get from the |
|
Issue reporting did not change, the code still adds two kind of bogus issues: The issue seems to be incorrectly worded, as code does not now fallback to polylines. I will fix it, thanks for pointing this out! |
|
Can we add a test case for the geometry processor with the invalid geometry? |
|
OK I will add it. |
|
When you've added the test, you can request a review from me. |
|
Should we try to understand what the underlying cause for the |
|
I did analyze one such error in detail. I found out that the shape_dist_traveled of a stoptime entry, when mapped to the shape using the shape_dist_traveled of that shape itself, was too far away of the stop. In other words, shape_dist_traveled parametrization of the stop_times chain is out of sync with the shape. So, it is indeed a data error. In my opinion, the optional shape_dist_traveled parameterization is quite a tricky concept, and probably hard to maintain by data producers. I would still trust that the defined route shape geometry is better than a simple polyline, even though the unintuitive parametrization fails. |
|
Simple test added. One trip has bad stop_times.txt shape_dist_traveled values at start. Unit test fails unless the new better fallback is applied, because OTP would use straight line between stops. |
leonardehrenfried
left a comment
There was a problem hiding this comment.
Could you please unzip the test GTFS file, like so: https://github.com/opentripplanner/OpenTripPlanner/tree/dev-2.x/src/test/resources/gtfs/interlining
That will make it way easier to inspect the input data.
Summary
Fallback to using shape geometry without shape_dist_traveled instead of using straight lines between stops.
OTP has two methods for extracting geometry for a trip segment between two stops. The first one relies on shape_dist_traveled information found from stop_times and shape geometries. For some reason, this method (or the respective data) is error prone and therefore we often see itinerary and route geometries where stops are connected by straight lines. Such geometries are almost always incorrect as they do not follow road network and sometimes pass through buildings.
However, shape_dist_traveled is optional and OTP seems to work very well without it. This PR changes geometry processing so that when shape_dist_traveled based geometry extraction fails, OTP no longer applies the simple line geometry but fallbacks to the more robust method.
Images below show route 633N of HSL GTFS data before and after the fallback change.