apirtroute

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: GPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RouteParams

type RouteParams struct {
	// Required
	FeedIDs            []int      `json:"feed_ids" validate:"required,gt=0"`
	From               [2]float64 `json:"from" validate:"required,len=2"`
	To                 [2]float64 `json:"to" validate:"required,len=2"`
	TransferCategories []string   `json:"transfer_categories" validate:"required,dive,oneof=f i g"`
	OutputFormats      []string   `json:"output_formats" validate:"required,gt=0,dive,oneof=connections legs geojson mapurl diagnostics request"`

	// Non-Required (has default values - see RTRoute logic)
	Time               *time.Time `json:"time" validate:"required"`                                     // Default: now
	MaxNTransfers      uint       `json:"max_n_transfers" validate:"required"`                          // Default: 20
	MaxTransferSeconds uint       `json:"max_transfer_seconds" validate:"gtfield=MinTransferSeconds"`   // Default: 40*60
	MaxTripSeconds     uint       `json:"max_trip_seconds" validate:"gt=0"`                             // Default: 240*60
	MaxWalkSeconds     uint       `json:"max_walk_seconds" validate:"gt=0"`                             // Default: 20*60
	MinTransferSeconds uint       `json:"min_transfer_seconds" validate:"required"`                     // Default: 3*60
	WalkspeedKmHr      float64    `json:"walkspeed_km_hr" validate:"gt=0"`                              // Default: 3.5
	Optimizations      []string   `json:"optimizations" validate:"required,gt=0,dive,oneof=feedsclean"` // Default: [feedsclean]
}

RouteParams contains the parameters for a given route request.

The FeedIDs, From, To, TransferCategories, and Output format fields are required.

Other fields are optional and will be filled in with default values if unset

type RouteResponse

type RouteResponse struct {
	RouteLegs        *[]formatterlegs.RouteLeg          `json:"legs,omitempty"`
	GeoJSON          *[]formattergeojson.GeoJSONFeature `json:"geojson,omitempty"`
	MapURL           *string                            `json:"mapurl,omitempty"`
	Request          *RouteParams                       `json:"request,omitempty"`
	RouteDiagnostics *diagnosticst.RouteDiagnostics     `json:"diagnostics,omitempty"`
	Connections      *[]dbt.ConnectionVerbose           `json:"connections,omitempty"`
}

RouteResponse is the response for a successful routing request.

func RTRoute

func RTRoute(runtime *apirtinit.MobrouteRuntime, params *RouteParams) (*RouteResponse, error)

RTRoute performs the routing logic, extracting from the DB the required data for CSA, running the CSA algorithm, going back to the DB to pull a few extra fields for presentation, and finally formatting the data into route legs for easy consumption.

type Timer

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

func (*Timer) Snapshot

func (t *Timer) Snapshot() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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