Annotations clustering
Annotations clustering
Allow your users to cluster annotations for better visualization. By default, annotations clustering is disabled.
You can decide per each marker if it should be included in the clustering process or not (e.g., you want to have a few
annotations that are never clustered). To manipulate marker clustering, use TTAnnotationManager
obtained
from TTMapView
.
Sample use case: You want to display the distribution of parking spots across the city. Individual parking spots are shown only at higher zoom levels, otherwise data is clustered for better visualization.
To enable annotations clustering:
_
mapView.annotationManager.clustering = true
self.mapView.annotationManager.clustering = YES;
To flag a marker indicating that it should be clustered:
_
annotation.shouldCluster = true
annotation.shouldCluster = YES;
Examples are shown below:
![]() Lower zoom level |
![]() Higher zoom level |