Load GTFS files in Go.
The project is in maintenance mode.
It is kept compatible with changes in the Go ecosystem but no new features will be developed. PR could be accepted.
go get github.com/artonge/go-gtfs
path/to/gtfs_files
βββ agency.txt
βββ attributions.txt
βββ calendar_dates.txt
βββ calendar.txt
βββ fare_attributes.txt
βββ fare_rules.txt
βββ feed_info.txt
βββ frequencies.txt
βββ levels.txt
βββ pathways.txt
βββ routes.txt
βββ shapes.txt
βββ stops.txt
βββ stop_times.txt
βββ transfers.txt
βββ trips.txt
g, err := gtfs.Load("path/to/gtfs_files", nil)
path/to/gtfs_directories
βββ gtfs1
β βββ agency.txt
β βββ attributions.txt
β βββ calendar_dates.txt
β βββ calendar.txt
β βββ fare_attributes.txt
β βββ fare_rules.txt
β βββ feed_info.txt
β βββ frequencies.txt
β βββ levels.txt
β βββ pathways.txt
β βββ routes.txt
β βββ shapes.txt
β βββ stops.txt
β βββ stop_times.txt
β βββ transfers.txt
β βββ trips.txt
βββ gtfs2
βββ agency.txt
βββ attributions.txt
βββ calendar_dates.txt
βββ calendar.txt
βββ fare_attributes.txt
βββ fare_rules.txt
βββ feed_info.txt
βββ frequencies.txt
βββ levels.txt
βββ pathways.txt
βββ routes.txt
βββ shapes.txt
βββ stops.txt
βββ stop_times.txt
βββ transfers.txt
βββ trips.txt
gs, err := gtfs.LoadSplitted("path/to/gtfs_directories", nil)
You can then access the data through the GTFS structure. That structure contains arrays of approriate structures for each files.
type GTFS struct {
Path string // The path to the containing directory
Agency Agency
Agencies []Agency
Attributions []Attribution
Calendars []Calendar
CalendarDates []CalendarDate
FareAttributes []FareAttribute
FareRules []FareRule
FeedInfos []FeedInfo
Frequencies []Frequency
Levels []Level
Routes []Route
Pathways []Pathway
Shapes []Shape
Stops []Stop
StopsTimes []StopTime
Trips []Trip
Transfers []Transfer
}
type Route struct {
ID string `csv:"route_id"`
AgencyID string `csv:"agency_id"`
ShortName string `csv:"route_short_name"`
LongName string `csv:"route_long_name"`
Type int `csv:"route_type"`
Desc string `csv:"route_desc"`
URL string `csv:"route_url"`
Color string `csv:"route_color"`
TextColor string `csv:"route_text_color"`
}
...
Pull requests are welcome ! :)