I am using clustering in osmdroid. Initially there is one big cluster. On zooming the cluster breaks in two separate clusters. Then on further zooming those clusters break in smaller clusters with less number of markers.
What i wanted was to have different icons for clusters based on the number of markers they have.
radiusMarkerClusterer.setRadius(40);
radiusMarkerClusterer.setMaxClusteringZoomLevel(17);
radiusMarkerClusterer.reversedClusters();
for (int i = 0; i < alert.size(); i++) {
position = new GeoPoint(Double.parseDouble(alert.get(i).getLatitude()), Double.parseDouble(alert.get(i).getLongitude()));
marker = new Marker(map);
marker.setPosition(position);
mapController.animateTo(position);
Log.i(TAG, "MArker added to cluster ");
radiusMarkerClusterer.add(marker);
}
map.getOverlays().add(radiusMarkerClusterer);
This is how i am implementing clustering right now. Is there a way to do that?
RadiusMarkerClusterer does not support different drawables for different zooms. You'll need to create custom MarkerClusterer subclass.
Check source of RadiusMarkerClusterer for guidance and inspiration. A drawable for a marker is created in method buildClusterMarker
@Override public Marker buildClusterMarker(StaticCluster cluster, MapView mapView)
As you can see there is access to the MapView so you can obtain current zoom level and decide which icon should be used.