What we want to achieve:
We need to parse GTFS files but are only interested in a few agencies inside of that GTFS file. Since parsing the GTFS file takes quite a long time (depending on how many agencies/routes/trips are included in that GTFS file), it would be very helpful to specify which agencies we are interested in before parsing the whole file.
What we tried:
Using the onebusaway-gtfs-modules one can parse a GTFS file like this:
GtfsReader reader = new GtfsReader();
File gtfsFile = gtfsResourceVetterAndThuesac.getFile(); // a GTFS file containing three agencies
GtfsDaoImpl store = new GtfsDaoImpl();
reader.run(); // blocking
The reader also offers a method called void setAgencies(List<Agency> agencies)
which is not documented, but sounds a lot like what we wont to achieve.
I created a GTFS file that only contains three agencies:
agencies.txt:
agency_id,agency_name,agency_url,agency_timezone,agency_lang
00786,THÜSAC,https://www.nasa.de/vu/,Europe/Berlin,de
00846,Vetter Verkehrsbetriebe,https://www.nasa.de/vu/,Europe/Berlin,de
00847,Vetter GmbH,https://www.nasa.de/vu/,Europe/Berlin,de
Now when I try using that with setting the agencies for the reader to "00786", I get the exact opposite of what I wanted to achieve. The result is that the reader read all agencies apart from the one I specified:
Is this supposed to what is happening? Or is this a bug within the onebusaway reader? Is there another way (preferebly with using java methods, no cli calls) to achieve what we want?