Popularity
3.0
Growing
Activity
1.0
-
25
3
12

Programming language: Go
License: GNU General Public License v3.0 only
Tags: Files    
Latest version: v1.1.0

go-gtfs alternatives and similar packages

Based on the "Files" category.
Alternatively, view go-gtfs alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of go-gtfs or a related project?

Add another 'Files' Package

README

go-gtfs

Load GTFS files in golang

godoc for artonge/go-gtfs

Build Status cover.run go goreportcard for artonge/go-gtfs

Sourcegraph for artonge/go-gtfs

Install

go get github.com/artonge/go-gtfs

Examples

Load one directory containing GTFS files:

path/to/gtfs_files
├── agency.txt
├── calendar_dates.txt
├── calendar.txt
├── routes.txt
├── stops.txt
├── stop_times.txt
├── transfers.txt
└── trips.txt
g, err := gtfs.Load("path/to/gtfs_files", nil)

Load a directory containing sub directories containing GTFS files:

path/to/gtfs_directories
├── gtfs1
│   ├── agency.txt
│   ├── calendar_dates.txt
│   ├── routes.txt
│   ├── stops.txt
│   ├── stop_times.txt
│   ├── transfers.txt
│   └── trips.txt
└── gtfs2
    ├── agency.txt
    ├── calendar_dates.txt
    ├── calendar.txt
    ├── routes.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
    Routes     []Route
    Stops      []Stop
    StopsTimes []Stop
    Trips      []Trip
    Calendars  []Calendar
    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_url"`
    URL       string `csv:"route_desc"`
    Color     string `csv:"route_color"`
    TextColor string `csv:"route_text_color"`
}

...

Contributions

Pull requests are welcome ! :)