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 ! :)