How to group map annotations?

I create a map with pins. Some of them are located close to each other and when I zoom out, the points are obscured by others. How to group them so that all of them become visible when the map is zoomed in properly. What the most efficient why to do that? Currently in viewDidLoad, I'm getting point data from firebase and put them on the map.

Code Block
db.collection("map").getDocuments() { (querySnapshot, err) in
if let err = err {
print("Error getting documents: \(err)")}
else {
for document in querySnapshot!.documents {
let data = document.data()
if let name = data["name"] as? String, let lat = data["lat"] as? Double, let lon = data["lon"] as? Double {
let newAnnotation = MKPointAnnotation()
newAnnotation.coordinate = CLLocationCoordinate2D(latitude: lat, longitude: lon)
newAnnotation.title = name
self.mapa.addAnnotation(newAnnotation)
}
}
}
}


Answered by DTS Engineer in 618167022
Please take a look at the clustering APIs for annotations. We have a sample project which demonstrates this.
Accepted Answer
Please take a look at the clustering APIs for annotations. We have a sample project which demonstrates this.
How to group map annotations?
 
 
Q