apiroute

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: GPL-2.0 Imports: 15 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 {
	MSParams *apims.MSParams `yaml:"load" json:"load"`

	From               *utilfuncs.Coord `yaml:"from" json:"from"`
	To                 *utilfuncs.Coord `yaml:"to" json:"to"`
	Time               *time.Time       `yaml:"time" json:"time"` // Time of departure; if nil, uses now
	MaxWalkSeconds     *uint            `yaml:"max_walk_seconds" json:"max_walk_seconds"`
	MaxTripSeconds     *uint            `yaml:"max_trip_seconds" json:"max_trip_seconds"`
	MaxTransferSeconds *uint            `yaml:"max_transfer_seconds" json:"max_transfer_seconds"`
	MinTransferSeconds *uint            `yaml:"min_transfer_seconds" json:"min_transfer_seconds"`
	MaxNTransfers      *uint            `yaml:"max_n_transfers" json:"max_n_transfers"`
	WalkspeedKmHr      *float64         `yaml:"walkspeed_km_hr" json:"walkspeed_km_hr"`
	TransferCategories *[]string        `yaml:"transfer_categories" json:"transfer_categories"`

	OutputFormats *[]string `yaml:"output_formats" json:"output_formats"`
}

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"`
	Diagnostics *diagnosticst.Diagnostics          `json:"diagnostics,omitempty"`
	Connections *[]dbt.ConnectionVerbose           `json:"connections,omitempty"`
}

func Route added in v0.5.0

func Route(paramsGiven *RouteParams) (*RouteResponse, error)

Route 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:

Essentially a 4 step process:

  1. CSA Inputs Dataextract: Extracts necessary data from the SQLite database, 4 inputs extracted: connectionss, transfers, walksfrom, and walksto

  2. CSA Execution: Runs the CSA algorithm (returns []*dbt.Connection)

  3. CSA Outputs Verbosity Dataextract: Result of CSA algorithm is fitered []*dbt.Connection, which is a minimal datastructure with just information needed for CSA - so in this step we go back to the database to extract []*dbt.ConnectionVerbose for the result of the CSA alg's connections.

  4. Leg Formatting: Formatting the []*dbt.ConnectionVerbose CSA results into a nice pretty format showing each part of the trip: - Leg for walking to input stop - (n) trips (with each []*dbt.Connection nested within) - (n) transfers between each trip - Leg for walking from output stop to destination

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