Documentation ¶
Index ¶
- Constants
- func Dump(g *GTFS, dirPath string, filter map[string]bool) error
- func DumpEdgeTimetable(edgeTimetable *EdgeTimetable, dirPath string, filter map[string]bool) error
- func HHMMSS2Sec(str string) int
- func I2AA(i int) string
- func Sec2HHMMSS(t int) string
- type Agency
- type Calendar
- type CalendarDate
- type EdgeTimetable
- type FareAttribute
- type FareRule
- type GTFS
- func (g *GTFS) AddTransfer(connectRange float64, walkingSpeed float64, road *gm.Graph, numThread int) error
- func (g *GTFS) AddTransferWithOSM(connectRange float64, walkingSpeed float64, osmFileName string, numThread int) error
- func (g *GTFS) ExtractByDate(date time.Time) *GTFS
- func (g *GTFS) GTFS2TimeTableEdges() (et *EdgeTimetable)
- func (g *GTFS) GetFareAttribute(fareId string) (FareAttribute, error)
- func (g *GTFS) GetFareAttributeFromOD(originId string, destinationId string, routeId string) (FareAttribute, error)
- func (g *GTFS) GetHeadSign(tripId string, stopId string) string
- func (g *GTFS) GetRoute(routeId string) Route
- func (g *GTFS) GetRoutePatterns() (patterns []RoutePattern)
- func (g *GTFS) GetStop(stopID string) Stop
- func (g *GTFS) GetTrip(tripId string) Trip
- func (g *GTFS) Sort()
- type Route
- type RoutePattern
- type Stop
- type StopTime
- type TimetableEdge
- type TimetableEdgeProperty
- type Transfer
- type Trip
- type TripTimetable
Constants ¶
const ( RouteTypeTram = 0 RouteTypeSubway = 1 RouteTypeRail = 2 RouteTypeBus = 3 RouteTypeFerry = 4 RouteTypeCableCar = 5 RouteTypeGondola = 6 RouteTypeFunicular = 7 ExceptionTypeAdded = 1 ExceptionTypeRemoved = 2 )
Const used in GTFS
Variables ¶
This section is empty.
Functions ¶
func Dump ¶
Dump GTFS data to an already existing directory @param g: GTFS struct to dump @param dirPath: Target directory @param filter: same as for load function @return error
func DumpEdgeTimetable ¶
func DumpEdgeTimetable(edgeTimetable *EdgeTimetable, dirPath string, filter map[string]bool) error
func HHMMSS2Sec ¶
func Sec2HHMMSS ¶
Types ¶
type Agency ¶
type Agency struct { ID string `csv:"agency_id" json:"trip_id"` Name string `csv:"agency_name" json:"agency_name"` URL string `csv:"agency_url" json:"agency_url"` Timezone string `csv:"agency_timezone" json:"agency_timezone"` Langue string `csv:"agency_lang" json:"agency_lang"` Phone string `csv:"agency_phone" json:"agency_phone"` }
Agency -
type Calendar ¶
type Calendar struct { ServiceID string `csv:"service_id" json:"trip_id"` Monday int `csv:"monday" json:"monday"` Tuesday int `csv:"tuesday" json:"tuesday"` Wednesday int `csv:"wednesday" json:"wednesday"` Thursday int `csv:"thursday" json:"thursday"` Friday int `csv:"friday" json:"friday"` Saturday int `csv:"saturday" json:"saturday"` Sunday int `csv:"sunday" json:"sunday"` Start string `csv:"start_date" json:"start_date"` End string `csv:"end_date" json:"end_date"` }
Calendar -
type CalendarDate ¶
type CalendarDate struct { ServiceID string `csv:"service_id" json:"service_id"` Date string `csv:"date" json:"date"` ExceptionType int `csv:"exception_type" json:"exception_type"` }
CalendarDate -
type EdgeTimetable ¶
type EdgeTimetable struct { Edges []TimetableEdge Properties []TimetableEdgeProperty Stops []Stop }
type FareAttribute ¶ added in v2.0.2
type FareAttribute struct { FareId string `csv:"fare_id"` Price float64 `csv:"price"` CurrentType string `csv:"currency_type"` PaymentMethod int `csv:"payment_method"` Transfers int `csv:"transfer"` AgencyId string `csv:"agency_id"` TransferDuration string `csv:"transfer_duration"` }
FareAttribute -
type FareRule ¶ added in v2.0.2
type FareRule struct { FareId string `csv:"fare_id"` RouteId string `csv:"route_id"` OriginId string `csv:"origin_id"` DestinationId string `csv:"destination_id"` ContainsId string `csv:"contains_id"` }
FareRule -
type GTFS ¶
type GTFS struct { Path string `json:"path"` // The path to the containing directory Agency Agency `json:"agency"` Agencies []Agency `json:"agencies"` Routes []Route `json:"routes"` Stops []Stop `json:"stops"` StopsTimes []StopTime `json:"stop_times"` Trips []Trip `json:"trips"` Calendars []Calendar `json:"calendars"` CalendarDates []CalendarDate `json:"calendar_dates"` Transfers []Transfer `json:"transfer"` FareAttributes []FareAttribute `json:"fare_attributes"` FareRules []FareRule `json:"fare_rules"` }
GTFS -
func Load ¶
Load - load GTFS files @param dirPath: the directory containing the GTFS @param filter: It is possible to partialy load the gtfs files If you don't want to load all the files, add an param to the Load function containing only the files that must be loaded Example: Load("path/to/gtfs", map[string]bool{"routes": true}) @return a filled GTFS or an error
func LoadSplitted ¶
LoadSplitted - load splitted GTFS files ==> When GTFS are splitted into sub directories @param dirPath: the directory containing the sub GTFSs @param filter: see Load function @return an array of filled GTFS or an error
func (*GTFS) AddTransfer ¶
func (g *GTFS) AddTransfer(connectRange float64, walkingSpeed float64, road *gm.Graph, numThread int) error
connectRange: 接続する停留所間の最大距離 walkingSpeed: 歩行速度(分速メートル) road: 地図データのグラフ numThread: 使用するスレッド数
func (*GTFS) AddTransferWithOSM ¶
func (*GTFS) GTFS2TimeTableEdges ¶
func (g *GTFS) GTFS2TimeTableEdges() (et *EdgeTimetable)
func (*GTFS) GetFareAttribute ¶ added in v2.0.2
func (g *GTFS) GetFareAttribute(fareId string) (FareAttribute, error)
func (*GTFS) GetFareAttributeFromOD ¶ added in v2.0.2
func (*GTFS) GetRoutePatterns ¶
func (g *GTFS) GetRoutePatterns() (patterns []RoutePattern)
type Route ¶
type Route struct { ID string `csv:"route_id" json:"route_id"` AgencyID string `csv:"agency_id" json:"agency_id"` ShortName string `csv:"route_short_name" json:"route_short_name"` LongName string `csv:"route_long_name" json:"route_long_name"` Type int `csv:"route_type" json:"route_type"` Desc string `csv:"route_url" json:"route_url"` URL string `csv:"route_desc" json:"route_desc"` Color string `csv:"route_color" json:"route_color"` TextColor string `csv:"route_text_color" json:"route_text_color"` }
Route -
type RoutePattern ¶
type RoutePattern struct {
Trips []TripTimetable
}
type Stop ¶
type Stop struct { ID string `csv:"stop_id" json:"trip_id"` Code string `csv:"stop_code" json:"stop_code"` Name string `csv:"stop_name" json:"stop_name"` Description string `csv:"stop_desc" json:"stop_desc"` Latitude float64 `csv:"stop_lat" json:"stop_lat"` Longitude float64 `csv:"stop_lon" json:"stop_lon"` ZoneID string `csv:"zone_id" json:"zone_id"` Type string `csv:"location_type" json:"location_type"` Parent string `csv:"parent_station" json:"parent_station"` }
Stop -
type StopTime ¶
type StopTime struct { StopID string `csv:"stop_id" json:"stop_id"` StopSeq string `csv:"stop_sequence" json:"stop_sequence"` StopHeadSign string `csv:"stop_headsign" json:"stop_headsign"` TripID string `csv:"trip_id" json:"trip_id"` Shape int `csv:"shape_dist_traveled" json:"shape_dist_traveled"` Departure string `csv:"departure_time" json:"departure_time"` Arrival string `csv:"arrival_time" json:"arrival_time"` PickupType int `csv:"pickup_type" json:"pickup_type"` DropOffType int `csv:"drop_off_type" json:"drop_off_type"` }
StopTime -
type TimetableEdge ¶
type TimetableEdge struct { TripId string `csv:"trip_id"` FromStop string `csv:"from_stop_id"` ToStop string `csv:"to_stop_id"` DepartureTime string `csv:"departure_time"` ArrivalTime string `csv:"arrival_time"` PickupType int `csv:"pickup_type"` DropOffType int `csv:"drop_off_type"` StopHeadSign string `csv:"stop_head_sign"` }
type TimetableEdgeProperty ¶
type TimetableEdgeProperty struct { TripID string `csv:"trip_id"` Name string `csv:"trip_short_name"` RouteID string `csv:"route_id"` ServiceID string `csv:"service_id"` ShapeID string `csv:"shape_id"` DirectionID string `csv:"direction_id"` Headsign string `csv:"trip_headsign"` AgencyID string `csv:"agency_id"` ShortName string `csv:"route_short_name"` LongName string `csv:"route_long_name"` Type int `csv:"route_type"` Desc string `csv:"route_url"` URL string `csv:"route_desc"` Color string `csv:"route_color"` TextColor string `csv:"route_text_color"` }
type Transfer ¶
type Transfer struct { FromStopID string `csv:"from_stop_id" json:"trip_id"` ToStopID string `csv:"to_stop_id" json:"to_stop_id"` Type int `csv:"transfer_type" json:"transfer_type"` MinTime int `csv:"min_transfer_time" json:"min_transfer_time"` }
Transfer -
type Trip ¶
type Trip struct { ID string `csv:"trip_id" json:"trip_id"` Name string `csv:"trip_short_name" json:"trip_short_name"` RouteID string `csv:"route_id" json:"route_id"` ServiceID string `csv:"service_id" json:"service_id"` ShapeID string `csv:"shape_id" json:"shape_id"` DirectionID string `csv:"direction_id" json:"direction_id"` Headsign string `csv:"trip_headsign" json:"trip_headsign"` }
Trip -
type TripTimetable ¶
type TripTimetable struct { StopTimes []StopTime Properties TimetableEdgeProperty }
func GetTripTimetables ¶
func GetTripTimetables(g *GTFS) (tripTimetables []TripTimetable)