如何将标记群集添加到地图框存储定位器模板



我尝试了不同的方法来将集群与商店定位器同步。添加集群很容易,但是我对左侧的列表有一些问题。

我的问题是,我不太确定如何集成此功能,最后商店定位器与自定义标记一起工作,并且列表以正确的方式同步。

店铺定位器:https://jsfiddle.net/sd5vt439/

L.mapbox.featureLayer('examples.map-h61e8o8e').on('ready', function(e) {
    var clusterGroup = new L.MarkerClusterGroup();
    e.target.eachLayer(function(layer) {
        clusterGroup.addLayer(layer);
    });
    map.addLayer(clusterGroup);
});

好的,我尝试了一点,它现在适用于嵌套函数:

locations.on('ready', function(e) {
  var clusterGroup = new L.MarkerClusterGroup();
    e.target.eachLayer(function(layer) {
        clusterGroup.addLayer(layer);
    });
    map.addLayer(clusterGroup);
    locations.eachLayer(function(locale) {
    ....
}

最新更新