findClosestRoute

fun findClosestRoute(    target: Point,     mapboxMap: MapboxMap,     padding: Float,     resultConsumer: MapboxNavigationConsumer<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.

This method will execute tasks on a background thread. There is a cancel method which will cancel the background tasks.

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.

resultConsumer

a callback to receive the result