gtfs

package
v0.0.0-...-0f0c062 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2018 License: GPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agency

type Agency struct {
	Id       string
	Name     string
	Url      *url.URL
	Timezone Timezone
	Lang     LanguageISO6391
	Phone    string
	Fare_url *url.URL
	Email    *mail.Address
}

An Agency represents a transit agency in GTFS

type Date

type Date struct {
	Day   int8
	Month int8
	Year  int16
}

A Date object as used in GTFS

func GetGtfsDateFromTime

func GetGtfsDateFromTime(t time.Time) Date

GetGtfsDateFromTime constructs a GTFS Date object from a Time object

func (Date) GetOffsettedDate

func (d Date) GetOffsettedDate(offset int) Date

GetOffsettedDate returns a date offsetted by a certain number of days

func (Date) GetTime

func (d Date) GetTime() time.Time

GetTime constructs a time object from this date, at 12:00:00 noon

type FareAttribute

type FareAttribute struct {
	Id                string
	Price             string
	Currency_type     string
	Payment_method    int
	Transfers         int
	Transfer_duration int
	Rules             []*FareAttributeRule
}

A FareAttribute is a single fare attribute that applies if certain FareAttributeRules are matched

type FareAttributeRule

type FareAttributeRule struct {
	Route          *Route
	Origin_id      string // connection to Zone_id in Stop
	Destination_id string // connection to Zone_id in Stop
	Contains_id    string // connection to Zone_id in Stop
}

A FareAttributeRule holds rules which describe when a FareAttribute applies

type FeedInfo

type FeedInfo struct {
	Publisher_name string
	Publisher_url  *url.URL
	Lang           string
	Start_date     Date
	End_date       Date
	Phone          string
	Version        string
}

FeedInfo holds general information about a GTFS feed

type Frequency

type Frequency struct {
	Start_time   Time
	End_time     Time
	Headway_secs int
	Exact_times  bool
}

A Frequency is used to describe a periodically served trip

type LanguageISO6391

type LanguageISO6391 struct {
	// contains filtered or unexported fields
}

A LanguageISO6391 struct describes a language according to the ISO 6391 standard

func NewLanguageISO6391

func NewLanguageISO6391(tofind string) (LanguageISO6391, error)

NewLanguageISO6391 create a new LanguageISO6391 object

func (LanguageISO6391) GetLangString

func (a LanguageISO6391) GetLangString() string

GetLangString returns the two-character string representation of an ISO 6391 language

type Route

type Route struct {
	Id         string
	Agency     *Agency
	Short_name string
	Long_name  string
	Desc       string
	Type       int16
	Url        *url.URL
	Color      string
	Text_color string
}

A Route describes a group of trips that are presented to passangers as a single service

type Service

type Service struct {
	Id         string
	Daymap     [7]bool
	Start_date Date
	End_date   Date
	Exceptions map[Date]int8
}

A Service object describes exactly on what days a trip is served

func (*Service) Equals

func (s *Service) Equals(b *Service) bool

Equals returns true if the service is exactly the same - that is if it is active on exactly the same days

func (*Service) GetExceptionTypeOn

func (s *Service) GetExceptionTypeOn(d Date) int8

GetExceptionTypeOn returns the expection type on a particular day

func (*Service) GetFirstDefinedDate

func (s *Service) GetFirstDefinedDate() Date

GetFirstDefinedDate returns the first date something is defined (either positively or negatively) in this service

func (*Service) GetLastDefinedDate

func (s *Service) GetLastDefinedDate() Date

GetLastDefinedDate returns the last date something is defined (either positively or negatively) in this service

func (*Service) IsActiveOn

func (s *Service) IsActiveOn(d Date) bool

IsActiveOn returns true if the service is active on a particular date

type Shape

type Shape struct {
	Id     string
	Points ShapePoints
}

A Shape describes the geographical path of one or multiple trips

func (*Shape) String

func (shape *Shape) String() string

Get a string representation of this shape

type ShapePoint

type ShapePoint struct {
	Lat           float32
	Lon           float32
	Sequence      int
	Dist_traveled float32
	Has_dist      bool
}

A ShapePoint is a single point in a Shape

func (*ShapePoint) HasDistanceTraveled

func (p *ShapePoint) HasDistanceTraveled() bool

HasDistanceTraveled returns true if this ShapePoint has a measurement

func (*ShapePoint) String

func (p *ShapePoint) String() string

Get a string representation of a ShapePoint

type ShapePoints

type ShapePoints []ShapePoint

ShapePoints are multiple ShapePoints

func (ShapePoints) Len

func (shapePoints ShapePoints) Len() int

func (ShapePoints) Less

func (shapePoints ShapePoints) Less(i, j int) bool

func (ShapePoints) Swap

func (shapePoints ShapePoints) Swap(i, j int)

type Stop

type Stop struct {
	Id                  string
	Code                string
	Name                string
	Desc                string
	Lat                 float32
	Lon                 float32
	Zone_id             string
	Url                 *url.URL
	Location_type       bool
	Parent_station      *Stop
	Timezone            Timezone
	Wheelchair_boarding int8
}

A Stop object describes a single stop location

type StopTime

type StopTime struct {
	Arrival_time        Time
	Departure_time      Time
	Stop                *Stop
	Sequence            int
	Headsign            string
	Pickup_type         int8
	Drop_off_type       int8
	Shape_dist_traveled float32
	Timepoint           bool
	Has_dist            bool
}

A StopTime is a single stop with times on a trip

func (StopTime) HasDistanceTraveled

func (s StopTime) HasDistanceTraveled() bool

HasDistanceTraveled returns true if this ShapePoint has a measurement

type StopTimes

type StopTimes []StopTime

StopTimes group multiple StopTime objects

func (StopTimes) Len

func (stopTimes StopTimes) Len() int

func (StopTimes) Less

func (stopTimes StopTimes) Less(i, j int) bool

func (StopTimes) Swap

func (stopTimes StopTimes) Swap(i, j int)

type Time

type Time struct {
	Hour   int8
	Minute int8
	Second int8
}

Time is a simple GTFS time type

func (Time) Empty

func (a Time) Empty() bool

Empty returns true if the Time is 'empty' - null

func (Time) Equals

func (a Time) Equals(b Time) bool

Equals returns true if two Time objects are exactly the same

func (Time) GetLocationTime

func (a Time) GetLocationTime(d Date, agency *Agency) time.Time

GetLocationTime returns the time.Time of the gtfs time on a certain date, for a certain agency (which itself holds a timezone)

func (Time) Minus

func (a Time) Minus(b Time) int

Minus subtracts one time from another

func (Time) SecondsSinceMidnight

func (a Time) SecondsSinceMidnight() int

SecondsSinceMidnight returns the number of seconds since midnight

type Timezone

type Timezone struct {
	// contains filtered or unexported fields
}

A Timezone describes a single timezone in the world

func NewTimezone

func NewTimezone(tofind string) (Timezone, error)

NewTimezone creates a new timezone object

func (Timezone) GetLocation

func (a Timezone) GetLocation() *time.Location

GetLocation constructs a time.Location object from this GTFS timezone

func (Timezone) GetTzString

func (a Timezone) GetTzString() string

GetTzString returns the string representation of a timesone

type Transfer

type Transfer struct {
	From_stop         *Stop
	To_stop           *Stop
	Transfer_type     int
	Min_transfer_time int
}

A Transfer describes a rule for making connections between routes at certain stops

type Trip

type Trip struct {
	Id                    string
	Route                 *Route
	Service               *Service
	Headsign              string
	Short_name            string
	Direction_id          int8
	Block_id              string
	Shape                 *Shape
	Wheelchair_accessible int8
	Bikes_allowed         int8
	StopTimes             StopTimes
	Frequencies           []Frequency
}

A Trip is a single vehicle trip traveling through the network with specific times

Jump to

Keyboard shortcuts

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