Prune islands with mode-less stop vertices - #5782
Conversation
no modes are not considered as only ferries
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #5782 +/- ##
=============================================
+ Coverage 67.81% 67.87% +0.06%
- Complexity 16532 16552 +20
=============================================
Files 1906 1908 +2
Lines 72275 72337 +62
Branches 7443 7441 -2
=============================================
+ Hits 49015 49102 +87
+ Misses 20740 20714 -26
- Partials 2520 2521 +1 ☔ View full report in Codecov by Sentry. |
| @@ -257,7 +257,7 @@ private int processIslands( | |||
| TransitStopVertex v = (TransitStopVertex) vIter.next(); | |||
| Set<TransitMode> modes = v.getModes(); | |||
There was a problem hiding this comment.
Please move this code into Subgraph and write documentation about all the cases, in particular the case of the empty modes.
There was a problem hiding this comment.
That would also make writing a test for it easier, since you only need to test Subgraph not the entire module..
|
Also please coordinate with @vesameskanen if the handling of islands with stops with an empty mode need to have a configuration switch. We believe the check for the empty modes was introduced because there are actual islands in Finland that don't have any service in the winter and those should not be pruned. Another option would be to fix the data in OSM. |
|
The reason for considering a stop with no modes as a potential ferry stop was indeed winter time traffic. I think this is quite a specific assumption, and therefore can be changed as proposed in this PR. Removing small islands which have no wintertime connection hardly causes any issues in our routing. |
leonardehrenfried
left a comment
There was a problem hiding this comment.
Your latest change is a great improvement.
| for (Iterator<TransitStopVertex> vIter = this.stopIterator(); vIter.hasNext();) { | ||
| TransitStopVertex v = vIter.next(); |
There was a problem hiding this comment.
| for (Iterator<TransitStopVertex> vIter = this.stopIterator(); vIter.hasNext();) { | |
| TransitStopVertex v = vIter.next(); | |
| for (var v : stopsVertexSet) { |
| private static RegularStop regularStop1; | ||
| private static RegularStop regularStop2; | ||
|
|
||
| @BeforeAll | ||
| static void setUp() { | ||
| regularStop1 = | ||
| RegularStop | ||
| .of(new FeedScopedId("HH-GTFS", "TEST1"), () -> 0) | ||
| .withCoordinate(53.54948, 9.98455) | ||
| .build(); | ||
| regularStop2 = | ||
| RegularStop | ||
| .of(new FeedScopedId("HH-GTFS", "TEST2"), () -> 0) | ||
| .withCoordinate(53.55272, 9.99480) | ||
| .build(); | ||
| } |
There was a problem hiding this comment.
| private static RegularStop regularStop1; | |
| private static RegularStop regularStop2; | |
| @BeforeAll | |
| static void setUp() { | |
| regularStop1 = | |
| RegularStop | |
| .of(new FeedScopedId("HH-GTFS", "TEST1"), () -> 0) | |
| .withCoordinate(53.54948, 9.98455) | |
| .build(); | |
| regularStop2 = | |
| RegularStop | |
| .of(new FeedScopedId("HH-GTFS", "TEST2"), () -> 0) | |
| .withCoordinate(53.55272, 9.99480) | |
| .build(); | |
| } | |
| private static final TEST_MODEL = TransitDataForTest.of(); | |
| private static final RegularStop regularStop1 = TEST_MODEL.stop("TEST-1").build(); | |
| private static final RegularStop regularStop2 = TEST_MODEL.stop("TEST-2").build(); |
| for (Iterator<TransitStopVertex> vIter = stopIterator(); vIter.hasNext();) { | ||
| Vertex vx = vIter.next(); | ||
| envelope.expandToInclude(vx.getCoordinate()); | ||
| } |
There was a problem hiding this comment.
| for (Iterator<TransitStopVertex> vIter = stopIterator(); vIter.hasNext();) { | |
| Vertex vx = vIter.next(); | |
| envelope.expandToInclude(vx.getCoordinate()); | |
| } | |
| for (var vx : stopsVertexSet) { | |
| Vertex vx = vIter.next(); | |
| envelope.expandToInclude(vx.getCoordinate()); | |
| } |
| import org.opentripplanner.transit.model.framework.FeedScopedId; | ||
| import org.opentripplanner.transit.model.site.RegularStop; | ||
|
|
||
| class SubgraphOnlyFerryTest { |
There was a problem hiding this comment.
Great and extensive test! ❤️
| /** | ||
| * Checks whether the subgraph has only transit-stops for ferries | ||
| * | ||
| * @return true if only ferries stop at the subgraph and false if other or no other modes are |
There was a problem hiding this comment.
| * @return true if only ferries stop at the subgraph and false if other or no other modes are | |
| * @return true if only ferries stop at the subgraph and false if other or no modes are |
| if (vertex instanceof TransitStopVertex) { | ||
| stopsVertexSet.add(vertex); | ||
| stopsVertexSet.add((TransitStopVertex) vertex); |
There was a problem hiding this comment.
Use a pattern variable here, please.
Summary
For island pruning islands with stops without modes are not considered as only ferries anymore. Currently we have issues with stops that exist in our data that have no service but are linked to small islands.
In the following screenshot you can see the problem
