Documentation ¶
Index ¶
- func PrepareGeoJSONLinestring(pts []geoPoint) string
- func PrepareWKTLinestring(pts []geoPoint) string
- type Distance
- type ExpandedGraph
- type Graph
- func (graph *Graph) AddEdge(from, to int64, weight float64)
- func (graph *Graph) AddTurnRestriction(from, via, to int64)
- func (graph *Graph) AddVertex(labelExternal, labelInternal int64)
- func (graph *Graph) ComputePath(middleID int64, prevF, prevR map[int64]int64) []int64
- func (graph *Graph) CreateVertex(label int64)
- func (graph *Graph) ExportToFile(fname string) error
- func (g *Graph) ImportRestrictionsFromFile(fname string) error
- func (graph *Graph) PrepareContracts()
- func (graph *Graph) Preprocess() []int64
- func (graph *Graph) ShortestPath(source, target int64) (float64, []int64)
- func (graph *Graph) ShortestPathOneToMany(source int64, targets []int64) ([]float64, [][]int64)
- func (graph *Graph) VanillaShortestPath(source, target int64) (float64, []int64)
- func (graph *Graph) VanillaTurnRestrictedShortestPath(source, target int64) (float64, []int64)
- type OsmConfiguration
- type Vertex
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrepareGeoJSONLinestring ¶ added in v1.3.4
func PrepareGeoJSONLinestring(pts []geoPoint) string
PrepareGeoJSONLinestring Creates GeoJSON LineString from set of points
func PrepareWKTLinestring ¶ added in v1.3.3
func PrepareWKTLinestring(pts []geoPoint) string
PrepareWKTLinestring Creates WKT LineString from set of points
Types ¶
type Distance ¶
type Distance struct {
// contains filtered or unexported fields
}
func NewDistance ¶
func NewDistance() *Distance
type ExpandedGraph ¶ added in v1.3.3
ExpandedGraph Representation of edge expanded graph
map[newSourceVertexID]map[newTargetVertexID]newExpandedEdge
func ImportFromOSMFile ¶ added in v1.3.0
func ImportFromOSMFile(fileName string, cfg *OsmConfiguration) (*ExpandedGraph, error)
ImportFromOSMFile Imports graph from file of PBF-format (in OSM terms)
File should have PBF (Protocolbuffer Binary Format) extension according to https://github.com/paulmach/osm
type Graph ¶
type Graph struct { Vertices []*Vertex // contains filtered or unexported fields }
Graph Graph object
pqImportance Heap to store importance of each vertex pqComparator Heap to store traveled distance mapping Internal map for 1:1 relation of internal IDs to user's IDs Vertices Slice of vertices of graph nodeOrdering Ordering of vertices contracts found and stored contraction hierarchies
func ImportFromFile ¶
ImportFromFile Imports graph from file of CSV-format Header of main CSV-file:
from_vertex_id - int64, ID of source vertex to_vertex_id - int64, ID of arget vertex f_internal - int64, Internal ID of source vertex t_internal - int64, Internal ID of target vertex weight - float64, Weight of an edge via_vertex_id - int64, ID of vertex through which the contraction exists (-1 if no contraction) v_internal - int64, Internal ID of vertex through which the contraction exists (-1 if no contraction)
func (*Graph) AddEdge ¶
AddEdge Adds new edge between two vertices
from User's definied ID of first vertex of edge to User's definied ID of last vertex of edge weight User's definied weight of edge
func (*Graph) AddTurnRestriction ¶ added in v1.2.0
AddTurnRestriction Adds new turn restriction between two vertices via some other vertex
from User's definied ID of source vertex via User's definied ID of prohibited vertex (between source and target) to User's definied ID of target vertex
func (*Graph) AddVertex ¶
AddVertex Adds vertex with provided internal ID
labelExternal User's definied ID of vertex labelInternal internal ID of vertex
func (*Graph) ComputePath ¶
ComputePath Returns slice of IDs (user defined) of computed path
func (*Graph) CreateVertex ¶
CreateVertex Creates new vertex and assign internal ID to it
label User's definied ID of vertex
func (*Graph) ExportToFile ¶
ExportToFile Exports graph to file of CSV-format Header of main CSV-file:
from_vertex_id - int64, ID of source vertex to_vertex_id - int64, ID of arget vertex f_internal - int64, Internal ID of source vertex t_internal - int64, Internal ID of target vertex weight - float64, Weight of an edge via_vertex_id - int64, ID of vertex through which the contraction exists (-1 if no contraction) v_internal - int64, Internal ID of vertex through which the contraction exists (-1 if no contraction)
func (*Graph) ImportRestrictionsFromFile ¶ added in v1.2.1
ImportRestrictionsFromFile Imports turn restrictions from file of CSV-format into graph
Header of CSV-file: from_vertex_id;via_vertex_id;to_vertex_id; int;int;int
func (*Graph) PrepareContracts ¶
func (graph *Graph) PrepareContracts()
PrepareContracts Compute contraction hierarchies
func (*Graph) Preprocess ¶
Preprocess Computes contraction hierarchies and returns node ordering
func (*Graph) ShortestPath ¶
ShortestPath Computes and returns shortest path and it's cost (extended Dijkstra's algorithm)
If there are some errors then function returns '-1.0' as cost and nil as shortest path
source User's definied ID of source vertex target User's definied ID of target vertex
func (*Graph) ShortestPathOneToMany ¶ added in v1.2.8
ShortestPathOneToMany Computes and returns shortest path and it's cost (extended Dijkstra's algorithm) for one-to-many relation
If there are some errors then function returns '-1.0' as cost and nil as shortest path
source User's definied ID of source vertex targets User's definied IDs for target vertetices
func (*Graph) VanillaShortestPath ¶
VanillaShortestPath Computes and returns shortest path and it's cost (vanilla Dijkstra's algorithm)
If there are some errors then function returns '-1.0' as cost and nil as shortest path
source User's definied ID of source vertex target User's definied ID of target vertex
func (*Graph) VanillaTurnRestrictedShortestPath ¶ added in v1.2.0
VanillaTurnRestrictedShortestPath Computes and returns turns restricted shortest path and it's cost (vanilla Dijkstra's algorithm)
If there are some errors then function returns '-1.0' as cost and nil as shortest path
source User's definied ID of source vertex target User's definied ID of target vertex
type OsmConfiguration ¶ added in v1.3.0
type OsmConfiguration struct { EntityName string // Currrently we support 'highway' only Tags []string }
OsmConfiguration Allows to filter ways by certain tags from OSM data
func (*OsmConfiguration) CheckTag ¶ added in v1.3.0
func (cfg *OsmConfiguration) CheckTag(tag string) bool
CheckTag Checks if incoming tag is represented in configuration