gpt4 book ai didi

mapbox - 如何在 mapboxgl 集群中显示弹出窗口和标记的详细信息?

转载 作者:行者123 更新时间:2023-12-05 07:42:00 25 4
gpt4 key购买 nike

我尝试了以下链接 example

我想在集群上添加弹出窗口并将所有集群数据显示为 HTML。我可以看到弹出窗口,但弹出内容未定义。

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);

});

最佳答案

解决方法在这里: https://stackoverflow.com/a/47715517

var my_marker = L.marker([my_lat, my_lng], {icon: my_icon})
.addTo(map)
.bindPopup('My Popup HTML', {closeOnClick: false, autoClose: false})**

关于mapbox - 如何在 mapboxgl 集群中显示弹出窗口和标记的详细信息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44940508/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com