我正在密切关注https://switch2osm.org/using-tiles/getting-started-with-leaflet的例子同时添加更多有用的功能。除了使用 https://github.com/Leaflet/Leaflet.markercluster 中的插件进行额外的标记聚类之外,一切都开箱即用。 。我想更换线路
var plotmark = new L.Marker(plotll);
与
var plotmark = new L.MarkerClusterGroup(plotll);
这会触发 leaflet.js 中的错误。有什么想法吗?
最佳答案
您读过this吗? ?
你应该有
var group = new L.MarkerClusterGroup();
group.addLayer(new L.Marker(plot11));
... Add more layers ...
map.addLayer(group);
关于javascript - 传单标记聚类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31850186/