Automatically cluster maps with more then 250 elements

This commit is contained in:
Pieter Vander Vennet 2021-01-05 00:21:00 +01:00
parent 46b05d7410
commit 4dacfd157a
5 changed files with 19 additions and 13 deletions

View file

@ -42,7 +42,7 @@ export default class ShowDataLayer {
const feats = features.data.map(ff => ff.feature);
let geoLayer = self.CreateGeojsonLayer(feats)
if (layoutToUse.clustering !== undefined) {
if (layoutToUse.clustering.minNeededElements <= features.data.length) {
const cl = window["L"];
const cluster = cl.markerClusterGroup({ disableClusteringAtZoom: layoutToUse.clustering.maxZoom });
cluster.addLayer(geoLayer);