THIS SDK ISDEPRECATED.

We rolled out a new and better SDK for you.

Markers clustering

Allow your users to cluster markers for better visualization. By default, marker clustering is disabled. You can decide for 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)
tomtomMap.markerSettings.setMarkersClustering(true)

To flag a marker that it should be clustered:

1MarkerBuilder markerBuilder = new MarkerBuilder(position)
2 .shouldCluster(true)
3 .markerBalloon(new SimpleMarkerBalloon(positionToText(position)));
1val markerBuilder = MarkerBuilder(position)
2 .shouldCluster(true)
3 .markerBalloon(SimpleMarkerBalloon(positionToText(position)))

Examples are shown below:

image

Lower zoom level

image

Higher zoom level