我仅将MarkerCluster用于* .geojson文件中的数据的一些标记(带有“ Kame”符号的摄像机):
function MarkerStyle(feature, latlng) {
if (feature.properties.markerSymbol == null) {
return L.marker(latlng).addTo(map);
} else {
var Ikon = feature.properties.markerSymbol.substring(0, 4);
switch (Ikon) {
case "none":
var myIcon = L.divIcon({
className: feature.properties.className, // zur Textausgabe
html: feature.properties.text
});
return L.marker(latlng, { icon: myIcon }).addTo(map);
break;
case "Kame":
var POI = L.marker(latlng, {
icon: L.icon({
iconUrl: "../img/".concat(feature.properties.markerSymbol),
iconAnchor: [32, 32]
})
});
var url = feature.properties.popupImage;
POI.on("click", function(e) {
BildZeigen(url, "Freifläche", 452, 802, 450, 800);
});
return POI.addTo(markers);
break;
default:
return L.marker(latlng, {
icon: L.icon({
iconUrl: feature.properties.markerSymbol,
className: feature.properties.className
})
}).addTo(map);
break;
}
}
}
在放大和缩小到相同级别时,为什么标记的分组不同?为什么标记图标显示在聚类圆的附近? 请参阅[https://aachen-hat-energie.de/sonne/freiflaechenbild.htm]上的地图。也许我的标记太大了(64x64像素)?
粗鲁,眨眼
答案 0 :(得分:0)
感谢您整理代码,对不起,哑巴。
我现在发现了错误:“ Kame”案例不应该返回标记,而是:
case "Kame":
var POI = L.marker(latlng, {
icon: L.icon({
iconUrl: "../img/".concat(feature.properties.markerSymbol),
iconAnchor: [32, 32]
})
});
var url = feature.properties.popupImage;
POI.on("click", function(e) {
BildZeigen(url, "Freifläche", 452, 802, 450, 800);
});
POI.addTo(markers);
return;
break;