getFacilitiesByViewPort

abstract suspend fun getFacilitiesByViewPort(upperLeftLat: Double, upperLeftLng: Double, lowerRightLat: Double, lowerRightLng: Double): List<MapMarker>

Retrieves facilities within the provided viewport boundaries.

The bounding box is defined by upper-left and lower-right coordinates, allowing discovery of facilities visible on a map view.

Return

A list of MapMarker facilities inside the viewport.

Parameters

upperLeftLat

Latitude of the upper-left corner.

upperLeftLng

Longitude of the upper-left corner.

lowerRightLat

Latitude of the lower-right corner.

lowerRightLng

Longitude of the lower-right corner.

Throws

if the facilities cannot be retrieved.

Android (Kotlin)

lifecycleScope.launch {
try {
val markers = AFCore.map().getFacilitiesByViewPort(
upperLeftLat = 37.80, upperLeftLng = -122.52,
lowerRightLat = 37.70, lowerRightLng = -122.35
)
mapView.showMarkers(markers.filterNotNull())
} catch (t: Throwable) {
showError("Could not load facilities in view: ${t.message}")
}
}

iOS (Swift)

Task {
do {
let markers = try await AFCore.shared.map().getFacilitiesByViewPort(
upperLeftLat: 37.80, upperLeftLng: -122.52,
lowerRightLat: 37.70, lowerRightLng: -122.35
)
self.mapView.showMarkers(markers.compactMap { $0 })
} catch {
self.showError("Could not load facilities in view: \\(error.localizedDescription)")
}
}