Cluster markers in Google Maps Android v2

Greeny picture Greeny · Mar 19, 2013 · Viewed 46.5k times · Source

I have to place different markers on a GoogleMap from the Google Maps Android v2 API. The problem is that multiple markers are set to the same position (lat/lng), so the user only sees the "newest" marker.

Is there a possibility (in the best case: a library) that clusters different markers from the same area (in relation to the zoomlevel)?

I've already read about the MarkerClusterer, but this is designed for the JavaScript API.

Answer

Intrications picture Intrications · Feb 2, 2014

Google has provided a utility to do this as part of their Google Maps Android API Utility Library:

https://developers.google.com/maps/documentation/android/utility/marker-clustering

with the source at:

https://github.com/googlemaps/android-maps-utils