Sorry, you need to enable JavaScript to visit this website.

Markers clustering

Markers clustering

Allow your users to cluster markers for better visualization. By default, markers 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 markers that are never clustered). To manipulate marker clustering, use MarkerSettings obtained from TomtomMap.

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 markers clustering:

tomtomMap.getMarkerSettings().setMarkersClustering(true);

To flag a marker that it should be clustered:

MarkerBuilder markerBuilder = new MarkerBuilder(position)
        .shouldCluster(true)
        .markerBalloon(new SimpleMarkerBalloon(positionToText(position)));

Examples are shown below:



image

Lower zoom level

image

Higher zoom level