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:
CSA Inputs Dataextract: Extracts necessary data from the SQLite database, 4 inputs extracted: connectionss, transfers, walksfrom, and walksto
CSA Execution: Runs the CSA algorithm (returns []*dbt.Connection)
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.
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