Markers clustering documentation?

Is there any documentation about markers clustering beside the example?
The example without any comment is not much of use.

I’m using SDK v5.47

1 Like

I’ll try to be more specific.
I can’t understand if and how it is possible to show more than one set of clusters on the map, in my application I have 2 categories of markers and I need to clusterize them and be able to show/hide them dynamically.
I have no problem with SDK v4.47 by using markerClusterGroup() on the 2 sets of markers and by assigning the result to 2 variables to have the 2 categories of clusters and then addLayer() and removeLayer() to show/hide them on the map, but I can’t get how to do the same with the new version.

Hi,

the approach used in V5 is different, the clusters are added to the map using a layer. This layer must be a cluster type layer.

You can have a look at the properties of this layer here: https://developer.tomtom.com/maps-api/maps-api-documentation/map-style-specification
Look for cluster.

If you need to customize what is rendered on the map you can then use queryRenderedFeatures and querySourceFeatures. The documentation is available here: https://developer.tomtom.com/maps-sdk-web-js/documentation#Maps.Map

Hope this helps.

1 Like