getNearbyFacilities

abstract suspend fun getNearbyFacilities(latitude: Double, longitude: Double): List<MapMarker>

Retrieves facilities around the given coordinates.

The returned list may contain facilities not yet linked to the current member. Useful for enabling users to discover and add facilities to their list.

Return

A list of MapMarker facilities near the specified coordinates.

Parameters

latitude

The latitude of the center point.

longitude

The longitude of the center point.

Throws

if the facilities cannot be retrieved.

Android (Kotlin)

lifecycleScope.launch {
try {
val markers = AFCore.map().getNearbyFacilities(latitude = 37.7749, longitude = -122.4194)
mapView.showMarkers(markers.filterNotNull())
} catch (t: Throwable) {
showError("Could not load nearby facilities: ${t.message}")
}
}

iOS (Swift)

Task {
do {
let markers = try await AFCore.shared.map().getNearbyFacilities(
latitude: 37.7749,
longitude: -122.4194
)
self.mapView.showMarkers(markers.compactMap { $0 })
} catch {
self.showError("Could not load nearby facilities: \\(error.localizedDescription)")
}
}