【问题标题】:Leaflet marker clustering传单标记聚类
【发布时间】:2015-08-06 08:07:42
【问题描述】:

我正在密切关注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 中触发错误。有什么想法吗?

【问题讨论】:

    标签: javascript leaflet openlayers gis


    【解决方案1】:

    你读过this吗?

    你应该有

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

    【讨论】:

    • 非常感谢 FranceImage - 我相信我们快到了。从wjst.de/images/gps/index.php 的第 219 行开始添加上面的代码,但仍然无济于事......
    【解决方案2】:

    虽然 FranceImage 的上一个答案显示了正确的语法,但问题是由当前标记集群和传单版本之间的不兼容引起的。切换回 Leaflet 0.7.3(2014 年 5 月)解决了它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-10-21
      • 1970-01-01
      • 1970-01-01
      • 2021-10-22
      相关资源
      最近更新 更多