Clustering | 2GIS Documentation
MapGL JS API

Marker clustering

If you have a large number of markers concentrated in one area, you can use marker clustering to combine them into a single object when the map is zoomed out to reduce the visual clutter.

To use marker clustering, you need to include the clustering plugin in your project. To do this, add the following line after the main MapGL script:

<script src="https://unpkg.com/@2gis/mapgl-clusterer@^2/dist/clustering.js"></script>

Or you can install the needed package using npm:

npm install @2gis/mapgl-clusterer

To start using the plugin, check the following resources: