gtfs

package
v0.0.0-...-651d898 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Uint32

func Uint32(c color.Color) uint32

func (routes *GTFSRoutes) fillMissingColums(agency GTFSAgency) error {

	if agency.ID == "" {
		return fmt.Errorf("agency ID is empty, cannot fill that into route data")
	}
	if agency.URL == "" {
		return fmt.Errorf("agency URL is empty, cannot fill that into route data")
	}

	for i := range *routes {
		if (*routes)[i].AgencyID == "" {
			(*routes)[i].AgencyID = agency.ID
		}
		if (*routes)[i].URL == "" {
			(*routes)[i].URL = agency.URL
		}

		if (*routes)[i].Color == nil {
			(*routes)[i].Color = color.RGBA{R: 0, G: 0, B: 0, A: 255}
		}
		if (*routes)[i].TextColor == nil {
			(*routes)[i].TextColor = color.RGBA{R: 0, G: 0, B: 255, A: 255}
		}
	}
	return nil
}

Types

type AccessType

type AccessType int
const (
	InheritOrNoInfo AccessType = 0
	AccessPossible  AccessType = 1
	NoAccess        AccessType = 2
)

type Agencies

type Agencies []ds.Agency

type ContinousPickup_Type

type ContinousPickup_Type int
const (
	ContinousDropOff           ContinousPickup_Type = 0
	DropOffAtStop              ContinousPickup_Type = 1
	MustPhoneContinousDropOff  ContinousPickup_Type = 2
	MustSignalContinousDropOff ContinousPickup_Type = 3
)

type Dataset

type Dataset struct {
	// contains filtered or unexported fields
}

func ReadGTFS

func ReadGTFS(datasetPath string) (dataset *Dataset, err error)

func (*Dataset) PrintCountInfo

func (d *Dataset) PrintCountInfo(w io.Writer) error

func (*Dataset) WriteToPG

func (dataset *Dataset) WriteToPG()

type ExactTimesType

type ExactTimesType int
const (
	FrequencyBased ExactTimesType = 0
	ScheduleBased  ExactTimesType = 1
)

type Exception_Type

type Exception_Type int
const (
	ServiceAdded   Exception_Type = 1
	ServiceRemoved Exception_Type = 2
)

type GTFSCalendar

type GTFSCalendar struct {
	ServiceID string              `csv:"service_id"`
	Monday    ServiceAvailability `csv:"monday"`
	Tuesday   ServiceAvailability `csv:"tuesday"`
	Wednesday ServiceAvailability `csv:"wednesday"`
	Thursday  ServiceAvailability `csv:"thursday"`
	Friday    ServiceAvailability `csv:"friday"`
	Saturday  ServiceAvailability `csv:"saturday"`
	Sunday    ServiceAvailability `csv:"sunday"`
	StartDate time.Time           `csv:"start_date"`
	EndDate   time.Time           `csv:"end_date"`
}

type GTFSCalendarDate

type GTFSCalendarDate struct {
	ServiceID     string         `csv:"service_id"`
	Date          time.Time      `csv:"date"`
	ExceptionType Exception_Type `csv:"exception_type"`
}

type GTFSCalendarDates

type GTFSCalendarDates []GTFSCalendarDate

type GTFSCalendars

type GTFSCalendars []GTFSCalendar

type GTFSFrequencies

type GTFSFrequencies []GTFSFrequency

type GTFSFrequency

type GTFSFrequency struct {
	TripID      string         `csv:"trip_id"`
	StartTime   time.Time      `csv:"start_time"`
	EndTime     time.Time      `csv:"end_time"`
	HeadwaySecs int            `csv:"headway_secs"`
	ExactTimes  ExactTimesType `csv:"exact_times,omitempty"`
}

type GTFSLevel

type GTFSLevel struct {
	ID    string  `csv:"level_id"`
	Index float32 `csv:"level_index"`
	Name  string  `csv:"level_name,omitempty"`
}

type GTFSLevels

type GTFSLevels []GTFSLevel

type GTFSPathway

type GTFSPathway struct {
	ID                   string              `csv:"pathway_id"`
	FromStopID           string              `csv:"from_stop_id"`
	ToStopID             string              `csv:"to_stop_id"`
	Mode                 PathwayModeType     `csv:"pathway_mode"`
	IsBidirectional      IsBidirectionalType `csv:"is_bidirectional"`
	Length               float32             `csv:"length,omitempty"`
	TraversalTime        int                 `csv:"traversal_time,omitempty"`
	StairCount           int                 `csv:"stair_count,omitempty"`
	MaxSlope             float32             `csv:"max_slope,omitempty"`
	MinWidth             float32             `csv:"min_width,omitempty"`
	SignpostedAs         string              `csv:"signposted_as,omitempty"`
	ReversedSignpostedAs string              `csv:"reversed_signposted_as,omitempty"`
}

type GTFSPathways

type GTFSPathways []GTFSPathway

type GTFSRoute

type GTFSRoute struct {
	ID              string               `csv:"route_id"`
	AgencyID        string               `csv:"agency_id"`
	ShortName       string               `csv:"route_short_name"`
	LongName        string               `csv:"route_long_name"`
	Description     string               `csv:"route_desc"`
	Type            Route_Type           `csv:"route_type"`
	URL             string               `csv:"route_url"`
	Color           color.Color          `csv:"route_color,omitempty"`
	TextColor       color.Color          `csv:"route_text_color,omitempty"`
	SortOrder       int                  `csv:"route_sort_order,omitempty"`
	ContinousPickup ContinousPickup_Type `csv:"continous_pickup,omitempty"`
	NetworkID       string               `csv:"network_id"`
}

type GTFSRoutes

type GTFSRoutes []GTFSRoute

type GTFSShape

type GTFSShape struct {
	ID           string  `csv:"shape_id"`
	Lat          float32 `csv:"shape_pt_lat"`
	Lon          float32 `csv:"shape_pt_lon"`
	Sequence     int     `csv:"shape_pt_sequence"`
	DistTraveled string  `csv:"shape_dist_traveled,omitempty"`
}

type GTFSShapes

type GTFSShapes []GTFSShape

type GTFSStop

type GTFSStop struct {
	ID               string        `csv:"stop_id"`
	Code             string        `csv:"stop_code,omitempty"`
	Name             string        `csv:"stop_name"`
	TTSName          string        `csv:"tts_stop_name,omitempty"`
	Description      string        `csv:"stop_desc,omitempty"`
	ShortName        string        `csv:"stop_shortname,omitempty"`
	Latitude         float64       `csv:"stop_lat"`
	Longitude        float64       `csv:"stop_lon"`
	FareZoneID       string        `csv:"fare_zone,omitempty"`
	URL              string        `csv:"stop_url,omitempty"`
	LocationType     Location_Type `csv:"location_type"`
	ParentID         string        `csv:"parent_station"`
	Timezone         time.Location `csv:"stop_timezone,omitempty"`
	WheelchairAccess AccessType    `csv:"wheelchair_boarding,omitempty"`
	LevelID          string        `csv:"level_id,omitempty"`
	PlatformCode     string        `csv:"platform_code,omitempty"`
}

type GTFSStopTime

type GTFSStopTime struct {
	TripID            string               `csv:"trip_id"`
	Arrival           time.Time            `csv:"arrival_time"`
	Departure         time.Time            `csv:"departure_time"`
	StopID            string               `csv:"stop_id"`
	StopSequence      int                  `csv:"stop_sequence"`
	Headsign          string               `csv:"stop_headsign"`
	PickupType        Pickup_Type          `csv:"pickup_type"`
	DropOffType       Pickup_Type          `csv:"drop_off_type"`
	ContinousPickUp   ContinousPickup_Type `csv:"continous_pickup"`
	ContinousDropOff  ContinousPickup_Type `csv:"continous_drop_off"`
	ShapeDistTraveled float64              `csv:"shape_dist_traveled"`
	Timepoint         Timepoint_Type       `csv:"timepoint"`
}

type GTFSStopTimes

type GTFSStopTimes []GTFSStopTime

type GTFSStops

type GTFSStops []GTFSStop

type GTFSTransfer

type GTFSTransfer struct {
	FromStopID      string        `csv:"from_stop_id"`
	ToStopID        string        `csv:"to_stop_id"`
	FromRouteID     string        `csv:"from_route_id"`
	ToRouteID       string        `csv:"to_route_id"`
	FromTripID      string        `csv:"from_trip_id"`
	ToTripID        string        `csv:"to_trip_id"`
	TransferType    Transfer_Type `csv:"transfer_type"`
	MinTransferTime int           `csv:"min_transfer_time,omitempty"`
}

type GTFSTransfers

type GTFSTransfers []GTFSTransfer

type GTFSTrip

type GTFSTrip struct {
	RouteID          string            `csv:"route_id"`
	ServiceID        string            `csv:"service_id"`
	ID               string            `csv:"trip_id"`
	Headsign         string            `csv:"trip_headsign,omitempty"`
	ShortName        string            `csv:"trip_short_name,omitempty"`
	Direction        TripDirectionType `csv:"direction_id,omitempty"`
	BlockID          int               `csv:"block_id,omitempty"`
	ShapeID          string            `csv:"shape_id,omitempty"`
	WheelchairAccess AccessType        `csv:"wheelchair_boarding,omitempty"`
	BikesAllowed     AccessType        `csv:"bikes_allowed,omitempty"`
}

type GTFSTrips

type GTFSTrips []GTFSTrip

type IsBidirectionalType

type IsBidirectionalType int
const (
	Unidirectional IsBidirectionalType = 0
	Bidirectional  IsBidirectionalType = 1
)

type Location_Type

type Location_Type int
const (
	Platform     Location_Type = 0
	Station      Location_Type = 1
	Exit         Location_Type = 2
	Node         Location_Type = 3
	BoardingArea Location_Type = 4
)

type PathwayModeType

type PathwayModeType int
const (
	Walkway        PathwayModeType = 1
	Stairs         PathwayModeType = 2
	MovingSidewalk PathwayModeType = 3
	Escalator      PathwayModeType = 4
	Elevator       PathwayModeType = 5
	FareGate       PathwayModeType = 6
	ExitGate       PathwayModeType = 7
)

type Pickup_Type

type Pickup_Type int
const (
	Scheduled        Pickup_Type = 0
	NoPickup         Pickup_Type = 1
	MustPhonePickUp  Pickup_Type = 2
	MustSignalPickUp Pickup_Type = 3
)

type Route_Type

type Route_Type int
const (
	Tram       Route_Type = 0
	Subway     Route_Type = 1
	Rail       Route_Type = 2
	Bus        Route_Type = 3
	Ferry      Route_Type = 4
	CableTram  Route_Type = 5
	AerialLift Route_Type = 6
	Funicular  Route_Type = 7
	Trolleybus Route_Type = 11
	Monorail   Route_Type = 12
)

type ServiceAvailability

type ServiceAvailability int
const (
	ServiceAvailable    ServiceAvailability = 1
	ServiceNotAvailable ServiceAvailability = 0
)

type Timepoint_Type

type Timepoint_Type int
const (
	Approximate Timepoint_Type = 0
	Exact       Timepoint_Type = 1
)

type Transfer_Type

type Transfer_Type int
const (
	RecommendedTransferPoint Transfer_Type = 0
	TimedTransferPoint       Transfer_Type = 1
	MinimumTransferTime      Transfer_Type = 2
	TransferNotPossible      Transfer_Type = 3
	InSeatTransfer           Transfer_Type = 4
	InSeatTransferNotAllowed Transfer_Type = 5
)

type TripDirectionType

type TripDirectionType int
const (
	Outbound TripDirectionType = 0
	Inbound  TripDirectionType = 1
)

Directories

Path Synopsis
db

Jump to

Keyboard shortcuts

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