gtfs

package module
v0.0.0-...-42bf374 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 9, 2014 License: MIT Imports: 7 Imported by: 2

README

import "github.com/bdon/go.gtfs"

Examples

Examples assume you have directory called sf_muni containing GTFS files.

feed := gtfs.Load("sf_muni")
route := feed.RouteByShortName("N")
coords := route.Shapes()[0].Coords

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hmstoi

func Hmstoi(str string) int

Types

type CalendarEntry

type CalendarEntry struct {
	ServiceId string
	Days      []string
}

type Coord

type Coord struct {
	Lat float64
	Lon float64
	Seq int
}

type CoordBySeq

type CoordBySeq []Coord

func (CoordBySeq) Len

func (a CoordBySeq) Len() int

func (CoordBySeq) Less

func (a CoordBySeq) Less(i, j int) bool

func (CoordBySeq) Swap

func (a CoordBySeq) Swap(i, j int)

type Feed

type Feed struct {
	Dir             string
	Routes          map[string]*Route
	Shapes          map[string]*Shape
	Stops           map[string]*Stop
	Trips           map[string]*Trip
	CalendarEntries map[string]CalendarEntry
}

func Load

func Load(feed_path string, loadStopTimes bool) Feed

func (Feed) Calendar

func (feed Feed) Calendar() []string

func (*Feed) RouteByShortName

func (feed *Feed) RouteByShortName(shortName string) *Route

type Headsign

type Headsign struct {
	Direction string
	Text      string
}

type Route

type Route struct {
	Id        string
	ShortName string
	LongName  string
	Trips     []*Trip
}

func (Route) Headsigns

func (route Route) Headsigns() []string

func (Route) LongestShape

func (route Route) LongestShape() *Shape

func (Route) Shapes

func (route Route) Shapes() []*Shape

get All shapes for a route

func (Route) Stops

func (route Route) Stops() []*Stop

type Shape

type Shape struct {
	Id     string
	Coords []Coord
}

type Stop

type Stop struct {
	Id    string
	Name  string
	Coord Coord
}

type StopTime

type StopTime struct {
	Stop *Stop
	Trip *Trip
	Time int
	Seq  int
}

type StopTimeBySeq

type StopTimeBySeq []StopTime

func (StopTimeBySeq) Len

func (a StopTimeBySeq) Len() int

func (StopTimeBySeq) Less

func (a StopTimeBySeq) Less(i, j int) bool

func (StopTimeBySeq) Swap

func (a StopTimeBySeq) Swap(i, j int)

type Trip

type Trip struct {
	Id        string
	Shape     *Shape
	Route     *Route
	Service   string
	Direction string
	Headsign  string

	// may not be loaded
	StopTimes []StopTime
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL