You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So the actual layer is just a geojson layer and the geojson layer does not work natively with the marker cluster plugin, it's expecting an array of markers not a feature collection, your best bet is probably to use the ajax method that this comes with to do it yourself, something like:
varclusters=(newL.MarkerClusterGroup()).addTo(map);L.Util.ajax("url/same/origin.geojson",function(data){//check if it's an array of points or a feature collectionvarfeatures=Array.isArray(data)?data:data.features;//map the features to pointsclusters.addLayers(features.map(function(feature){if(feature.geometry.type==="point"){returnL.marker([feature.geometry.coordinates[1],feature.coordinates[0]]);//geojson is lng,lat}}).filter(function(v){returnv}))//filter out any that weren't points});
Exists an easy way for interact this plugin with Leaflet.markercluster??
1)the data is loaded in ajax
2)and the markers then are grouped by Leaflet.markercluster
The text was updated successfully, but these errors were encountered: