Documentation ¶
Overview ¶
Package formatterlegs contains the legs formatter used by apirtroute
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type RouteLeg ¶
type RouteLeg struct { LegType string `json:"leg_type"` // transfer, walk, or trip LegBeginTime time.Time `json:"leg_begin_time,omitempty"` LegEndTime time.Time `json:"leg_end_time,omitempty"` LegDuration string `json:"leg_duration"` LegFromCoords [2]float64 `json:"leg_from_coords"` LegToCoords [2]float64 `json:"leg_to_coords"` // When LegType == "trip" will be present TripRoute *string `json:"trip_route,omitempty"` TripRouteHeadsign *string `json:"trip_route_headsign,omitempty"` TripFrom *string `json:"trip_from,omitempty"` TripFromStopUID *string `json:"-"` TripToStopUID *string `json:"-"` TripTo *string `json:"trip_to,omitempty"` TripStops *[]*RouteStopDetails `json:"trip_stops,omitempty"` TripFeedID *int `json:"trip_feed_id,omitempty"` TripAgencyID *string `json:"trip_agency_id,omitempty"` // When LegType == "walk" wil be present TransferFrom *string `json:"transfer_from,omitempty"` TransferTo *string `json:"transfer_to,omitempty"` TransferDdwell *string `json:"transfer_ddwell,omitempty"` TransferDactive *string `json:"transfer_dactive,omitempty"` TransferCategory *string `json:"transfer_category,omitempty"` TransferFeedIDs *[]int `json:"transfer_feed_ids,omitempty"` // When LegType == "transfer" will be present WalkTo *string `json:"walk_to,omitempty"` WalkFrom *string `json:"walk_from,omitempty"` WalkDistKm *float64 `json:"walk_dist_km,omitempty"` }
RouteLeg represents a 'leg' in a route which may be one of: transfer, walk, or trip type (see the LegType field).
When the LegType is equal to "trip", all fields prefixed with Trip* will be non-nil / present. A trip leg represents one boarding of a segment of a trip (e.g. a single bus route, or a single train route etc.). Underlying this is flagged by a single trip ID sourced from the stop_times GTFS table.
When the LegType is equal to "walk", all fields prefixed with Walk* will be non-nil / present. A walk leg represents the segment of time walking to the origin station (e.g. with the first trip); or walking from the destination station (e.g. with the last trip). A walk has a correlated distance KM and the walk to/from fields will contain the relevant stop IDs. The walk KM is automatically calculated from the input constraints for walk km / hr.
When the LegType is equal to "transfer", all fields prefixed with Transfer* will be non-nil / present. A transfer leg represents the segment of time to get from one trip leg to another trip leg. Transfers can be sourced from a number of places (e.g. either implicit, feed, or generated) and always have an associated duration. The field TransferDdwell indicates the amount of inactive time in the transfer (waiting / dwelling); while TransferActive indicates active time walking getting from one stop to another.
type RouteStopDetails ¶
type RouteStopDetails struct { Time time.Time `json:"stop_time"` Name string `json:"stop_name"` Coords [2]float64 `json:"stop_coords"` ConnOID int `json:"stop_conn_oid"` }
RouteStopDetails represents a stop within a trip. This allows more fine-grained detailed into each 'stop' in a common trip. Ultimately this correlates to a single connection in the table _ctconn and can be referenced by using the field ConnOID.
func FormatLegsStopDetails ¶
func FormatLegsStopDetails( yyyymmdd uint, timezoneUTCDeltasecs int, legConnections []*dbt.ConnectionVerbose, ) []*RouteStopDetails