Skip to content

Conversation

@t2gran
Copy link
Member

@t2gran t2gran commented Aug 18, 2021

Summary

This feature remove all unused Stops and cascade to all entries referencing these. This happens after a GTFS or NeTEx feed is read, but before the stops are put in the OTP internal model and the graph is build. By "unused" we mean that the Stop or its parent Station is not visited by a trip pattern. So, if Stop A, B, and C is part of the same Station, and one trip pattern stop at A, then all stops A, B, and C are kept.

Typical use case

As a developer I need to debug a routing request, but the size of the data is overwhelming. Editing NeTEx (or GTFS) files is time consuming, difficult and error prune. So, it would be nice if we had a good way to limit the data loaded. There are tools for chopping down GTFS, but I am not aware of any good tools for NeTEx data set. It would be nice if OTP could clean up and remove data that can not be used in a travel seach. Then all I have to do as a developer is to remove trip from the dataset, and OTP will remove all other data that is not in use by the provided trips.

Solution

To make it easier we kan remove all trips from the feed except the trips involved and run OTP. Removing trips is fairly easy, even in NeTEx xml files. Then this PR provide a feature for filtering down the stops, station, pathways, transfers, multi-modal-stops and group-of-stop-places. To enable the feature add the following to the otp-config.json file:

{ "RemoveUnusedStops" : true }

A potential problem is that a real-time updates try to use a deleted stop or one of the other deleted entities. This feature is not ment to be used in production.

This improve the graph build time. I tested this with the Norwegian NeTEx data set. I deleted all trips, except 2. The graph build time went down from 5.7 minutes to 1.5 minute. From the log we can see that almost all stops are removed: 106006 of 106164 Stop(s) removed

23:29:38.869 WARN (OtpTransitServiceBuilder.java:264) Limiting transit service days to time period: [2020-08-18, 2024-08-18]
23:29:38.995 INFO (OtpTransitServiceBuilder.java:376) 106006 of 106164 Stop(s) removed. Reason: Stop/parent station not in use by any patterns.
:
23:30:29.280 INFO (DirectTransferGenerator.java:65) Creating direct transfer edges between stops using the street network from OSM...
23:30:30.068 INFO (DirectTransferGenerator.java:121) Create transfer edges progress tracking complete. 158 done in 0s (298 pr second). 
23:30:30.068 INFO (DirectTransferGenerator.java:122) Done connecting stops to one another. Created a total of 304 transfers from 149 stops.
:
23:30:30.106 INFO (GraphBuilder.java:87) Graph building took 1,5 minutes.
23:30:30.385 INFO (GraphBuilder.java:88) Main graph size: |V|=2411507 |E|=5712416

Issue

No issue exist.

Unit tests

No unit test exist, but I have tested this during debugging of another problem where limiting the number of stops is important.

Documentation

The configuration documentation is updated.

Changelog

No change log is added. Not a production feature.

@t2gran t2gran added the !Improvement A functional improvement or micro feature label Aug 18, 2021
@t2gran t2gran added this to the 2.1 milestone Aug 18, 2021
@t2gran t2gran force-pushed the otp2_feat_remove_unused_stops branch 2 times, most recently from a1b1106 to fef5deb Compare August 20, 2021 15:36
@t2gran t2gran force-pushed the otp2_feat_remove_unused_stops branch from fef5deb to 1b060bd Compare September 6, 2021 08:31
@t2gran t2gran modified the milestones: 2.1, 2.2 Feb 25, 2022
@t2gran t2gran modified the milestones: 2.2, 2.3 Nov 1, 2022
@t2gran t2gran modified the milestones: 2.3, 2.4 Apr 24, 2023
@t2gran t2gran modified the milestones: 2.4, 2.5 (next release) Sep 13, 2023
@t2gran t2gran modified the milestones: 2.5, 2.6 (next release), Parked Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

!Improvement A functional improvement or micro feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant