簡體   English   中英

傳單標記聚類

[英]Leaflet marker clustering

我正在密切關注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 中的錯誤。 任何的想法?

你讀過這個嗎?

你應該有

var group = new L.MarkerClusterGroup();
group.addLayer(new L.Marker(plot11));
... Add more layers ...
map.addLayer(group);

雖然 FranceImage 的先前答案顯示了正確的語法,但問題是由當前標記集群和傳單版本之間的不兼容引起的。 切換回 Leaflet 0.7.3(2014 年 5 月)解決了這個問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM