Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cluster markers in Google Maps Android v2

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.

like image 579
Greeny Avatar asked Mar 19 '13 09:03

Greeny


People also ask

What is marker clustering?

Marker clusters is the concept of sampling the data values into larger blocks in order to ease readability and increase performance. It is a simple solution to display a large number of markers on a map, or a chart. The number on a cluster shows how many markers it contains.

What are Android markers?

Markers are objects of type Marker , and are added to the map with the GoogleMap. addMarker(markerOptions) method. Markers are designed to be interactive. They receive click events by default, and are often used with event listeners to bring up info windows.


1 Answers

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

like image 140
Intrications Avatar answered Oct 11 '22 01:10

Intrications