transitland / gtfs

Ruby library for dealing with GTFS. Used by Transitland's FeedEater import pipeline.
8 stars 6 forks source link

GTFS data in a subfolder not working #64

Closed slvlirnoff closed 7 years ago

slvlirnoff commented 7 years ago

I've a feed that isn't valid because the data is in a subfolder

gtfs.zip
   gtfs_2017_04_20/agency.txt
   ...

Should this kind of archive be loaded properly or is that an error of the data provider?

I'm attempting to make a pull request to make it work, it seems that an extra-check of to nested zip support prevent the extraction of the files.

irees commented 7 years ago

Hi @slvlirnoff

This library supports GTFS archives where the CSV files are nested inside a subdirectory, or a second internal ZIP file. You can use a # in the path to specify this, e.g.:

GTFS::Source.build('gtfs.zip#gtfs_2017_04_20')
slvlirnoff commented 7 years ago

Hi @Irees,

Thanks for the quick answer!

Could we make it automatic if there's only one gtfs_source_path?

In this case it's annyoing because the gtfs is available as a permalink that contains a zip with a date in the subfolder.

Best, Cyprien

irees commented 7 years ago

@slvlirnoff

That is a good idea - it would probably also simplify some of my work flow. I should be able to implement it, perhaps with a flag to the build method. Can you make a separate issue as a feature request?

Thanks!