findClosestRoute

suspend fun MapboxRouteLineApi.findClosestRoute(    target: Point,     mapboxMap: MapboxMap,     padding: Float): Expected<RouteNotFound, ClosestRouteValue>

The map will be queried for a route line feature at the target point or a bounding box centered at the target point with a padding value determining the box's size. If a route feature is found the index of that route in this class's route collection is returned. The primary route is given precedence if more than one route is found.

Return

a value containing the DirectionsRoute found or an error indicating no route was found.

Parameters

target

a target latitude/longitude serving as the search point

mapboxMap

a reference to the MapboxMap that will be queried

padding

a sizing value added to all sides of the target point for creating a bounding box to search in.