/gtfswriter

A GTFS writing library for Go

Primary LanguageGoGNU General Public License v2.0GPL-2.0

Go Report Card Build Status GoDoc

go gtfswriter

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.

Usage

feed := gtfsparser.NewFeed()
error := feed.Parse("sample-feed.zip")

// do stuff with feed

w := gtfswriter.Writer{}
werror := w.Write(feed, "/path/to/output")

Features

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 compression
  • 1-9: Compression levels from 1 (fastest) to 9 (best)
  • -1: no compression

Known restrictions

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")

License

GPL v2, see LICENSE