A writer for the GTFS structure created by the go gtfsparser. This can be used to write feeds that have been changed programmatically back to a GTFS feed.
feed := gtfsparser.NewFeed()
error := feed.Parse("sample-feed.zip")
// do stuff with feed
w := gtfswriter.Writer{}
werror := w.Write(feed, "/path/to/output")
Optional fields are not outputted if empty, if default values are used, the writer outputs them empty.
The ZIP compression level can be specified by setting ZipCompressionLevel
:
w := gtfswriter.Writer{ZipCompressionLevel : 9}
werror := w.Write(feed, "/path/to/output")
The following options are supported:
0
(default): default compression1
-9
: Compression levels from1
(fastest) to9
(best)-1
: no compression
For direct output in ZIP file, you must create it before:
// do stuff with feed
os.Create("/path/to/output.zip")
w := gtfswriter.Writer{}
werror := w.Write(feed, "/path/to/output")
GPL v2, see LICENSE