Leaflet geojson点数据标记未在传单地图中聚集

Leaflet geojson点数据标记未在传单地图中聚集,leaflet,geojson,markerclusterer,Leaflet,Geojson,Markerclusterer,我正在使用传单markercluster插件对我的点数据进行聚类。我已经将名为“street”的geojson数据加载到地图中。该数据具有大约40个点及其各自的属性。我想把这些点集中在传单地图上。但我的地图上甚至没有标记。请帮我找出错误。我的代码在这里: var OpenStreetMap_Mapnik = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { maxZoom: 19, attrib

我正在使用传单markercluster插件对我的点数据进行聚类。我已经将名为“street”的geojson数据加载到地图中。该数据具有大约40个点及其各自的属性。我想把这些点集中在传单地图上。但我的地图上甚至没有标记。请帮我找出错误。我的代码在这里:

var OpenStreetMap_Mapnik = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
    maxZoom: 19,
    attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);

var street = {...my_geojson_data...}

var s_light_style = {
    radius: 8,
    fillColor: "#ff7800",
    color: "#000",
    weight: 1,
    opacity: 1,
    fillOpacity: 0.8
};


var markers = L.markerClusterGroup();
L.geoJSON(street, {
    onEachFeature : function(feature, layer){
        var popupContent =  '<h4 class = "text-primary">Street Light</h4>' +
                            '<div class="container"><table class="table table-striped">' +
                            '<thead><tr><th>Properties</th><th>Value</th></tr></thead>' +
                            '<tbody><tr><td> Name </td><td>'+ feature.properties.Name +'</td></tr>' +
                            '<tr><td>Elevation </td><td>' + feature.properties.ele +'</td></tr>' +
                            '<tr><td> Power (watt) </td><td>' + feature.properties.Power_Watt + '</td></tr>' +
                            '<tr><td> Pole Height </td><td>' + feature.properties.pole_hgt + '</td></tr>' +
                            '<tr><td> Time </td><td>' + feature.properties.time + '</td></tr>';
        layer.bindPopup(popupContent)
    },
    pointToLayer: function (feature, latlng) {
        return markers.addLayer(L.marker(latlng))  
    }
}).map.addTo(markers);
var OpenStreetMap_Mapnik=L.tillelayer('https://{s}.tile.OpenStreetMap.org/{z}/{x}/{y}.png'{
maxZoom:19,
属性:“©;贡献者”
}).addTo(地图);
var street={…我的地理数据…}
变量s_灯光_样式={
半径:8,
fillColor:#ff7800“,
颜色:“000”,
体重:1,
不透明度:1,
填充不透明度:0.8
};
var markers=L.markerClusterGroup();
L.geoJSON(街{
onEachFeature:功能(功能,图层){
var popupContent=‘路灯’+
'' +
“属性值”+
“Name”+feature.properties.Name+“”+
“标高”+feature.properties.ele+“”+
“功率(瓦特)”加上feature.properties.Power_瓦特”+
“电杆高度”+feature.properties.Pole_hgt+“”+
“时间”+feature.properties.Time+“”;
layer.bindPopup(popupContent)
},
pointToLayer:功能(特性、latlng){
返回标记。添加图层(L标记(latlng))
}
}).map.addTo(标记);
将代码替换为

L.geoJSON(street, {
    onEachFeature : function(feature, layer){
        var popupContent =  '<h4 class = "text-primary">Street Light</h4>' +
                            '<div class="container"><table class="table table-striped">' +
                            '<thead><tr><th>Properties</th><th>Value</th></tr></thead>' +
                            '<tbody><tr><td> Name </td><td>'+ feature.properties.Name +'</td></tr>' +
                            '<tr><td>Elevation </td><td>' + feature.properties.ele +'</td></tr>' +
                            '<tr><td> Power (watt) </td><td>' + feature.properties.Power_Watt + '</td></tr>' +
                            '<tr><td> Pole Height </td><td>' + feature.properties.pole_hgt + '</td></tr>' +
                            '<tr><td> Time </td><td>' + feature.properties.time + '</td></tr>';
        layer.bindPopup(popupContent)
    },
    pointToLayer: function (feature, latlng) {
        return markers.addLayer(L.circleMarker(latlng, s_light_style))
    }
})
map.addLayer(markers);
L.geoJSON(街道、{
onEachFeature:功能(功能,图层){
var popupContent=‘路灯’+
'' +
“属性值”+
“Name”+feature.properties.Name+“”+
“标高”+feature.properties.ele+“”+
“功率(瓦特)”加上feature.properties.Power_瓦特”+
“电杆高度”+feature.properties.Pole_hgt+“”+
“时间”+feature.properties.Time+“”;
layer.bindPopup(popupContent)
},
pointToLayer:功能(特性、latlng){
返回标记。添加层(L.circleMarker(latlng,s_light_样式))
}
})
添加图层(标记);
在上面的代码中,我指定了map.addTo(markers)。但实际上我必须用“addLayer”替换“addTo”关键字。我必须添加图层。通过这种方式,我解决了geojson markerCluster问题