Zip File Containing Multiple GTFS Static Zip Files
Some agencies publish multiple GTFS static zip files as single zip file (e.g. Vicroads and Septa). Unfortunately, they don't appear to provide an option to download the individual zip files.
For these agencies I can manually download the zip file, extract the GTFS static zip file that I'm interested in and then pass this to gtfs-import? However, I was hoping there may be some way of having gtfs-import download the zip file using the URL and specifying which folder within the zip to use. I have looked through the options and can't see anything but just thought I would ask.
The GTFS working group updated their list of requirements, and one of the more recently updated requirements is that GTFS files must be in the root level directory:
"All dataset files must be zipped together. The files must reside at the root level directly, not in a subfolder."
https://gtfs.org/schedule/reference/#dataset-files
So, according to this, these agencies are not publishing valid GTFS if the zip file contains subfolders and multiple different GTFS files. (you could let them know about this and maybe they will update their publishing process)
However, as a workaround, I suggest adding a preprocessing script that downloads the zip file, unzips it to a specified directory and then run node-gtfs with the configuration set to the unzipped path. node-gtfs doesn't require that local files be zipped, the path to unzipped GTFS files works just fine.
Alternatively, you could fork node-gtfs and add logic to unzip the downloaded file and specify the task.path variable to the unzipped directory here: https://github.com/BlinkTagInc/node-gtfs/blob/master/lib/import.js#L33
Thank you for the detailed reply. Much appreciated.
From: Brendan Nee @.> Sent: Friday, June 7, 2024 11:05 AM To: BlinkTagInc/node-gtfs @.> Cc: Mark Foley @.>; Author @.> Subject: Re: [BlinkTagInc/node-gtfs] Zip File Containing Multiple GTFS Static Zip Files (Issue #165)
The GTFS working group updated their list of requirements, and one of the more recently updated requirements is that GTFS files must be in the root level directory:
"All dataset files must be zipped together. The files must reside at the root level directly, not in a subfolder."
https://gtfs.org/schedule/reference/#dataset-files
So, according to this, these agencies are not publishing valid GTFS if the zip file contains subfolders and multiple different GTFS files. (you could let them know about this and maybe they will update their publishing process)
However, as a workaround, I suggest adding a preprocessing script that downloads the zip file, unzips it to a specified directory and then run node-gtfs with the configuration set to the unzipped path. node-gtfs doesn't require that local files be zipped, the path to unzipped GTFS files works just fine.
Alternatively, you could fork node-gtfs and add logic to unzip the downloaded file and specify the task.path variable to the unzipped directory here: https://github.com/BlinkTagInc/node-gtfs/blob/master/lib/import.js#L33
— Reply to this email directly, view it on GitHubhttps://github.com/BlinkTagInc/node-gtfs/issues/165#issuecomment-2153666834, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AL6CAICEMSVIW4AXXXLCGRLZGEBNHAVCNFSM6AAAAABI5O257KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJTGY3DMOBTGQ. You are receiving this because you authored the thread.Message ID: @.@.>>
Let me know how you end up solving this or if you have other ideas on how node-gtfs could be improved.
Are you setting up a system to automatically fetch GTFS?
I'd be interested in documenting patterns for pre-processing and post-processing GTFS before/after it is handled by node.js.