rest

package
v0.5.8 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindIsochrones

func FindIsochrones(matcher *horizon.MapMatcher) func(*fiber.Ctx) error

FindIsochrones Find possible isochrones via POST-request @Summary Find possible isochrones via POST-request @Tags Isochrones @Produce json @Param POST-body body rest.IsochronesRequest true "Example of request" @Success 200 {object} rest.IsochronesResponse @Failure 424 {object} codes.Error424 @Failure 500 {object} codes.Error500 @Router /api/v0.1.0/isochrones [POST]

func FindSP

func FindSP(matcher *horizon.MapMatcher) func(*fiber.Ctx) error

FindSP Find shortest path via POST-request

Actually it can be done just by doing MapMatch for 2 proided points, but this just proof of concept
Services takes two points, snaps those to nearest vertices and finding path via Dijkstra's algorithm. Output is familiar to MapMatch()

@Summary Find shortest path via POST-request @Tags Routing @Produce json @Param POST-body body rest.SPRequest true "Example of request" @Success 200 {object} rest.SPResponse @Failure 424 {object} codes.Error424 @Failure 500 {object} codes.Error500 @Router /api/v0.1.0/shortest [POST]

func MapMatch

func MapMatch(matcher *horizon.MapMatcher) func(*fiber.Ctx) error

MapMatch Do map match via POST-request @Summary Do map match via POST-request @Tags Map matching @Produce json @Param POST-body body rest.MapMatchRequest true "Example of request" @Success 200 {object} rest.MapMatchResponse @Failure 424 {object} codes.Error424 @Failure 500 {object} codes.Error500 @Router /api/v0.1.0/mapmatch [POST]

func RenderPage

func RenderPage(webPage string) func(*fiber.Ctx) error

RenderPage Render front-end

Types

type GPSToMapMatch

type GPSToMapMatch struct {
	// Timestamp. Field would be ignored for request on '/shortest' service.
	Timestamp string `json:"tm" example:"2020-03-11T00:00:00"`
	// [Longitude, Latitude]
	LonLat [2]float64 `json:"lon_lat" example:"37.601249363208915,55.745374309126895"`
}

GPSToMapMatch Representation of GPS data swagger:model

type GPSToShortestPath

type GPSToShortestPath struct {
	// [Longitude, Latitude]
	LonLat [2]float64 `json:"lon_lat" example:"37.601249363208915,55.745374309126895"`
}

GPSToShortestPath Representation of GPS data swagger:model

type IsochronesRequest

type IsochronesRequest struct {
	// [Longitude, Latitude]
	LonLat [2]float64 `json:"lon_lat" example:"37.601249363208915,55.745374309126895"`
	// Max cost restrictions for single isochrone. Should be in range [0,+Inf]. Minumim is 0.
	MaxCost *float64 `json:"max_cost" example:"2100.0"`
	// Max radius of search for nearest vertex (Optional, default is 25.0, should be in range [0,+Inf])
	MaxNearestRadius *float64 `json:"nearest_radius" example:"25.0"`
}

IsochronesRequest User's request for isochrones swagger:model

type IsochronesResponse

type IsochronesResponse struct {
	Isochrones *geojson.FeatureCollection `json:"data" swaggerignore:"true"`
	// Warnings
	Warnings []string `json:"warnings" example:"Warning"`
}

IsochronesResponse Server's response for isochrones request swagger:model

type MapMatchRequest

type MapMatchRequest struct {
	// Set of GPS data
	Data []GPSToMapMatch `json:"gps"`
	// Max number of states for single GPS point (in range [1, 10], default is 5). Field would be ignored for request on '/shortest' service.
	MaxStates *int `json:"max_states" example:"5"`
	// Max radius of search for potential candidates (in range [7, 50], default is 25.0)
	StateRadius *float64 `json:"state_radius" example:"7.0"`
}

MapMatchRequest User's request for map matching swagger:model

type MapMatchResponse

type MapMatchResponse struct {
	// GeoJSON Data
	Path *geojson.FeatureCollection `json:"data" swaggerignore:"true"`
	// Warnings
	Warnings []string `json:"warnings" example:"Warning"`
}

MapMatchResponse Server's response for map matching request swagger:model

type SPRequest

type SPRequest struct {
	// Set of GPS data
	Data []GPSToShortestPath `json:"gps"`
	// Max radius of search for potential candidates (in range [7, 50], default is 25.0)
	StateRadius *float64 `json:"state_radius" example:"10.0"`
}

SPRequest User's request for finding shortest path swagger:model

type SPResponse

type SPResponse struct {
	Path *geojson.FeatureCollection `json:"data" swaggerignore:"true"`
	// Warnings
	Warnings []string `json:"warnings" example:"Warning"`
}

SPResponse Server's response for shortest path request swagger:model

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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