0

我目前有一个 Leaflet 地图,它从 GeoJSON 文件中提取数据并对其进行聚类,如下所示:

var markers = L.markerClusterGroup({
    showCoverageOnHover: true,
    spiderfyOnMaxZoom: true  
});

var geoJsonLayer = L.geoJson(thefts, {
    onEachFeature: function (feature, layer) {
        layer.bindPopup(feature.properties.bike_value);
    }
});

markers.addLayer(geoJsonLayer);
map.addLayer(markers);
map.fitBounds(markers.getBounds());

中间部分给我带来了一些麻烦:

var geoJsonLayer = L.geoJson(thefts, {
    onEachFeature: function (feature, layer) {
        layer.bindPopup(feature.properties.bike_value);
    }
});

每次我尝试单击弹出窗口时,都会收到一个控制台错误,显示Uncaught Error: NotFoundError: DOM Exception 8。错误堆栈如下所示:

Uncaught Error: NotFoundError: DOM Exception 8 leaflet.js:7
    o.Popup.o.Class.extend.onRemove leaflet.js:7
    o.Map.o.Class.extend.removeLayer leaflet.js:6
    o.Map.include.closePopup leaflet.js:7
    o.Popup.o.Class.extend._close leaflet.js:7
    o.Marker.include.closePopup leaflet.js:7
    o.Marker.include.togglePopup leaflet.js:7
    o.Mixin.Events.fireEvent leaflet.js:6
    o.Marker.o.Class.extend._onMouseClick leaflet.js:7
    t.(anonymous function).s

关于可能导致这种情况的任何想法?我知道还有其他与 DOM Exception 8 相关的问题,但我找不到任何与我正在做的事情有关的事情。

4

0 回答 0