queryBuildingOnFinalDestination

The API can be invoked to query a building on MapboxMap using the RouteProgress provided as an input. Use this function to query a building when you reach your destination. The API returns a BuildingError if there is an internal issue fetching the buildings. Otherwise, it returns buildings wrapped inside BuildingValue in a form of list of QueriedRenderedFeature. This list is empty if the building is not found on the MapboxMap

Note:

There are two kind of points that can be used here to query a building.

  • A point you can obtain where the actual building is also known as location point

  • A point on a road snapped from the address also known as routable point

For this method to work, your route's original request should be a "location point" and not a "routing point", otherwise, nothing will be returned. If the coordinate is a routing point (which is the correct way to do it), you should define a "waypoint_targets" in the original request, for each of the waypoints, and for the final destination.

For example when making a route request, you can specify the RouteOptions as follows if you choose the coordinate to be a routing point:

val routeOptions = RouteOptions.builder()
.applyDefaultNavigationOptions()
.applyLanguageAndVoiceUnitOptions(this)
.coordinatesList(
listOf(
Point.fromLngLat(-122.4192, 37.7627), // origin
Point.fromLngLat(-122.4145, 37.7653) // final destination
)
)
.waypointTargetsList(
listOf(
Point.fromLngLat(-122.4192, 37.7627), // origin
Point.fromLngLat(-122.4146, 37.7655) // final destination
)
)
.build()

In this case the points mentioned in the RouteOptions.coordinatesList are routing points where you would want the router to route you to whereas the points mentioned in the RouteOptions.waypointTargetsList are the location points that would be highlighted when you reach your final destination. In case you don't specify the RouteOptions.waypointTargetsList the logic will fallback to RouteOptions.coordinatesList and would try to highlight these points. However the highlight will only work if they are location points.