Documentation ¶
Index ¶
Constants ¶
const ( // RouteTypeLRT is a route served by an LRT or streetcar RouteTypeLRT RouteType = 0 // RouteTypeSubway is a route served by a subway RouteTypeSubway = 1 // RouteTypeRail is a route served by a heavy rail system RouteTypeRail = 2 // RouteTypeBus is a route served by a bus RouteTypeBus = 3 // RouteTypeFerry is a route served by a ferry RouteTypeFerry = 4 // RouteTypeCableTram is a route served by a cable-driven tram system RouteTypeCableTram = 5 // RouteTypeAerialLift is a route served by an aerial lift system RouteTypeAerialLift = 6 // RouteTypeFunicular is a route served by a funicular system RouteTypeFunicular = 7 )
const ( // LocationTypeStop is a standard stop LocationTypeStop LocationType = 0 // LocationTypeStation is a transit station LocationTypeStation = 1 // LocationTypeStationEntranceExit is the entrance/exit of a station. LocationTypeStationEntranceExit = 2 )
const (
// DateFormat is the GTFS-described date format
DateFormat = "20060102"
)
Variables ¶
var ( // ErrInvalidBoolField is returned if a boolean field has invalid data ErrInvalidBoolField = errors.New("invalid boolean field supplied") // ErrInvalidTimeField is returned if a time field has invalid data ErrInvalidTimeField = errors.New("invalid time field supplied") )
var ( // ErrUnknownFileName is returned if an unknown file is encountered during parsing. ErrUnknownFileName = errors.New("unknown file name encountered") )
Functions ¶
This section is empty.
Types ¶
type Agency ¶
type Agency struct { ID string `csv:"agency_id"` Name string `csv:"agency_name"` URL string `csv:"agency_url"` TZ string `csv:"agency_timezone"` Language string `csv:"agency_language"` ContactNumber string `csv:"agency_phone"` FareURL string `csv:"agency_fare_url"` ContactEmail string `csv:"agency_email"` }
Agency represents the transit agency supplying service.
type CSVBool ¶
type CSVBool bool
CSVBool is a CSV marshalable boolean value
func (*CSVBool) MarshalCSV ¶
MarshalCSV marshals the value into a string format
func (*CSVBool) UnmarshalCSV ¶
UnmarshalCSV takes the string representation from a CSV file and attempts to convert it to a int32.
type CSVDate ¶
CSVDate is a GTFS date parsed from CSV
func (*CSVDate) MarshalCSV ¶
MarshalCSV marshals the value into a string format
func (*CSVDate) UnmarshalCSV ¶
UnmarshalCSV takes the string representation from a CSV file and attempts to convert it to a time.Time.
type CSVFloat ¶
type CSVFloat float64
CSVFloat is a CSV marshalable float64 value
func (CSVFloat) MarshalCSV ¶
MarshalCSV marshals the value into a string format
func (*CSVFloat) UnmarshalCSV ¶
UnmarshalCSV takes the string representation from a CSV file and attempts to convert it to a float64.
type CSVInt ¶
type CSVInt int
CSVInt is a CSV marshalable int32 value
func (*CSVInt) MarshalCSV ¶
MarshalCSV marshals the value into a string format
func (*CSVInt) UnmarshalCSV ¶
UnmarshalCSV takes the string representation from a CSV file and attempts to convert it to a int32.
type CSVTime ¶
CSVTime is a GTFS time parsed from CSV
func NewCSVTime ¶
NewCSVTime creates a new CSVTime from the supplied time.
func (*CSVTime) MarshalCSV ¶
MarshalCSV marshals the value into a string format
func (*CSVTime) UnmarshalCSV ¶
UnmarshalCSV takes the string representation from a CSV file and attempts to convert it to a time.Time.
type Calendar ¶
type Calendar struct { ServiceID string `csv:"service_id"` Monday CSVBool `csv:"monday"` Tuesday CSVBool `csv:"tuesday"` Wednesday CSVBool `csv:"wednesday"` Thursday CSVBool `csv:"thursday"` Friday CSVBool `csv:"friday"` Saturday CSVBool `csv:"saturday"` Sunday CSVBool `csv:"sunday"` StartDate CSVDate `csv:"start_date"` EndDate CSVDate `csv:"end_date"` }
Calendar is a set of days that the specified service is available.
type CalendarDate ¶
type CalendarDate struct { ServiceID string `csv:"service_id"` Date CSVDate `csv:"date"` ExceptionType string `csv:"exception_type"` }
CalendarDate represents a service override on the specified date.
type Dataset ¶
type Dataset struct { Agencies []*Agency Stops []*Stop Routes []*Route Trips []*Trip StopTimes []*StopTime Calendar []*Calendar CalendarDate []*CalendarDate // contains filtered or unexported fields }
Dataset represents all the data available in a GTFS-exposed dataset.
func NewDataset ¶
NewDataset creates a new dataset structure.
func (*Dataset) LoadFromFSPath ¶
LoadFromFSPath loads the contents of the specified path into this dataset.
type LocationType ¶
type LocationType int
LocationType represents the possible set of location types
func (*LocationType) MarshalCSV ¶
func (lt *LocationType) MarshalCSV() (string, error)
MarshalCSV converts this enum into a string for CSV writing.
func (*LocationType) String ¶
func (lt *LocationType) String() string
String presents the caller with a human readable version of this enum.
func (*LocationType) UnmarshalCSV ¶
func (lt *LocationType) UnmarshalCSV(csv string) error
UnmarshalCSV attempts to convert a string value from a CSV file into the enum value.
type Route ¶
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"` Description string `csv:"route_desc"` Type RouteType `csv:"route_type"` URL string `csv:"route_url"` Color string `csv:"route_color"` TextColor string `csv:"route_text_color"` SortOrder CSVInt `csv:"route_sort_order"` }
Route represents a logical run of a vehicle.
type RouteType ¶
type RouteType int
RouteType represents the possible set of route types
func (*RouteType) MarshalCSV ¶
MarshalCSV converts this enum into a string for CSV writing.
func (*RouteType) UnmarshalCSV ¶
UnmarshalCSV attempts to convert a string value from a CSV file into the enum value.
type Stop ¶
type Stop struct { ID string `csv:"stop_id"` Code string `csv:"stop_code"` Name string `csv:"stop_name"` Description string `csv:"stop_desc"` Latitude CSVFloat `csv:"stop_lat"` Longitude CSVFloat `csv:"stop_lon"` ZoneID string `csv:"zone_id"` StopURL string `csv:"stop_url"` LocationType LocationType `csv:"location_type"` ParentStation string `csv:"parent_station"` StopTZ string `csv:"stop_timezone"` WheelchairBoarding string `csv:"wheelchair_boarding"` }
Stop represents a single point that one or more trips may visit.
type StopTime ¶
type StopTime struct { TripID string `csv:"trip_id"` ArrivalTime CSVTime `csv:"arrival_time"` DepartureTime CSVTime `csv:"departure_time"` StopID string `csv:"stop_id"` Sequence CSVInt `csv:"stop_sequence"` Headsign string `csv:"stop_headsign"` PickupType string `csv:"pickup_type"` DropOffType string `csv:"drop_off_type"` ShapeDistanceTraveled CSVFloat `csv:"shape_dist_traveled"` Timepoint string `csv:"timepoint"` }
StopTime represents the time a specific stop is visited on a specific trip.
type Trip ¶
type Trip struct { ID string `csv:"trip_id"` RouteID string `csv:"route_id"` ServiceID string `csv:"service_id"` Headsign string `csv:"trip_headsign"` ShortName string `csv:"trip_short_name"` DirectionID string `csv:"direction_id"` BlockID string `csv:"block_id"` ShapeID string `csv:"shape_id"` WheelchairAccessible string `csv:"wheelchair_accessible"` BikesAllowed string `csv:"bikes_allowed"` }
Trip contains information about a trip.