如何在mapboxgl集群中显示弹出窗口和标记的详细信息?
我尝试了以下链接 我想在集群上添加弹出窗口,并将所有集群数据显示为HTML。我可以看到弹出窗口,但是弹出窗口内容没有定义如何在mapboxgl集群中显示弹出窗口和标记的详细信息?,mapbox,mapbox-gl-js,mapbox-gl,mapbox-marker,Mapbox,Mapbox Gl Js,Mapbox Gl,Mapbox Marker,我尝试了以下链接 我想在集群上添加弹出窗口,并将所有集群数据显示为HTML。我可以看到弹出窗口,但是弹出窗口内容没有定义 map.on('click', 'cluster', function (e) { let description = ""; for(let i = 0; i < e.features.length; i++) { description = description + e.features[i].properties.descripti
map.on('click', 'cluster', function (e) {
let description = "";
for(let i = 0; i < e.features.length; i++) {
description = description + e.features[i].properties.description;
if(i != e.features.length - 1) {
description = description + "</br>";
}
}
new mapboxgl.Popup()
.setLngLat(e.features[0].geometry.coordinates)
.setHTML(description )
.addTo(map);
});
map.on('click','cluster',函数(e){
让描述=”;
for(设i=0;i”;
}
}
新建mapboxgl.Popup()
.setLngLat(e.features[0].geometry.coordinates)
.setHTML(说明)
.addTo(地图);
});
在此处找到解决方案:
var my_marker = L.marker([my_lat, my_lng], {icon: my_icon})
.addTo(map)
.bindPopup('My Popup HTML', {closeOnClick: false, autoClose: false})**