leaflet esri 添加label
Posted googlegis
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了leaflet esri 添加label相关的知识,希望对你有一定的参考价值。
var labels = {};
earthquakes.on(‘createfeature‘, function (e) {
var id = e.feature.id;
var feature = earthquakes.getFeature(id);
var center = feature.getLatLng();
var label = L.marker(center, {
icon: L.divIcon({
iconSize: null,
className: ‘label‘,
html: ‘<div>‘ + e.feature.properties.name + ‘</div>‘
})
}).addTo(map);
labels[id] = label;
});
earthquakes.on(‘addfeature‘, function (e) {
var label = labels[e.feature.id];
if (label) {
label.addTo(map);
}
});
earthquakes.on(‘removefeature‘, function (e) {
var label = labels[e.feature.id];
if (label) {
map.removeLayer(label);
}
});
以上是关于leaflet esri 添加label的主要内容,如果未能解决你的问题,请参考以下文章
leaflet+esri-leaflet+heatmap实现热力图