gtfs

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: GPL-3.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllEntities added in v1.4.0

func AllEntities() []tt.Entity

AllEntities returns a fresh zero-value instance of every GTFS entity type defined in this package, in roughly reference.md order. It is the canonical enumeration of GTFS entities, intended as a single source of truth for schema-drift checks and any future field-level code generation.

Types

type Agency

type Agency struct {
	AgencyID       tt.String   `standardized_sort:"1"`
	AgencyName     tt.String   `csv:",required"`
	AgencyURL      tt.Url      `csv:",required"`
	AgencyTimezone tt.Timezone `csv:",required"`
	AgencyLang     tt.Language
	AgencyPhone    tt.String
	AgencyFareURL  tt.Url
	AgencyEmail    tt.Email
	CEMVSupport    tt.Int `enum:"0,1,2"`
	tt.BaseEntity
}

Agency agency.txt

func (*Agency) EntityID

func (ent *Agency) EntityID() string

EntityID returns the ID or AgencyID.

func (*Agency) EntityKey

func (ent *Agency) EntityKey() string

EntityKey returns the GTFS identifier.

func (*Agency) Filename

func (ent *Agency) Filename() string

Filename agency.txt

func (*Agency) TableName

func (ent *Agency) TableName() string

TableName gtfs_agencies

type Area

type Area struct {
	AreaID    tt.String `csv:",required" standardized_sort:"1"`
	AreaName  tt.String
	AgencyIDs tt.Strings `csv:"-" db:"agency_ids"` // interline ext
	Geometry  tt.Polygon `csv:"-"`                 // interline ext
	tt.BaseEntity
}

Area fare_areas.txt

func (*Area) EntityID

func (ent *Area) EntityID() string

func (*Area) EntityKey

func (ent *Area) EntityKey() string

func (*Area) Filename

func (ent *Area) Filename() string

func (*Area) TableName

func (ent *Area) TableName() string

type Attribution

type Attribution struct {
	OrganizationName tt.String `csv:",required" standardized_sort:"2"`
	AgencyID         tt.Key    `target:"agency.txt"`
	RouteID          tt.Key    `target:"routes.txt"`
	TripID           tt.Key    `target:"trips.txt"`
	IsProducer       tt.Int    `enum:"0,1"`
	IsOperator       tt.Int    `enum:"0,1"`
	IsAuthority      tt.Int    `enum:"0,1"`
	AttributionID    tt.String `standardized_sort:"1"`
	AttributionURL   tt.Url
	AttributionEmail tt.Email
	AttributionPhone tt.String
	tt.BaseEntity
}

func (*Attribution) ConditionalErrors

func (ent *Attribution) ConditionalErrors() (errs []error)

Errors for this Entity.

func (*Attribution) Filename

func (ent *Attribution) Filename() string

func (*Attribution) TableName

func (ent *Attribution) TableName() string

type BookingRule added in v1.3.0

type BookingRule struct {
	BookingRuleID          tt.String `csv:",required" standardized_sort:"1"`
	BookingType            tt.Int    `csv:",required" enum:"0,1,2"`
	PriorNoticeDurationMin tt.Int
	PriorNoticeDurationMax tt.Int
	PriorNoticeLastDay     tt.Int
	PriorNoticeLastTime    tt.Seconds
	PriorNoticeStartDay    tt.Int
	PriorNoticeStartTime   tt.Seconds
	PriorNoticeServiceID   tt.Key `target:"calendar.txt"`
	Message                tt.String
	PickupMessage          tt.String
	DropOffMessage         tt.String
	PhoneNumber            tt.String
	InfoURL                tt.Url
	BookingURL             tt.Url
	tt.BaseEntity
}

BookingRule booking_rules.txt

func (*BookingRule) ConditionalErrors added in v1.3.0

func (ent *BookingRule) ConditionalErrors() (errs []error)

ConditionalErrors for this Entity.

func (*BookingRule) EntityID added in v1.3.0

func (ent *BookingRule) EntityID() string

func (*BookingRule) EntityKey added in v1.3.0

func (ent *BookingRule) EntityKey() string

func (*BookingRule) Filename added in v1.3.0

func (ent *BookingRule) Filename() string

func (*BookingRule) TableName added in v1.3.0

func (ent *BookingRule) TableName() string

func (*BookingRule) UpdateKeys added in v1.3.0

func (ent *BookingRule) UpdateKeys(emap *tt.EntityMap) error

UpdateKeys updates Entity references.

type Calendar

type Calendar struct {
	ServiceID     tt.String      `csv:",required" standardized_sort:"1"`
	Monday        tt.Int         `csv:",required" enum:"0,1"`
	Tuesday       tt.Int         `csv:",required" enum:"0,1"`
	Wednesday     tt.Int         `csv:",required" enum:"0,1"`
	Thursday      tt.Int         `csv:",required" enum:"0,1"`
	Friday        tt.Int         `csv:",required" enum:"0,1"`
	Saturday      tt.Int         `csv:",required" enum:"0,1"`
	Sunday        tt.Int         `csv:",required" enum:"0,1"`
	StartDate     tt.Date        `csv:",required"`
	EndDate       tt.Date        `csv:",required"`
	Generated     tt.Bool        `csv:"-" db:"generated"`
	CalendarDates []CalendarDate `csv:"-" db:"-"` // for validation
	tt.BaseEntity
}

Calendar calendar.txt

func (*Calendar) ConditionalErrors

func (ent *Calendar) ConditionalErrors() []error

Errors for this Entity.

func (*Calendar) EntityID

func (ent *Calendar) EntityID() string

EntityID returns the ID or ServiceID.

func (*Calendar) EntityKey

func (ent *Calendar) EntityKey() string

EntityKey returns the GTFS identifier.

func (*Calendar) Filename

func (ent *Calendar) Filename() string

Filename calendar.txt

func (*Calendar) TableName

func (ent *Calendar) TableName() string

TableName gtfs_calendars

type CalendarDate

type CalendarDate struct {
	ServiceID     tt.Key  `csv:",required" target:"calendar.txt" standardized_sort:"1"`
	Date          tt.Date `csv:",required" standardized_sort:"2"`
	ExceptionType tt.Int  `csv:",required" enum:"1,2"`
	tt.BaseEntity
}

CalendarDate calendar_dates.txt

func (*CalendarDate) Filename

func (ent *CalendarDate) Filename() string

Filename calendar_dates.txt

func (*CalendarDate) TableName

func (ent *CalendarDate) TableName() string

TableName gtfs_calendar_dates

type FareAttribute

type FareAttribute struct {
	FareID           tt.String   `csv:",required" standardized_sort:"1"`
	Price            tt.Float    `csv:",required" range:"0,"`
	CurrencyType     tt.Currency `csv:",required"`
	PaymentMethod    tt.Int      `csv:",required" enum:"0,1"`
	Transfers        tt.Int      `enum:"0,1,2"` // note! null is distinct from 0
	AgencyID         tt.Key      `target:"agency.txt"`
	TransferDuration tt.Int      `range:"0,"`
	tt.BaseEntity
}

FareAttribute fare_attributes.txt

func (*FareAttribute) EntityID

func (ent *FareAttribute) EntityID() string

EntityID returns the ID or FareID.

func (*FareAttribute) EntityKey

func (ent *FareAttribute) EntityKey() string

EntityKey returns the GTFS identifier.

func (*FareAttribute) Filename

func (ent *FareAttribute) Filename() string

Filename fare_attributes.txt

func (*FareAttribute) TableName

func (ent *FareAttribute) TableName() string

TableName gtfs_fare_attributes

type FareLegJoinRule added in v1.4.0

type FareLegJoinRule struct {
	FromNetworkID tt.String `csv:",required" target:"networks.txt" standardized_sort:"1"`
	ToNetworkID   tt.String `csv:",required" target:"networks.txt" standardized_sort:"2"`
	FromStopID    tt.String `target:"stops.txt" standardized_sort:"3"`
	ToStopID      tt.String `target:"stops.txt" standardized_sort:"4"`
	tt.BaseEntity
}

FareLegJoinRule fare_leg_join_rules.txt

func (*FareLegJoinRule) ConditionalErrors added in v1.4.0

func (ent *FareLegJoinRule) ConditionalErrors() (errs []error)

ConditionalErrors enforces that from_stop_id and to_stop_id are present together.

func (*FareLegJoinRule) DuplicateKey added in v1.4.0

func (ent *FareLegJoinRule) DuplicateKey() string

DuplicateKey returns the composite primary key for duplicate detection.

func (*FareLegJoinRule) Filename added in v1.4.0

func (ent *FareLegJoinRule) Filename() string

func (*FareLegJoinRule) TableName added in v1.4.0

func (ent *FareLegJoinRule) TableName() string

type FareLegRule

type FareLegRule struct {
	LegGroupID           tt.String
	FromAreaID           tt.String `target:"areas.txt" standardized_sort:"2"`
	ToAreaID             tt.String `target:"areas.txt" standardized_sort:"3"`
	NetworkID            tt.String `target:"networks.txt" standardized_sort:"1"`
	FareProductID        tt.String `csv:",required" target:"fare_products.txt:fare_product_id" standardized_sort:"6"`
	FromTimeframeGroupID tt.String `target:"timeframes.txt:timeframe_group_id" standardized_sort:"4"`
	ToTimeframeGroupID   tt.String `target:"timeframes.txt:timeframe_group_id" standardized_sort:"5"`
	RulePriority         tt.Int    `range:"0,"`
	TransferOnly         tt.Int    `enum:"0,1"` // interline ext
	tt.BaseEntity
}

FareLegRule fare_leg_rules.txt

func (*FareLegRule) DuplicateKey added in v1.0.0

func (ent *FareLegRule) DuplicateKey() string

func (*FareLegRule) EntityID

func (ent *FareLegRule) EntityID() string

func (*FareLegRule) Filename

func (ent *FareLegRule) Filename() string

func (*FareLegRule) GroupKey added in v1.0.0

func (ent *FareLegRule) GroupKey() (string, string)

func (*FareLegRule) TableName

func (ent *FareLegRule) TableName() string

type FareMedia

type FareMedia struct {
	FareMediaID   tt.String `csv:",required" standardized_sort:"1"`
	FareMediaName tt.String
	FareMediaType tt.Int `csv:",required" enum:"0,1,2,3,4"`
	tt.BaseEntity
}

FareMedia fare_media.txt

func (*FareMedia) EntityID

func (ent *FareMedia) EntityID() string

func (*FareMedia) EntityKey

func (ent *FareMedia) EntityKey() string

func (*FareMedia) Filename

func (ent *FareMedia) Filename() string

func (*FareMedia) TableName

func (ent *FareMedia) TableName() string

type FareProduct

type FareProduct struct {
	FareProductID   tt.String `csv:",required" standardized_sort:"1"`
	FareProductName tt.String
	Amount          tt.CurrencyAmount `csv:",required"`
	Currency        tt.Currency       `csv:",required"`
	DurationStart   tt.Int            `enum:"0,1"`           // proposed extension
	DurationAmount  tt.Float          `range:"0,"`           // proposed extension
	DurationUnit    tt.Int            `enum:"0,1,2,3,4,5,6"` // proposed extension
	DurationType    tt.Int            `enum:"1,2"`           // proposed extension
	RiderCategoryID tt.Key            `target:"rider_categories.txt:rider_category_id" standardized_sort:"2"`
	FareMediaID     tt.Key            `target:"fare_media.txt" standardized_sort:"3"`
	tt.BaseEntity
}

FareProduct fare_products.txt

func (*FareProduct) ConditionalErrors

func (ent *FareProduct) ConditionalErrors() (errs []error)

func (*FareProduct) DuplicateKey added in v1.0.0

func (ent *FareProduct) DuplicateKey() string

func (*FareProduct) EntityID

func (ent *FareProduct) EntityID() string

func (*FareProduct) Filename

func (ent *FareProduct) Filename() string

func (*FareProduct) GetValue

func (ent *FareProduct) GetValue(key string) (any, bool)

func (*FareProduct) GroupKey added in v1.0.0

func (ent *FareProduct) GroupKey() (string, string)

func (*FareProduct) TableName

func (ent *FareProduct) TableName() string

type FareRule

type FareRule struct {
	FareID        tt.String `csv:",required" target:"fare_attributes.txt" standardized_sort:"1"`
	RouteID       tt.Key    `target:"routes.txt" standardized_sort:"2"`
	OriginID      tt.String `standardized_sort:"3"`
	DestinationID tt.String `standardized_sort:"4"`
	ContainsID    tt.String `standardized_sort:"5"`
	tt.BaseEntity
}

FareRule fare_rules.txt

func (*FareRule) DuplicateKey added in v1.0.0

func (ent *FareRule) DuplicateKey() string

func (*FareRule) Filename

func (ent *FareRule) Filename() string

Filename fare_rules.txt

func (*FareRule) TableName

func (ent *FareRule) TableName() string

TableName gtfs_fare_Rules

type FareTransferRule

type FareTransferRule struct {
	FromLegGroupID      tt.String `target:"fare_leg_rules.txt:leg_group_id" standardized_sort:"1"`
	ToLegGroupID        tt.String `target:"fare_leg_rules.txt:leg_group_id" standardized_sort:"2"`
	TransferCount       tt.Int    `range:"-1," standardized_sort:"4"`
	DurationLimit       tt.Int    `range:"0," standardized_sort:"5"`
	DurationLimitType   tt.Int    `enum:"0,1,2,3"`
	FareTransferType    tt.Int    `csv:",required" enum:"0,1,2"`
	FareProductID       tt.String `target:"fare_products.txt:fare_product_id" standardized_sort:"3"`
	FilterFareProductID tt.String `target:"fare_products.txt:fare_product_id"` // proposed extension
	tt.BaseEntity
}

FareTransferRule fare_transfer_rules.txt

func (*FareTransferRule) ConditionalErrors

func (ent *FareTransferRule) ConditionalErrors() (errs []error)

func (*FareTransferRule) DuplicateKey added in v1.0.0

func (ent *FareTransferRule) DuplicateKey() string

func (*FareTransferRule) Filename

func (ent *FareTransferRule) Filename() string

func (*FareTransferRule) TableName

func (ent *FareTransferRule) TableName() string

type FeedInfo

type FeedInfo struct {
	FeedPublisherName tt.String   `csv:",required" standardized_sort:"1"`
	FeedPublisherURL  tt.Url      `csv:",required"`
	FeedLang          tt.Language `csv:",required"`
	FeedVersion       tt.String   `db:"feed_version_name"`
	FeedStartDate     tt.Date
	FeedEndDate       tt.Date
	DefaultLang       tt.Language
	FeedContactEmail  tt.Email
	FeedContactURL    tt.Url
	tt.BaseEntity
}

FeedInfo feed_info.txt

func (*FeedInfo) ConditionalErrors

func (ent *FeedInfo) ConditionalErrors() (errs []error)

Errors for this Entity.

func (*FeedInfo) Filename

func (ent *FeedInfo) Filename() string

Filename feed_info.txt

func (*FeedInfo) TableName

func (ent *FeedInfo) TableName() string

TableName gtfs_feed_infos

type FlexInfo added in v1.3.0

type FlexInfo struct {
	HasFlexStopTimes     bool // Any StopTime uses Location or LocationGroup instead of StopID
	HasFlexTimeWindows   bool // Any StopTime uses pickup/dropoff time windows
	HasMixedStopTypes    bool // Mix of regular stops and flex locations
	AllStopsHaveStopID   bool // All StopTimes have a valid StopID
	FlexStopTimeCount    int  // Number of StopTimes with flex characteristics
	RegularStopTimeCount int  // Number of StopTimes with regular StopID
}

FlexInfo contains information about flex characteristics of a trip's stop times

func CheckFlexStopTimes added in v1.3.0

func CheckFlexStopTimes(stoptimes []StopTime) FlexInfo

CheckFlexStopTimes analyzes a slice of StopTimes and returns information about whether they represent fixed-route service or flex service.

func (FlexInfo) CanUseStopBasedGeometry added in v1.3.0

func (f FlexInfo) CanUseStopBasedGeometry() bool

CanUseStopBasedGeometry returns true if the trip can use stop-based geometry calculations (i.e., all StopTimes have valid StopIDs)

func (FlexInfo) IsFlexTrip added in v1.3.0

func (f FlexInfo) IsFlexTrip() bool

IsFlexTrip returns true if any StopTime has flex characteristics

type Frequency

type Frequency struct {
	TripID      tt.String  `csv:",required" target:"trips.txt" standardized_sort:"1"`
	HeadwaySecs tt.Int     `csv:",required" range:"1,"`
	StartTime   tt.Seconds `csv:",required" standardized_sort:"2"`
	EndTime     tt.Seconds `csv:",required"`
	ExactTimes  tt.Int     `enum:"0,1"`
	tt.BaseEntity
}

Frequency frequencies.txt

func (*Frequency) ConditionalErrors

func (ent *Frequency) ConditionalErrors() (errs []error)

Errors for this Entity.

func (*Frequency) Filename

func (ent *Frequency) Filename() string

Filename frequencies.txt

func (*Frequency) RepeatCount

func (ent *Frequency) RepeatCount() int

RepeatCount returns the number of trips this frequency runs.

func (*Frequency) Starts added in v1.4.0

func (ent *Frequency) Starts() []int

Starts returns the times this frequency's trips leave the first stop: every headway_secs from start_time, up to but not including end_time.

func (*Frequency) TableName

func (ent *Frequency) TableName() string

TableName gtfs_frequencies

type Level

type Level struct {
	LevelID    tt.String `csv:",required" standardized_sort:"1"`
	LevelIndex tt.Float  `csv:",required"`
	LevelName  tt.String
	tt.BaseEntity
}

Level levels.txt

func (*Level) EntityID

func (ent *Level) EntityID() string

EntityID returns the ID or StopID.

func (*Level) EntityKey

func (ent *Level) EntityKey() string

EntityKey returns the GTFS identifier.

func (*Level) Filename

func (ent *Level) Filename() string

Filename levels.txt

func (*Level) TableName

func (ent *Level) TableName() string

TableName ext_pathways_levels

type Location added in v1.3.0

type Location struct {
	// ID is the feature ID from the GeoJSON, shares namespace with stop_id
	LocationID tt.String `json:"id" csv:",required" standardized_sort:"1"`
	// Properties
	StopName tt.String   `json:"stop_name"`
	StopDesc tt.String   `json:"stop_desc"`
	ZoneID   tt.String   `json:"zone_id"`
	StopURL  tt.Url      `json:"stop_url"`
	Geometry tt.Geometry `json:"geometry"`
	tt.BaseEntity
}

Location represents a GeoJSON feature from locations.geojson Locations define zones using GeoJSON Polygon or MultiPolygon geometries where riders can request pickups or drop-offs for flexible services

func (*Location) ConditionalErrors added in v1.3.0

func (ent *Location) ConditionalErrors() (errs []error)

ConditionalErrors for this Entity.

func (*Location) EntityID added in v1.3.0

func (ent *Location) EntityID() string

func (*Location) EntityKey added in v1.3.0

func (ent *Location) EntityKey() string

func (*Location) Filename added in v1.3.0

func (ent *Location) Filename() string

func (*Location) TableName added in v1.3.0

func (ent *Location) TableName() string

type LocationGroup added in v1.3.0

type LocationGroup struct {
	LocationGroupID   tt.String `csv:",required" standardized_sort:"1"`
	LocationGroupName tt.String
	tt.BaseEntity
}

LocationGroup location_groups.txt

func (*LocationGroup) EntityID added in v1.3.0

func (ent *LocationGroup) EntityID() string

func (*LocationGroup) EntityKey added in v1.3.0

func (ent *LocationGroup) EntityKey() string

func (*LocationGroup) Filename added in v1.3.0

func (ent *LocationGroup) Filename() string

func (*LocationGroup) TableName added in v1.3.0

func (ent *LocationGroup) TableName() string

type LocationGroupStop added in v1.3.0

type LocationGroupStop struct {
	LocationGroupID tt.Key `csv:",required" target:"location_groups.txt" standardized_sort:"1"`
	StopID          tt.Key `csv:",required" target:"stops.txt" standardized_sort:"2"`
	tt.BaseEntity
}

LocationGroupStop location_group_stops.txt

func (*LocationGroupStop) Filename added in v1.3.0

func (ent *LocationGroupStop) Filename() string

func (*LocationGroupStop) TableName added in v1.3.0

func (ent *LocationGroupStop) TableName() string

func (*LocationGroupStop) UpdateKeys added in v1.3.0

func (ent *LocationGroupStop) UpdateKeys(emap *tt.EntityMap) error

UpdateKeys updates Entity references.

type Network added in v1.0.0

type Network struct {
	NetworkID   tt.String `csv:",required" standardized_sort:"1"`
	NetworkName tt.String
	tt.BaseEntity
}

func (*Network) EntityID added in v1.0.0

func (ent *Network) EntityID() string

func (*Network) EntityKey added in v1.0.0

func (ent *Network) EntityKey() string

func (*Network) Filename added in v1.0.0

func (ent *Network) Filename() string

func (*Network) TableName added in v1.0.0

func (ent *Network) TableName() string

type Pathway

type Pathway struct {
	PathwayID           tt.String `csv:",required" standardized_sort:"1"`
	FromStopID          tt.String `csv:",required" target:"stops.txt"`
	ToStopID            tt.String `csv:",required" target:"stops.txt"`
	PathwayMode         tt.Int    `csv:",required" enum:"1,2,3,4,5,6,7"`
	IsBidirectional     tt.Int    `csv:",required" enum:"0,1"`
	Length              tt.Float  `gte:"0"`
	TraversalTime       tt.Int    `gt:"0"`
	MinWidth            tt.Float  `gt:"0"`
	MaxSlope            tt.Float
	StairCount          tt.Int
	SignpostedAs        tt.String
	ReverseSignpostedAs tt.String `csv:"reversed_signposted_as,alias=reverse_signposted_as"`
	tt.BaseEntity
}

Pathway pathways.txt

Note: ReverseSignpostedAs needs an explicit csv tag. The GTFS field is "reversed_signposted_as", which is not what the column name derivation produces from the Go field name. The alias reads the derived name that earlier versions of this library wrote.

Aliases are honored on the reflect load path. StopTime and Shape implement SetString and load through their own switch statements instead, so an alias on those entities would have no effect.

func (*Pathway) ConditionalErrors added in v1.3.0

func (ent *Pathway) ConditionalErrors() []error

ConditionalErrors returns validation errors for the Pathway entity.

func (*Pathway) EntityID

func (ent *Pathway) EntityID() string

EntityID returns the ID or StopID.

func (*Pathway) EntityKey

func (ent *Pathway) EntityKey() string

EntityKey returns the GTFS identifier.

func (*Pathway) Filename

func (ent *Pathway) Filename() string

Filename pathways.txt

func (*Pathway) TableName

func (ent *Pathway) TableName() string

TableName ext_pathway_pathways

type Reader added in v1.0.0

type Reader interface {
	Stops() chan Stop
	StopTimes() chan StopTime
	Agencies() chan Agency
	Calendars() chan Calendar
	CalendarDates() chan CalendarDate
	FareAttributes() chan FareAttribute
	FareRules() chan FareRule
	FeedInfos() chan FeedInfo
	Frequencies() chan Frequency
	Routes() chan Route
	Shapes() chan Shape
	Transfers() chan Transfer
	Pathways() chan Pathway
	Levels() chan Level
	Trips() chan Trip
	Translations() chan Translation
	Attributions() chan Attribution
	Areas() chan Area
	StopAreas() chan StopArea
	FareLegRules() chan FareLegRule
	FareLegJoinRules() chan FareLegJoinRule
	FareTransferRules() chan FareTransferRule
	FareProducts() chan FareProduct
	RiderCategories() chan RiderCategory
	FareMedia() chan FareMedia
	Timeframes() chan Timeframe
	Networks() chan Network
	RouteNetworks() chan RouteNetwork
	LocationGroups() chan LocationGroup
	LocationGroupStops() chan LocationGroupStop
	BookingRules() chan BookingRule
	Locations() chan Location
}

type RiderCategory

type RiderCategory struct {
	RiderCategoryID       tt.String `csv:",required" standardized_sort:"1"`
	RiderCategoryName     tt.String `csv:",required"`
	MinAge                tt.Int    `range:"0,"`
	MaxAge                tt.Int    `range:"0,"`
	IsDefaultFareCategory tt.Int    `range:"0,1"`
	EligibilityURL        tt.Url
	tt.BaseEntity
}

RiderCategory rider_categories.txt

func (*RiderCategory) ConditionalErrors

func (ent *RiderCategory) ConditionalErrors() (errs []error)

func (*RiderCategory) Filename

func (ent *RiderCategory) Filename() string

func (*RiderCategory) GroupKey added in v1.0.0

func (ent *RiderCategory) GroupKey() (string, string)

func (*RiderCategory) TableName

func (ent *RiderCategory) TableName() string

type Route

type Route struct {
	RouteID           tt.String `csv:",required" standardized_sort:"1"`
	AgencyID          tt.Key    `target:"agency.txt"`
	RouteShortName    tt.String
	RouteLongName     tt.String
	RouteDesc         tt.String
	RouteType         tt.Int `csv:",required"`
	RouteURL          tt.Url
	RouteColor        tt.Color
	RouteTextColor    tt.Color
	RouteSortOrder    tt.Int `range:"0,"`
	ContinuousPickup  tt.Int `enum:"0,1,2,3"`
	ContinuousDropOff tt.Int `enum:"0,1,2,3"`
	NetworkID         tt.String
	CEMVSupport       tt.Int `enum:"0,1,2"`
	AsRoute           tt.Int
	Geometry          tt.Geometry `csv:"-" db:"-"`
	tt.BaseEntity
}

Route routes.txt

func (*Route) ConditionalErrors

func (ent *Route) ConditionalErrors() []error

func (*Route) EntityID

func (ent *Route) EntityID() string

EntityID returns ID or RouteID.

func (*Route) EntityKey

func (ent *Route) EntityKey() string

EntityKey returns the GTFS identifier.

func (*Route) Filename

func (ent *Route) Filename() string

Filename routes.txt

func (*Route) GroupKey added in v1.0.0

func (ent *Route) GroupKey() (string, string)

func (*Route) TableName

func (ent *Route) TableName() string

TableName gtfs_routes

type RouteNetwork added in v1.0.0

type RouteNetwork struct {
	NetworkID tt.Key `csv:",required" target:"networks.txt" standardized_sort:"1"`
	RouteID   tt.Key `csv:",required" target:"routes.txt" standardized_sort:"2"`
	tt.BaseEntity
}

func (*RouteNetwork) DuplicateKey added in v1.0.0

func (ent *RouteNetwork) DuplicateKey() string

func (*RouteNetwork) Filename added in v1.0.0

func (ent *RouteNetwork) Filename() string

func (*RouteNetwork) TableName added in v1.0.0

func (ent *RouteNetwork) TableName() string

type Shape

type Shape struct {
	ShapeID           tt.String `csv:",required" standardized_sort:"1"`
	ShapePtLat        tt.Float  `db:"-" csv:",required" range:"-90,90"`
	ShapePtLon        tt.Float  `db:"-" csv:",required" range:"-180,180"`
	ShapePtSequence   tt.Int    `db:"-" csv:",required" range:"0," standardized_sort:"2"`
	ShapeDistTraveled tt.Float  `db:"-" range:"0,"`
	tt.BaseEntity
}

Shape shapes.txt

func (*Shape) EntityID

func (ent *Shape) EntityID() string

EntityID returns the ID or ShapeID.

func (*Shape) EntityKey

func (ent *Shape) EntityKey() string

EntityKey returns the GTFS identifier.

func (*Shape) Errors

func (ent *Shape) Errors() (errs []error)

Errors for this Entity.

func (*Shape) Filename

func (ent *Shape) Filename() string

Filename shapes.txt

func (*Shape) SetString

func (ent *Shape) SetString(key string, value string) error

SetString provides a fast, non-reflect loading path.

type Stop

type Stop struct {
	StopID             tt.String `csv:",required" required:"true" standardized_sort:"1"`
	StopName           tt.String
	StopCode           tt.String
	StopDesc           tt.String
	StopLat            tt.Float `db:"-" range:"-90,90"` // csv load to Geometry
	StopLon            tt.Float `db:"-" range:"-180,180"`
	ZoneID             tt.String
	StopURL            tt.Url
	TtsStopName        tt.String
	PlatformCode       tt.String
	LocationType       tt.Int `enum:"0,1,2,3,4"`
	ParentStation      tt.Key `target:"stops.txt"`
	StopTimezone       tt.Timezone
	WheelchairBoarding tt.Int   `enum:"0,1,2"`
	LevelID            tt.Key   `target:"levels.txt"`
	StopAccess         tt.Int   `enum:"0,1"`
	Geometry           tt.Point `csv:"-" db:"geometry"`
	tt.BaseEntity
}

Stop stops.txt

func (*Stop) ConditionalErrors

func (ent *Stop) ConditionalErrors() []error

func (*Stop) Coordinates

func (ent *Stop) Coordinates() [2]float64

Coordinates returns the stop lon,lat as a [2]float64

func (*Stop) EntityID

func (ent *Stop) EntityID() string

EntityID returns the ID or StopID.

func (*Stop) EntityKey

func (ent *Stop) EntityKey() string

EntityKey returns the GTFS identifier.

func (*Stop) Filename

func (ent *Stop) Filename() string

Filename stops.txt

func (*Stop) SetCoordinates

func (ent *Stop) SetCoordinates(p [2]float64)

SetCoordinates takes a [2]float64 and sets the Stop's lon,lat

func (*Stop) TableName

func (ent *Stop) TableName() string

TableName gtfs_stops

func (*Stop) ToPoint

func (ent *Stop) ToPoint() tlxy.Point

type StopArea

type StopArea struct {
	AreaID tt.Key `csv:",required" target:"areas.txt" standardized_sort:"1"`
	StopID tt.Key `csv:",required" target:"stops.txt" standardized_sort:"2"`
	tt.BaseEntity
}

StopArea stop_areas.txt

func (*StopArea) Filename

func (ent *StopArea) Filename() string

func (*StopArea) TableName

func (ent *StopArea) TableName() string

type StopTime

type StopTime struct {
	TripID            tt.String `csv:",required" target:"trips.txt" standardized_sort:"1"`
	StopID            tt.Key    `target:"stops.txt"`
	LocationGroupID   tt.Key    `target:"location_groups.txt"`
	LocationID        tt.Key    `target:"locations.txt"`
	StopSequence      tt.Int    `csv:",required" standardized_sort:"2"`
	StopHeadsign      tt.String
	ArrivalTime       tt.Seconds
	DepartureTime     tt.Seconds
	PickupType        tt.Int
	DropOffType       tt.Int
	ContinuousPickup  tt.Int
	ContinuousDropOff tt.Int
	ShapeDistTraveled tt.Float
	Timepoint         tt.Int
	Interpolated      tt.Int `csv:"-"` // interpolated times: 0 for provided, 1 interpolated // TODO: 1 for shape, 2 for straight-line
	// GTFS-Flex fields (officially adopted)
	StartPickupDropOffWindow tt.Seconds
	EndPickupDropOffWindow   tt.Seconds
	PickupBookingRuleID      tt.Key `target:"booking_rules.txt"`
	DropOffBookingRuleID     tt.Key `target:"booking_rules.txt"`
	// Deprecated: safe_duration_factor / safe_duration_offset were adopted into GTFS
	// on trips.txt (google/transit#598, merged 2026-04), not stop_times.txt. The
	// GTFS-Flex proposal originally placed them on stop_times.txt, and some feeds
	// still emit them there, so they are retained here for backward compat. See
	// gtfs.Trip for the spec-conformant fields.
	SafeDurationFactor tt.Float
	SafeDurationOffset tt.Float
	// Deprecated: mean_duration_factor / mean_duration_offset remain only in the
	// (unadopted) GTFS-Flex proposal on stop_times.txt; they were not part of the
	// GTFS adoption (google/transit#598) and have no official home. Retained for
	// backward compat with feeds that still emit them on stop_times.
	MeanDurationFactor tt.Float
	MeanDurationOffset tt.Float
	tt.MinEntity
	tt.ErrorEntity
	tt.ExtraEntity
	tt.FeedVersionEntity
}

StopTime stop_times.txt

func (*StopTime) ConditionalErrors added in v1.3.0

func (ent *StopTime) ConditionalErrors() (errs []error)

ConditionalErrors for StopTime - includes GTFS-Flex validation

func (*StopTime) Errors

func (ent *StopTime) Errors() []error

Errors for this Entity.

func (*StopTime) Filename

func (ent *StopTime) Filename() string

Filename stop_times.txt

func (*StopTime) GetString

func (ent *StopTime) GetString(key string) (string, error)

GetString returns the string representation of an field.

func (*StopTime) SetString

func (ent *StopTime) SetString(key, value string) error

SetString provides a fast, non-reflect loading path.

func (*StopTime) TableName

func (ent *StopTime) TableName() string

TableName gtfs_stop_times

func (*StopTime) UpdateKeys

func (ent *StopTime) UpdateKeys(emap *tt.EntityMap) error

UpdateKeys updates Entity references.

type Timeframe added in v1.0.0

type Timeframe struct {
	TimeframeGroupID tt.String  `csv:",required" standardized_sort:"1"`
	StartTime        tt.Seconds `standardized_sort:"2"`
	EndTime          tt.Seconds `standardized_sort:"3"`
	ServiceID        tt.Key     `csv:",required" target:"calendar.txt" standardized_sort:"4"`
	tt.BaseEntity
}

func (*Timeframe) ConditionalErrors added in v1.3.0

func (ent *Timeframe) ConditionalErrors() (errs []error)

Errors for this Entity.

func (*Timeframe) Filename added in v1.0.0

func (ent *Timeframe) Filename() string

func (*Timeframe) GroupKey added in v1.0.0

func (ent *Timeframe) GroupKey() (string, string)

func (*Timeframe) TableName added in v1.0.0

func (ent *Timeframe) TableName() string

type Transfer

type Transfer struct {
	FromStopID      tt.Key `target:"stops.txt" standardized_sort:"1"`
	ToStopID        tt.Key `target:"stops.txt" standardized_sort:"2"`
	FromRouteID     tt.Key `target:"routes.txt" standardized_sort:"5"`
	ToRouteID       tt.Key `target:"routes.txt" standardized_sort:"6"`
	FromTripID      tt.Key `target:"trips.txt" standardized_sort:"3"`
	ToTripID        tt.Key `target:"trips.txt" standardized_sort:"4"`
	TransferType    tt.Int `enum:"0,1,2,3,4,5"`
	MinTransferTime tt.Int `range:"0,"`
	tt.BaseEntity
}

Transfer transfers.txt

func (*Transfer) ConditionalErrors

func (ent *Transfer) ConditionalErrors() (errs []error)

Errors for this Entity.

func (*Transfer) Filename

func (ent *Transfer) Filename() string

Filename transfers.txt

func (*Transfer) TableName

func (ent *Transfer) TableName() string

TableName gtfs_transfers

type Translation

type Translation struct {
	// "TableNameValue" because TableName is a required interface method
	TableNameValue tt.String   `db:"table_name" csv:"table_name,required" standardized_sort:"1"`
	FieldName      tt.String   `csv:",required" standardized_sort:"2"`
	Language       tt.Language `csv:",required" standardized_sort:"3"`
	Translation    tt.String   `csv:",required"`
	RecordID       tt.String   `standardized_sort:"4"`
	RecordSubID    tt.String   `standardized_sort:"5"`
	FieldValue     tt.String   `standardized_sort:"6"`
	tt.BaseEntity
}

func (*Translation) ConditionalErrors

func (ent *Translation) ConditionalErrors() (errs []error)

Errors for this Entity.

func (*Translation) Filename

func (ent *Translation) Filename() string

func (*Translation) TableName

func (ent *Translation) TableName() string

type Trip

type Trip struct {
	RouteID              tt.Key    `csv:",required" target:"routes.txt"`
	ServiceID            tt.Key    `csv:",required" target:"calendar.txt"`
	TripID               tt.String `csv:",required" standardized_sort:"1"`
	TripHeadsign         tt.String
	TripShortName        tt.String
	DirectionID          tt.Int `enum:"0,1"`
	BlockID              tt.String
	ShapeID              tt.Key `target:"shapes.txt"`
	WheelchairAccessible tt.Int `enum:"0,1,2"`
	BikesAllowed         tt.Int `enum:"0,1,2"`
	CarsAllowed          tt.Int `enum:"0,1,2"`
	SafeDurationFactor   tt.Float
	SafeDurationOffset   tt.Float
	JourneyPatternID     tt.String  `csv:"-"`
	JourneyPatternOffset tt.Int     `csv:"-"`
	StopPatternID        tt.Int     `csv:"-"`
	StopTimes            []StopTime `csv:"-" db:"-"` // for validation
	tt.BaseEntity
}

Trip trips.txt

func (*Trip) ConditionalErrors added in v1.4.0

func (ent *Trip) ConditionalErrors() (errs []error)

ConditionalErrors validates GTFS-Flex safe duration fields.

func (*Trip) EntityID

func (ent *Trip) EntityID() string

EntityID returns the ID or TripID.

func (*Trip) EntityKey

func (ent *Trip) EntityKey() string

EntityKey returns the GTFS identifier.

func (*Trip) Filename

func (ent *Trip) Filename() string

Filename trips.txt

func (*Trip) TableName

func (ent *Trip) TableName() string

TableName gtfs_trips

type TripStopTimes added in v1.3.4

type TripStopTimes struct {
	Valid     bool
	Trip      Trip
	StopTimes []StopTime
}

TripStopTimes is a Trip together with its StopTimes, as streamed by readers that yield trips with their stop_times already joined. Valid is false when the StopTimes have no matching trip in trips.txt — Trip is then the zero value and the StopTimes are surfaced only so their trip_id reference can still be validated.

Jump to

Keyboard shortcuts

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