Documentation
¶
Index ¶
- func FindIsochrones(matcher *horizon.MapMatcher) func(*fiber.Ctx) error
- func FindSP(matcher *horizon.MapMatcher) func(*fiber.Ctx) error
- func MapMatch(matcher *horizon.MapMatcher) func(*fiber.Ctx) error
- func RenderPage(webPage string) func(*fiber.Ctx) error
- type GPSToMapMatch
- type GPSToShortestPath
- type IntermediateEdgeResponse
- type IsochronesRequest
- type IsochronesResponse
- type MapMatchRequest
- type MapMatchResponse
- type ObservationEdgeResponse
- type SPRequest
- type SPResponse
- type SubMatchResponse
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]
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"`
// GPS measurement accuracy in meters (optional, <=0 or null means use default sigma)
Accuracy *float64 `json:"accuracy" example:"5.0"`
}
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 >= 0.
MaxCost *float64 `json:"max_cost" example:"2100.0"`
// Max radius of search for nearest vertex.
// Use -1 for no limit, 0 for default (100m), or positive value.
MaxNearestRadius *float64 `json:"nearest_radius" example:"100.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.
// Use -1 for no limit, 0 for default (50m), or positive value.
StateRadius *float64 `json:"state_radius" example:"50.0"`
// Set of GPS data
Data []GPSToMapMatch `json:"gps"`
}
MapMatchRequest User's request for map matching swagger:model
type MapMatchResponse ¶
type MapMatchResponse struct {
// Array of sub-matches (segments split when route cannot be computed between consecutive points)
SubMatches []SubMatchResponse `json:"sub_matches"`
// 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 corresponds to index in incoming request
ObservationIdx int `json:"obs_idx" example:"0"`
// Whether this observation was successfully matched to a road (false if no candidates were found)
IsMatched bool `json:"is_matched" example:"true"`
// Matcher code providing additional info. 900 - OK, 901 - no candidates, 902 - orphan observation
Code horizon.MatcherCode `json:"code" example:"900"`
// Matched edge identifier (0 if is_matched=false)
EdgeID int64 `json:"edge_id" example:"3149"`
// Matched vertex identifier (0 if is_matched=false)
VertexID int64 `json:"vertex_id" example:"44014"`
// Corresponding matched edge as GeoJSON LineString feature (null if is_matched=false)
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 (null if is_matched=false)
MatchedVertex *geojson.Feature `json:"matched_vertex" swaggertype:"object"`
// Corresponding projection on the edge as GeoJSON Point feature (null if is_matched=false)
ProjectedPoint *geojson.Feature `json:"projected_point" swaggertype:"object"`
// Original GPS point as GeoJSON Point feature (useful when is_matched=false)
OriginalPoint *geojson.Feature `json:"original_point,omitempty" 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.
// Use -1 for no limit, 0 for default (100m), or positive value.
StateRadius *float64 `json:"state_radius" example:"100.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
type SubMatchResponse ¶ added in v0.8.0
type SubMatchResponse struct {
// Set of matched edges for observations in this segment
Observations []ObservationEdgeResponse `json:"observations"`
// Probability from Viterbi algorithm for this segment
Probability float64 `json:"probability" example:"-86.578520"`
}
SubMatchResponse A single continuous matched segment swagger:model