odpt

package
v0.0.0-...-b8dbd7e Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OpeningDoorFront = "odpt:OpeningDoor:FrontSide"
	OpeningDoorRear  = "odpt:OpeningDoor:RearSide"
)

Variables

This section is empty.

Functions

func NewBusStopPoleSpatialTree

func NewBusStopPoleSpatialTree(poles []*BusStopPole) *rtreego.Rtree

Types

type Base

type Base struct {
	ContextURL string    `json:"@context"`
	ID         string    `json:"@id"`
	Type       string    `json:"@type"`
	SameAs     string    `json:"owl:sameAs"`
	Date       time.Time `json:"dc:date"`
}

type Bus

type Bus struct {
	Base
	Valid
	Location

	Route                  string    `json:"odpt:busroute"`
	Number                 string    `json:"odpt:busNumber"`
	Operator               string    `json:"odpt:operator"`
	UpdateFrequencySeconds int       `json:"odpt:frequency"`
	StartingBusStopPole    string    `json:"odpt:startingBusstopPole"`
	TerminalBusStopPole    string    `json:"odpt:terminalBusstopPole"`
	FromBusStopPole        string    `json:"odpt:fromBusstopPole"`
	FromBusStopPoleTime    time.Time `json:"odpt:fromBusstopPoleTime"`
	ToBusStopPole          string    `json:"odpt:toBusstopPole"`
	ProgressPercent0to1    float32   `json:"odpt:progress"`
	SpeedKmPerHour         float32   `json:"odpt:speed"`
	FacingDegrees          float32   `json:"odpt:azimuth"`
	DoorStatus             string    `json:"odpt:doorStatus"`
}

type BusRoutePattern

type BusRoutePattern struct {
	Base
	Valid

	Title     string             `json:"dc:title"`
	Kana      string             `json:"odpt:kana"`
	Operator  string             `json:"odpt:operator"`
	Route     string             `json:"odpt:busroute"`
	Pattern   string             `json:"odpt:pattern"`
	Direction string             `json:"odpt:direction"`
	Note      string             `json:"odpt:note"`
	PoleOrder []BusStopPoleOrder `json:"odpt:busstopPoleOrder"`
}

BusRoutePattern describes a specific bus route

func LoadBusRoutePatternJSON

func LoadBusRoutePatternJSON(filename string) ([]*BusRoutePattern, error)

LoadBusRoutePatternJSON loads all BusRoutePattern entries from a static JSON file created by the data dump API

type BusStopPole

type BusStopPole struct {
	Base
	Location
	Valid

	Title          string            `json:"dc:title"`
	Kana           string            `json:"odpt:kana"`
	TitleLocalized map[string]string `json:"title"`
	Operator       []string          `json:"odpt:operator"`
}

BusStopPole contains information about a bus stop in the world that may serve one or more buses

func LoadBusStopPoleJSON

func LoadBusStopPoleJSON(filename string) ([]*BusStopPole, error)

LoadBusStopPoleJSON loads all BusStopPole entries from a static JSON file created by the data dump API

type BusStopPoleLookup

type BusStopPoleLookup map[string]*BusStopPole

func NewBusStopPoleLookup

func NewBusStopPoleLookup(poles []*BusStopPole) BusStopPoleLookup

NewBusStopPoleLookup creates a new lookup table to find station data

type BusStopPoleOrder

type BusStopPoleOrder struct {
	Pole                 string   `json:"odpt:busstopPole"`
	Index                int      `json:"odpt:index"`
	OpeningDoorsToGetOn  []string `json:"odpt:openingDoorsToGetOn"`
	OpeningDoorsToGetOff []string `json:"odpt:openingDoorsToGetOff"`
	Note                 string   `json:"odpt:Note"`
}

type Client

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

func NewClient

func NewClient(token string) *Client

func (*Client) GetAllBuses

func (c *Client) GetAllBuses(ctx context.Context) ([]*Bus, error)

func (*Client) GetBusesForRoute

func (c *Client) GetBusesForRoute(ctx context.Context, route string) ([]*Bus, error)

type Location

type Location struct {
	Longitude float64 `json:"geo:long"`
	Latitude  float64 `json:"geo:lat"`
}

func (Location) Bounds

func (l Location) Bounds() *rtreego.Rect

type PassengerSurvey

type PassengerSurvey struct {
	Base
	Operator               string                  `json:"odpt:operator"`
	Station                []string                `json:"odpt:station"`
	Railway                []string                `json:"odpt:railway"`
	IncludeAlighting       bool                    `json:"odpt:includeAlighting"`
	PassengerSurveyObjects []PassengerSurveyObject `json:"odpt:passengerSurveyObject"`
}

func LoadPassengerSurveysJSON

func LoadPassengerSurveysJSON(filename string) ([]*PassengerSurvey, error)

LoadPassengerSurveysJSON loads all PassengerSurvey entries from a static JSON file created by the data dump API

type PassengerSurveyObject

type PassengerSurveyObject struct {
	SurveyYear        int `json:"odpt:surveyYear"`
	PassengerJourneys int `json:"odpt:passengerJourneys"`
}

type Station

type Station struct {
	Base
	Location
	Title string `json:"dc:title"`
}

func LoadStationsJSON

func LoadStationsJSON(filename string) ([]*Station, error)

LoadStationsJSON loads all Station entries from a static JSON file created by the data dump API

type StationLookup

type StationLookup map[string]*Station

func NewStationLookup

func NewStationLookup(stations []*Station) StationLookup

NewStationLookup creates a new lookup table to find station data

type Valid

type Valid struct {
	Valid time.Time `json:"dct:valid"`
}

Jump to

Keyboard shortcuts

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