I am new to leaflet and I'd like to add labels to my point map features derived from geojson format.
I am getting the error: TypeError: layer.bindLabel is not a function in this script https://jsfiddle.net/gfiske/ksx600sn/35/ (uncomment line 129)
Can anyone suggest a workaround or a better approach?
thanks.
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);
}
});
From the documentation for Leaflet.label
:
NOTE: starting with Leaflet 1.0, L.Label is added to Leaflet core as L.Tooltip and this plugin is deprecrated.
You should use bindTooltip
instead:
onEachFeature: function(feature, layer) {
layer.bindPopup(feature.properties.MAP_LABEL);
layer.bindTooltip(feature.properties.MAP_LABEL);
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments