Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrGeoJSONParse = errors.New("geojson parse")
var ErrNoPath = errors.New("no path")
Functions ¶
func FindShortestPath ¶
func FindShortestPath( paths []path, startLongLat [2]float64, endLongLat [2]float64, precision float64, ) (path [][2]float64, dist float64, err error)
FindShortestPath finds the shortest path between fromLongLat and toLongLat using LineString paths found in the provided io.Reader's GeoJSON contents.
Input coordinates are expected to be in ESPG:4326 format.
Precision determines the fuzziness of linking together the start and end points, and the start and ends of the line segments. If precision is unset no rounding will occur, and start/end points are required to perfectly match across the line segments and the start and end points.
If a shortest path is found, the return path will include a set of points, starting with startLongLat and ending in endLongLat along with the total path distance.
If no path is found, an error of type ErrNoPath is returned.
func ParsePaths ¶
ParsePaths parses lines found within the provided GeoJSON. Any non line-strings are ignored. An error is returned if the file does not contain valid GeoJSON.
Types ¶
This section is empty.