get Facilities By View Port
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
upper Left Lat
Latitude of the upper-left corner.
upper Left Lng
Longitude of the upper-left corner.
lower Right Lat
Latitude of the lower-right corner.
lower Right Lng
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}")
}
}Content copied to clipboard
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)")
}
}Content copied to clipboard