Documentation
¶
Overview ¶
Package gtfs contains parsers for GTFS static and realtime feeds.
Index ¶
- type Agency
- type Alert
- type AlertActivePeriod
- type AlertCause
- type AlertEffect
- type AlertInformedEntity
- type AlertText
- type BikesAllowed
- type CongestionLevel
- type CurrentStatus
- type DirectionID
- type ExactTimes
- type Frequency
- type OccupancyStatus
- type ParseRealtimeOptions
- type ParseStaticOptions
- type PickupDropOffPolicy
- type Position
- type Realtime
- type Route
- type RouteType
- type ScheduledStopTime
- type ScheduledTrip
- type Service
- type Shape
- type ShapePoint
- type ShapeRow
- type Static
- type Stop
- type StopTimeEvent
- type StopTimeUpdate
- type StopTimeUpdateScheduleRelationship
- type StopType
- type Transfer
- type TransferType
- type Trip
- type TripID
- type TripScheduleRelationship
- type Vehicle
- type VehicleID
- type WheelchairBoarding
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 string
Timezone string
Language string
Phone string
FareUrl string
Email string
}
Agency corresponds to a single row in the agency.txt file.
type Alert ¶
type Alert struct {
ID string
Cause AlertCause
Effect AlertEffect
ActivePeriods []AlertActivePeriod
InformedEntities []AlertInformedEntity
Header []AlertText
Description []AlertText
URL []AlertText
}
type AlertCause ¶
type AlertCause = gtfsrt.Alert_Cause
const ( UnknownCause AlertCause = gtfsrt.Alert_UNKNOWN_CAUSE OtherCause AlertCause = gtfsrt.Alert_OTHER_CAUSE TechnicalProblem AlertCause = gtfsrt.Alert_TECHNICAL_PROBLEM Strike AlertCause = gtfsrt.Alert_STRIKE Demonstration AlertCause = gtfsrt.Alert_DEMONSTRATION Accident AlertCause = gtfsrt.Alert_ACCIDENT Holiday AlertCause = gtfsrt.Alert_HOLIDAY Weather AlertCause = gtfsrt.Alert_WEATHER Maintenance AlertCause = gtfsrt.Alert_MAINTENANCE Construction AlertCause = gtfsrt.Alert_CONSTRUCTION PoliceActivity AlertCause = gtfsrt.Alert_POLICE_ACTIVITY MedicalEmergency AlertCause = gtfsrt.Alert_MEDICAL_EMERGENCY )
type AlertEffect ¶
type AlertEffect = gtfsrt.Alert_Effect
const ( UnknownEffect AlertEffect = gtfsrt.Alert_UNKNOWN_EFFECT NoService AlertEffect = gtfsrt.Alert_NO_SERVICE ReducedService AlertEffect = gtfsrt.Alert_REDUCED_SERVICE SignificantDelays AlertEffect = gtfsrt.Alert_SIGNIFICANT_DELAYS Detour AlertEffect = gtfsrt.Alert_DETOUR AdditionalService AlertEffect = gtfsrt.Alert_ADDITIONAL_SERVICE ModifiedService AlertEffect = gtfsrt.Alert_MODIFIED_SERVICE OtherEffect AlertEffect = gtfsrt.Alert_OTHER_EFFECT StopMoved AlertEffect = gtfsrt.Alert_STOP_MOVED NoEffect AlertEffect = gtfsrt.Alert_NO_EFFECT AccessibilityIssue AlertEffect = gtfsrt.Alert_ACCESSIBILITY_ISSUE )
type AlertInformedEntity ¶
type BikesAllowed ¶
type BikesAllowed int32
BikesAllowed describes whether bikes are allowed on a scheduled trip.
This is a Go representation of the enum described in the `bikes_allowed` field of `stops.txt`.
const ( BikesAllowed_NotSpecified BikesAllowed = 0 BikesAllowed_Allowed BikesAllowed = 1 BikesAllowed_NotAllowed BikesAllowed = 2 )
func (BikesAllowed) String ¶
func (b BikesAllowed) String() string
type CongestionLevel ¶
type CongestionLevel = gtfsrt.VehiclePosition_CongestionLevel
type CurrentStatus ¶
type CurrentStatus = gtfsrt.VehiclePosition_VehicleStopStatus
type DirectionID ¶
type DirectionID uint8
DirectionID is a mechanism for distinguishing between trips going in the opposite direction.
const ( DirectionID_Unspecified DirectionID = 0 DirectionID_True DirectionID = 1 DirectionID_False DirectionID = 2 )
func (DirectionID) String ¶
func (d DirectionID) String() string
type ExactTimes ¶
type ExactTimes int32
ExactTimes describes the type of service for a trip.
This is a Go representation of the enum described in the `exact_times` field of `frequencies.txt`.
const ( FrequencyBased ExactTimes = 0 ScheduleBased ExactTimes = 1 )
func (ExactTimes) String ¶
func (t ExactTimes) String() string
type OccupancyStatus ¶
type OccupancyStatus = gtfsrt.VehiclePosition_OccupancyStatus
type ParseRealtimeOptions ¶
type ParseRealtimeOptions struct {
// The timezone to interpret date field.
//
// It can be nil, in which case UTC will used.
Timezone *time.Location
// The GTFS Realtime extension to use when parsing.
//
// This can be nil, in which case no extension is used.
Extension extensions.Extension
}
type ParseStaticOptions ¶
type ParseStaticOptions struct {
// If true, wheelchair boarding information is inherited from parent station
// when unspecified for a child stop/platform, entrance, or exit.
InheritWheelchairBoarding bool
}
type PickupDropOffPolicy ¶
type PickupDropOffPolicy int32
PickupDropOffPolicy describes the pickup or drop-off policy for a route or scheduled trip.
This is a Go representation of the enum described in the `continuous_pickup` field of `routes.txt`, and `pickup_type` field of `stop_times.txt`, and similar fields.
const ( // Pickup or drop off happens by default. PickupDropOffPolicy_Yes PickupDropOffPolicy = 0 // No pickup or drop off is possible. PickupDropOffPolicy_No PickupDropOffPolicy = 1 // Must phone an agency to arrange pickup or drop off. PickupDropOffPolicy_PhoneAgency PickupDropOffPolicy = 2 // Must coordinate with a driver to arrange pickup or drop off. PickupDropOffPolicy_CoordinateWithDriver PickupDropOffPolicy = 3 )
func (PickupDropOffPolicy) String ¶
func (t PickupDropOffPolicy) String() string
type Position ¶
type Position struct {
// Degrees North, in the WGS-84 coordinate system.
Latitude *float32
// Degrees East, in the WGS-84 coordinate system.
Longitude *float32
// Bearing, in degrees, clockwise from North, i.e., 0 is North and 90 is East.
// This can be the compass bearing, or the direction towards the next stop
// or intermediate location.
// This should not be direction deduced from the sequence of previous
// positions, which can be computed from previous data.
Bearing *float32
// Odometer value, in meters.
Odometer *float64
// Momentary speed measured by the vehicle, in meters per second.
Speed *float32
}
type Realtime ¶
Realtime contains the parsed content for a single GTFS realtime message.
func ParseRealtime ¶
func ParseRealtime(content []byte, opts *ParseRealtimeOptions) (*Realtime, error)
type Route ¶
type Route struct {
Id string
Agency *Agency
Color string
TextColor string
ShortName string
LongName string
Description string
Type RouteType
Url string
SortOrder *int32
ContinuousPickup PickupDropOffPolicy
ContinuousDropOff PickupDropOffPolicy
}
Route corresponds to a single row in the routes.txt file.
type RouteType ¶
type RouteType int32
RouteType describes the type of a route.
This is a Go representation of the enum described in the `route_type` field of `routes.txt`.
const ( RouteType_Tram RouteType = 0 RouteType_Subway RouteType = 1 RouteType_Rail RouteType = 2 RouteType_Bus RouteType = 3 RouteType_Ferry RouteType = 4 RouteType_CableTram RouteType = 5 RouteType_AerialLift RouteType = 6 RouteType_Funicular RouteType = 7 RouteType_TrolleyBus RouteType = 11 RouteType_Monorail RouteType = 12 RouteType_RailwayService RouteType = 100 RouteType_HighSpeedRailService RouteType = 101 RouteType_LongDistanceRailService RouteType = 102 RouteType_InterRegionalRailService RouteType = 103 RouteType_CarTransportRailService RouteType = 104 RouteType_SleeperRailService RouteType = 105 RouteType_RegionalRailService RouteType = 106 RouteType_TouristRailwayService RouteType = 107 RouteType_RailShuttle RouteType = 108 RouteType_SuburbanRailway RouteType = 109 RouteType_ReplacementRailService RouteType = 110 RouteType_SpecialRailService RouteType = 111 RouteType_LorryTransportRailService RouteType = 112 RouteType_AllRailServices RouteType = 113 RouteType_CrossCountryRailService RouteType = 114 RouteType_VehicleTransportRailService RouteType = 115 RouteType_RackAndPinionRailway RouteType = 116 RouteType_AdditionalRailService RouteType = 117 RouteType_CoachService RouteType = 200 RouteType_InternationalCoach RouteType = 201 RouteType_NationalCoach RouteType = 202 RouteType_ShuttleCoach RouteType = 203 RouteType_RegionalCoach RouteType = 204 RouteType_SpecialCoach RouteType = 205 RouteType_TouristCoach RouteType = 206 RouteType_CommuterCoach RouteType = 207 RouteType_AllCoachServices RouteType = 208 RouteType_SuburbanCoachService RouteType = 209 RouteType_UrbanRailwayService RouteType = 400 RouteType_MetroService RouteType = 401 RouteType_UndergroundService RouteType = 402 RouteType_UrbanRailway RouteType = 403 RouteType_AllUrbanRailwayServices RouteType = 404 RouteType_UrbanMonorail RouteType = 405 RouteType_BusService RouteType = 700 RouteType_RegionalBus RouteType = 701 RouteType_ExpressBus RouteType = 702 RouteType_StoppingBus RouteType = 703 RouteType_LocalBus RouteType = 704 RouteType_NightBus RouteType = 705 RouteType_PostBus RouteType = 706 RouteType_SpecialNeedsBus RouteType = 707 RouteType_MobilityBus RouteType = 708 RouteType_MobilityBusRegisteredDisabled RouteType = 709 RouteType_SightseeingBus RouteType = 710 RouteType_ShuttleBus RouteType = 711 RouteType_SchoolBus RouteType = 712 RouteType_SchoolPublicServiceBus RouteType = 713 RouteType_RailReplacementBus RouteType = 714 RouteType_DemandResponseBus RouteType = 715 RouteType_AllBusServices RouteType = 716 RouteType_TrolleybusService RouteType = 800 RouteType_TramService RouteType = 900 RouteType_CityTram RouteType = 901 RouteType_LocalTram RouteType = 902 RouteType_RegionalTram RouteType = 903 RouteType_SightseeingTram RouteType = 904 RouteType_ShuttleTram RouteType = 905 RouteType_AllTramServices RouteType = 906 RouteType_CrossborderTram RouteType = 907 RouteType_WaterTransportService RouteType = 1000 RouteType_InternationalCarFerry RouteType = 1001 RouteType_NationalCarFerry RouteType = 1002 RouteType_RegionalCarFerry RouteType = 1003 RouteType_LocalCarFerry RouteType = 1004 RouteType_InternationalPassengerFerry RouteType = 1005 RouteType_NationalPassengerFerry RouteType = 1006 RouteType_RegionalPassengerFerry RouteType = 1007 RouteType_LocalPassengerFerry RouteType = 1008 RouteType_PostBoat RouteType = 1009 RouteType_TrainFerry RouteType = 1010 RouteType_RoadLinkFerry RouteType = 1011 RouteType_AirportLinkFerry RouteType = 1012 RouteType_CarHighSpeedFerry RouteType = 1013 RouteType_PassengerHighSpeedFerry RouteType = 1014 RouteType_SightseeingBoat RouteType = 1015 RouteType_SchoolBoat RouteType = 1016 RouteType_CableDrawnBoat RouteType = 1017 RouteType_RiverBus RouteType = 1018 RouteType_ScheduledFerry RouteType = 1019 RouteType_ShuttleFerry RouteType = 1020 RouteType_AllWaterTransportServices RouteType = 1021 RouteType_AirService RouteType = 1100 RouteType_InternationalAirService RouteType = 1101 RouteType_DomesticAirService RouteType = 1102 RouteType_IntercontinentalAirService RouteType = 1103 RouteType_DomesticScheduledAirService RouteType = 1104 RouteType_ShuttleAirService RouteType = 1105 RouteType_IntercontinentalCharterAir RouteType = 1106 RouteType_InternationalCharterAir RouteType = 1107 RouteType_RoundTripCharterAir RouteType = 1108 RouteType_SightseeingAirService RouteType = 1109 RouteType_HelicopterAirService RouteType = 1110 RouteType_DomesticCharterAirService RouteType = 1111 RouteType_AllAirServices RouteType = 1112 RouteType_FerryService RouteType = 1200 RouteType_AerialLiftService RouteType = 1300 RouteType_TelecabinService RouteType = 1301 RouteType_CableCarService RouteType = 1302 RouteType_ElevatorService RouteType = 1303 RouteType_ChairLiftService RouteType = 1304 RouteType_DragLiftService RouteType = 1305 RouteType_SmallTelecabin RouteType = 1306 RouteType_AllTelecabinServices RouteType = 1307 RouteType_FunicularService RouteType = 1400 RouteType_Funicular_1 RouteType = 1401 RouteType_AllFunicularService RouteType = 1402 RouteType_TaxiService RouteType = 1500 RouteType_CommunalTaxi RouteType = 1501 RouteType_WaterTaxi RouteType = 1502 RouteType_RailTaxi RouteType = 1503 RouteType_BikeTaxi RouteType = 1504 RouteType_LicensedTaxi RouteType = 1505 RouteType_PrivateHireVehicle RouteType = 1506 RouteType_AllTaxiServices RouteType = 1507 RouteType_MiscellaneousService RouteType = 1700 RouteType_CableCarMisc RouteType = 1701 RouteType_HorseDrawnCarriage RouteType = 1702 RouteType_Unknown RouteType = 10000 )
type ScheduledStopTime ¶
type ScheduledStopTime struct {
Trip *ScheduledTrip
Stop *Stop
ArrivalTime time.Duration
DepartureTime time.Duration
StopSequence int
Headsign string
PickupType PickupDropOffPolicy
DropOffType PickupDropOffPolicy
ContinuousPickup PickupDropOffPolicy
ContinuousDropOff PickupDropOffPolicy
ShapeDistanceTraveled *float64
ExactTimes bool
}
type ScheduledTrip ¶
type ScheduledTrip struct {
Route *Route
Service *Service
ID string
Headsign string
ShortName string
DirectionId DirectionID
BlockID string
WheelchairAccessible WheelchairBoarding
BikesAllowed BikesAllowed
StopTimes []ScheduledStopTime
Shape *Shape
Frequencies []Frequency
}
type Shape ¶
type Shape struct {
ID string
Points []ShapePoint
}
type ShapePoint ¶
type Static ¶
type Static struct {
Agencies []Agency
Routes []Route
Stops []Stop
Transfers []Transfer
Services []Service
Trips []ScheduledTrip
Shapes []Shape
// Warnings raised during GTFS static parsing.
Warnings []warnings.StaticWarning
}
Static contains the parsed content for a single GTFS static message.
func ParseStatic ¶
func ParseStatic(content []byte, opts ParseStaticOptions) (*Static, error)
ParseStatic parses the content as a GTFS static feed.
type Stop ¶
type StopTimeEvent ¶
type StopTimeUpdate ¶
type StopTimeUpdate struct {
StopSequence *uint32
StopID *string
Arrival *StopTimeEvent
Departure *StopTimeEvent
NyctTrack *string
ScheduleRelationship StopTimeUpdateScheduleRelationship
}
TODO: shouldn't this just be StopTime?
func (*StopTimeUpdate) GetArrival ¶
func (stopTimeUpdate *StopTimeUpdate) GetArrival() StopTimeEvent
func (*StopTimeUpdate) GetDeparture ¶
func (stopTimeUpdate *StopTimeUpdate) GetDeparture() StopTimeEvent
type StopTimeUpdateScheduleRelationship ¶
type StopTimeUpdateScheduleRelationship = gtfsrt.TripUpdate_StopTimeUpdate_ScheduleRelationship
type StopType ¶
type StopType int32
StopType describes the type of a stop.
This is a Go representation of the enum described in the `location_type` field of `stops.txt`.
type Transfer ¶
type Transfer struct {
From *Stop
To *Stop
Type TransferType
MinTransferTime *int32
FromRoute *Route
ToRoute *Route
FromTrip *ScheduledTrip
ToTrip *ScheduledTrip
}
type TransferType ¶
type TransferType int32
StopType describes the type of a transfer.
This is a Go representation of the enum described in the `transfer_type` field of `transfers.txt`.
const ( TransferType_Recommended TransferType = 0 TransferType_Timed TransferType = 1 TransferType_RequiresTime TransferType = 2 TransferType_NotPossible TransferType = 3 )
func (TransferType) String ¶
func (t TransferType) String() string
type Trip ¶
type Trip struct {
ID TripID
StopTimeUpdates []StopTimeUpdate
Vehicle *Vehicle
Delay *time.Duration
IsEntityInMessage bool
}
func (*Trip) GetVehicle ¶
type TripID ¶
type TripID struct {
ID string
RouteID string
DirectionID DirectionID
HasStartTime bool
StartTime time.Duration
HasStartDate bool
StartDate time.Time
ScheduleRelationship TripScheduleRelationship
}
type TripScheduleRelationship ¶
type TripScheduleRelationship = gtfsrt.TripDescriptor_ScheduleRelationship
type Vehicle ¶
type Vehicle struct {
ID *VehicleID
Trip *Trip
Position *Position
CurrentStopSequence *uint32
StopID *string
CurrentStatus *CurrentStatus
Timestamp *time.Time
CongestionLevel CongestionLevel
OccupancyStatus *OccupancyStatus
OccupancyPercentage *uint32
IsEntityInMessage bool
}
type WheelchairBoarding ¶
type WheelchairBoarding int32
WheelchairBoarding describes whether wheelchair boarding is available at a stop.
This is a Go representation of the enum described in the `wheelchair_boarding` field of `stops.txt` and `wheelchair_accessible` field of `trips.txt`.
const ( WheelchairBoarding_NotSpecified WheelchairBoarding = 0 WheelchairBoarding_Possible WheelchairBoarding = 1 WheelchairBoarding_NotPossible WheelchairBoarding = 2 )
func (WheelchairBoarding) String ¶
func (w WheelchairBoarding) String() string
Directories
¶
| Path | Synopsis |
|---|---|
|
Package csv is a wrapper around the stdlib csv library that provides a nice API for the GTFS static parser.
|
Package csv is a wrapper around the stdlib csv library that provides a nice API for the GTFS static parser. |
|
nycttrips
Package nycttrips contains logic for the New York City Transit GTFS realtime extensions
|
Package nycttrips contains logic for the New York City Transit GTFS realtime extensions |
|
internal
|
|
|
Package journal contains a tool for building trip journals.
|
Package journal contains a tool for building trip journals. |