'Extracting multiple agencies from a GTFS file

I can use the transitland-lib to extract a single agency from a GTFS file and create a new one like this:

sudo ./transitland-linux extract -extract-agency 53 germany.gtfs.zip my_agency.gtfs.zip

Is there a convenient way of extracting multiple agencies in a similar fashion? So e.g. can I somehow use the extract command somewhat like this:

sudo ./transitland-linux extract -extract-agency 53,54 germany.gtfs.zip my_agency.gtfs.zip

.. to create a new GTFS file that contains only agency 53 and 54?



Solution 1:[1]

This can be done by using the onebusaway-gtfs-transformer-cli command-line application.

Specifically "retain an entity":

{"op":"retain", "match":{"file":"agency.txt", "agency_id":"53"}}
{"op":"retain", "match":{"file":"agency.txt", "agency_id":"54"}}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Florian Baierl