Documentation
¶
Index ¶
- func ListGtfsRoutes(gtfs *Gtfs) (routeMap map[string]sort.StringSlice, err error)
- type Gtfs
- func (g *Gtfs) Close() error
- func (g *Gtfs) GetZipFileByName(fileName string) *zip.File
- func (g *Gtfs) LoadAll() error
- func (g *Gtfs) LoadRoutes(file *zip.File) (err error)
- func (g *Gtfs) LoadServices(file *zip.File) (err error)
- func (g *Gtfs) LoadStopTimes(file *zip.File) (err error)
- func (g *Gtfs) LoadStops(file *zip.File) (err error)
- func (g *Gtfs) LoadTrips(file *zip.File) (err error)
- type ReaderAtCloser
- type StopTime
- type TripData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListGtfsRoutes ¶
func ListGtfsRoutes(gtfs *Gtfs) (routeMap map[string]sort.StringSlice, err error)
ListGtfsRoutes will automatically open the GTFS file from a given source, and try to read routes.txt to extract a mapping route_type → sort.StringSlice[route_id, ...]
Types ¶
type Gtfs ¶
type Gtfs struct {
Routes map[string]sort.StringSlice // route_type → [route_id route_id ...]
Stops map[string][2]float64 // stop_id → [stop_lat stop_lon]
Services map[string]bool // service_id → true (if service is active on g.SyncTime)
Trips map[string]TripData // trip_id → TripData
ZipFile *zip.Reader
SyncTime time.Time
// contains filtered or unexported fields
}
Gtfs is an object with access to GTFS data
func NewGtfsFromFile ¶
NewGtfsFromFile automatically creates a Gtfs object from a file on disk
func NewGtfsFromReader ¶
NewGtfsFromReader automatically creates a Gtfs object from a io.Reader
func NewGtfsFromURL ¶
NewGtfsFromURL automatically creates a Gtfs object from a URL
func (*Gtfs) GetZipFileByName ¶
GetZipFileByName will loop over every file in the zip.Reader object, and return the first pointer to zip.File that matches the provided filename. A nil-pointer is returned if no matching file was found.
func (*Gtfs) LoadRoutes ¶
LoadRoutes loads routes.txt from provided zip.File
func (*Gtfs) LoadServices ¶
LoadServices loads calendar_dates.txt from provided zip.File
func (*Gtfs) LoadStopTimes ¶
LoadStopTimes loads stop_times.txt from provided zip.File. This must be called after LoadTrips() completes.
type ReaderAtCloser ¶
ReaderAtCloser is an interface implementing both io.ReaderAt and io.Closer