Creates a new instance of TerraRoute.
Optional
distanceMeasurement: (positionA: Position, positionB: Position) => numberOptional custom distance measurement function (defaults to haversine distance).
Builds the internal graph representation (adjacency list) from the input network. Each LineString segment is translated into bidirectional graph edges with associated distances. Assumes that the network is a connected graph of LineStrings with shared coordinates. Calling this method with a new network overwrite any existing network and reset all internal data structures.
A GeoJSON FeatureCollection of LineStrings representing the road network.
Computes the shortest route between two points in the network using A* algorithm.
A GeoJSON Point Feature representing the start location.
A GeoJSON Point Feature representing the end location.
A GeoJSON LineString Feature representing the shortest path, or null if no path is found.
TerraRoute is a routing utility for finding the shortest path between two geographic points over a given GeoJSON LineString network.
The class builds an internal graph structure based on the provided network, then applies A* algorithm to compute the shortest route.