Documentation
¶
Index ¶
- type Agency
- type AgencyArray
- type AgencyMap
- type Coordinate
- type CoordinateArray
- type ExceptionType
- type Key
- type KeyArray
- type LocationType
- type ModeFlag
- type Route
- type RouteArray
- type RouteMap
- type RouteType
- type Service
- type ServiceArray
- type ServiceException
- type ServiceExceptionArray
- type ServiceExceptionMap
- type ServiceMap
- type Shape
- type ShapeArray
- type ShapeMap
- type Stop
- type StopArray
- type StopMap
- type Trip
- type TripArray
- type TripDirection
- type TripMap
- type TripStop
- type TripStopArray
- type TripTimepoint
- type WeekdayFlag
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgencyArray ¶ added in v0.0.3
type AgencyArray []*Agency
type Coordinate ¶
Represents a geographical coordinate with latitude and longitude.
func NewCoordinate ¶
func NewCoordinate(lat, lon float64) Coordinate
Create a new Coordinate instance with the given latitude and longitude.
func NewCoordinateFromString ¶
func NewCoordinateFromString(coord string) (Coordinate, error)
Create a new Coordinate instance from a string in the format "lat,lon".
func (Coordinate) DistanceTo ¶
func (c Coordinate) DistanceTo(other Coordinate) float64
Calculate the distance to another coordinate using the Haversine formula.
func (Coordinate) IsValid ¶
func (c Coordinate) IsValid() bool
Check if the coordinate is valid (latitude between -90 and 90, longitude between -180 and 180).
func (Coordinate) IsZero ¶
func (c Coordinate) IsZero() bool
Check if the coordinate is zero (0, 0).
func (Coordinate) String ¶
func (c Coordinate) String() string
Return a string representation of the coordinate in the format "lat,lon".
type CoordinateArray ¶
type CoordinateArray []Coordinate
func (CoordinateArray) MarshalBinary ¶
func (ca CoordinateArray) MarshalBinary() ([]byte, error)
func (*CoordinateArray) UnmarshalBinary ¶
func (ca *CoordinateArray) UnmarshalBinary(data []byte) error
type ExceptionType ¶
type ExceptionType uint8
Enum for the types of service exception
const ( AddedExceptionType ExceptionType = iota + 1 RemovedExceptionType )
type KeyArray ¶
type KeyArray []Key
func (KeyArray) MarshalBinary ¶
func (*KeyArray) UnmarshalBinary ¶
type LocationType ¶
type LocationType uint8
const ( StopLocationType LocationType = iota StationLocationType EntranceExitLocationType GenericNodeLocationType BoardingAreaLocationType UnknownLocationType )
type Route ¶
type Route struct { ID Key AgencyID Key Name string Type RouteType Colour string ShapeID Key Stops KeyArray }
Represents a route in a transit system
type RouteArray ¶ added in v0.0.3
type RouteArray []*Route
type Service ¶
Represents the days of the week a service is active
type ServiceArray ¶ added in v0.0.3
type ServiceArray []*Service
type ServiceException ¶
type ServiceException struct { ServiceID Key Date time.Time Type ExceptionType }
Represents an exception for a service on a specific date
type ServiceExceptionArray ¶ added in v0.0.3
type ServiceExceptionArray []*ServiceException
type ServiceExceptionMap ¶
type ServiceExceptionMap map[Key]*ServiceException
func ParseServiceExceptions ¶ added in v0.0.3
func ParseServiceExceptions(file io.Reader) (ServiceExceptionMap, error)
Load and parse service exceptions from the GTFS calendar_dates.txt file
type ServiceMap ¶
func ParseServices ¶ added in v0.0.3
func ParseServices(file io.Reader) (ServiceMap, error)
Load and parse services from the GTFS calendar.txt file
type Shape ¶
type Shape struct { ID Key Coordinates CoordinateArray }
Represents the shape of a transit route
type ShapeArray ¶ added in v0.0.3
type ShapeArray []*Shape
type Stop ¶
type Stop struct { ID Key Code string Name string ParentID Key Location Coordinate LocationType LocationType SupportedModes ModeFlag }
Represents a stop, platform, or station in a transit system
type Trip ¶
type Trip struct { ID Key RouteID Key ServiceID Key ShapeID Key Direction TripDirection Headsign string Stops TripStopArray }
Represents a trip on a particular route in a transit system
type TripDirection ¶
type TripDirection uint8
const ( OutboundTripDirection TripDirection = iota InboundTripDirection )
type TripStop ¶
type TripStop struct { StopID Key `json:"stop_id"` ArrivalTime uint `json:"arrival_time"` DepartureTime uint `json:"departure_time"` Timepoint TripTimepoint `json:"timepoint"` }
Represents a stop in a trip
func (*TripStop) FromString ¶
Converts a string representation back to a TripStop
type TripStopArray ¶
type TripStopArray []*TripStop
func (TripStopArray) MarshalBinary ¶
func (tsa TripStopArray) MarshalBinary() ([]byte, error)
func (*TripStopArray) UnmarshalBinary ¶
func (tsa *TripStopArray) UnmarshalBinary(data []byte) error
type TripTimepoint ¶
type TripTimepoint uint8
const ( ApproximateTripTimepoint TripTimepoint = iota ExactTripTimepoint )
type WeekdayFlag ¶
type WeekdayFlag uint8
Flag for each day of the week
const ( MondayWeekdayFlag WeekdayFlag = 1 << iota TuesdayWeekdayFlag WednesdayWeekdayFlag ThursdayWeekdayFlag FridayWeekdayFlag SaturdayWeekdayFlag SundayWeekdayFlag )