leaflet - manually cluster markers

谁都会走 提交于 2021-01-28 11:14:32

问题


I need to manually cluster/uncluster few markers on the map (not automatically by zoom)

is there a way to tell Leaflet.markercluster which markers to cluster manually and not automatically by zoom.

I tried manipulating the L.markerClusterGroup layer internal cluster._gridClusters and cluster._gridUnclustered which holds an array of all the zooms and markers/clusters in each. but changing the objects seems to do nothing and not represented on map.

a solution example would be:

selectedMarkers = [marker1,marker2,marker3];
map.cluster(selectedMarkers);
map.uncluster(selectedMarkers);

please help.

来源:https://stackoverflow.com/questions/49132633/leaflet-manually-cluster-markers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!