hulab / ClusterKit

An iOS map clustering framework targeting MapKit, Google Maps and Mapbox.
MIT License
512 stars 86 forks source link

Two different cluster layers #53

Closed Belzik closed 4 years ago

Belzik commented 6 years ago

At the moment, we put the annotations in an array of Сluster Manager: mapView.clusterManager.annotations = annotations

But, what should I do if I want to have two different layers. For example, shops will cluster in one layer and cultural monuments in another.

I have two arrays var news: [NewsAnnotation] var monuments: [MonumentsAnnotation] Accordingly, these two arrays should not cluster together. And should not be displayed on the map as a single layer.

Any ideas? I Used MapBox.

miki9938 commented 5 years ago

I have the same problem to resolve, anyone have any ideas how to do it?

maxep commented 5 years ago

I never tested it but creating 2 cluster managers for the same map should work:

let layer1 = CKClusterManager()
layer1.map = self.mapView
layer1.annotations = news

let layer2 = CKClusterManager()
layer2.map = self.mapView
layer2.annotations = monuments
maxep commented 4 years ago

Have you been able to test that? I will close this for now.