rest

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: Apache-2.0 Imports: 7 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 IntermediateEdgeResponse added in v0.6.0

type IntermediateEdgeResponse struct {
	// Edge geometry as GeoJSON LineString feature
	Geom *geojson.Feature `json:"geom" swaggertype:"object"`
	// Travel cost
	Weight float64 `json:"weight"`
	// Edge identifier
	ID int64 `json:"id" example:"4278"`
}

IntermediateEdgeResponse Edge which is not matched to any observation but helps to form whole travel path swagger:model

type IsochronesRequest

type IsochronesRequest struct {
	// 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"`
	// [Longitude, Latitude]
	LonLat [2]float64 `json:"lon_lat" example:"37.601249363208915,55.745374309126895"`
}

IsochronesRequest User's request for isochrones swagger:model

type IsochronesResponse

type IsochronesResponse struct {
	// GeojSON data with properties on each feature: "cost" - travel cost to reach the vertex; "vertex_id" - corresponding vertex
	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 {
	// 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"`
	// Set of GPS data
	Data []GPSToMapMatch `json:"gps"`
}

MapMatchRequest User's request for map matching swagger:model

type MapMatchResponse

type MapMatchResponse struct {
	// GeoJSON data
	// Set of matched edges for each observation
	Data []ObservationEdgeResponse `json:"data" `
	// Warnings
	Warnings []string `json:"warnings" example:"Warning"`
}

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

type ObservationEdgeResponse added in v0.6.0

type ObservationEdgeResponse struct {
	// Index of an observation. Index correspondes to index in incoming request. If some indices are not presented then it means that they have been trimmed
	ObservationIdx int `json:"obs_idx" example:"0"`
	// Matched edge identifier
	EdgeID int64 `json:"edge_id" example:"3149"`
	// Matched vertex identifier
	VertexID int64 `json:"vertex_id" example:"44014"`
	// Corresponding matched edge as GeoJSON LineString feature
	MatchedEdge *geojson.Feature `json:"matched_edge" swaggertype:"object"`
	// Cut for excess part of the matched edge. Will be null for every observation except the first and the last. Could be null for first/last edge when projection point corresponds to source/target vertices of the edge
	MatchedEdgeCut *geojson.Feature `json:"matched_edge_cut" swaggertype:"object"`
	// Corresponding matched vertex as GeoJSON Point feature
	MatchedVertex *geojson.Feature `json:"matched_vertex" swaggertype:"object"`
	// Corresponding projection on the edge as GeoJSON Point feature
	ProjectedPoint *geojson.Feature `json:"projected_point" swaggertype:"object"`
	// Set of leading edges up to next observation (so these edges is not matched to any observation explicitly). Could be an empty array if observations are very close to each other or if it just last observation
	NextEdges []IntermediateEdgeResponse `json:"next_edges"`
}

Relation between observation and matched edge

type SPRequest

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

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

type SPResponse

type SPResponse struct {
	// Set of matched edges for each path's edge as GeoJSON LineString objects. Each feature contains edge identifier (`id`), travel cost (`weight`) and geometry (`coordinates`)
	Data []*geojson.Feature `json:"data" swaggertype:"object"`
	// 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