getShortestRoute

fun getShortestRoute(startLocation: LngLatAlt, endLocation: LngLatAlt, roads: FeatureCollection): FeatureCollection

Given a start and end location and a FeatureCollection that contains connected roads it will return a FeatureCollection with a LineString that represents the shortest route between the start and end locations. The shortest route is calculated using Dijkstra's algorithm.

Return

A FeatureCollection containing the shortest route between the start and end location represented as a LineString. The Feature also contains a "length" property that represents the distance of the route.

Parameters

startLocation

A LngLatAlt object representing the start location.

endLocation

A LngLatAlt object representing the end location.

roads

A FeatureCollection containing the roads that make up the map.