gpt4 book ai didi

使用 geojson 功能的传单 .bindLabel

转载 作者:行者123 更新时间:2023-12-03 23:19:19 37 4
gpt4 key购买 nike

我是传单的新手,我想为源自 geojson 格式的点 map 特征添加标签。

我收到错误:TypeError:layer.bindLabel 不是此脚本中的函数 https://jsfiddle.net/gfiske/ksx600sn/35/ (取消注释第 129 行)

任何人都可以提出解决方法或更好的方法吗?

谢谢。

geojsonLayer = L.geoJson(geojson, {


style: function(feature) {
return {
color: feature.properties.GPSUserColor
};
},
pointToLayer: function(feature, latlng) {
return new L.CircleMarker(latlng, {
radius: 7,
fillOpacity: 0.75
});
},
onEachFeature: function(feature, layer) {
layer.bindPopup(feature.properties.MAP_LABEL);
layer.bindLabel(feature.properties.MAP_LABEL);
}
});

最佳答案

来自 Leaflet.label 的文档:

NOTE: starting with Leaflet 1.0, L.Label is added to Leaflet core as L.Tooltip and this plugin is deprecrated.



您应该使用 bindTooltip 反而:

onEachFeature: function(feature, layer) {
layer.bindPopup(feature.properties.MAP_LABEL);
layer.bindTooltip(feature.properties.MAP_LABEL);
}

关于使用 geojson 功能的传单 .bindLabel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41726844/

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