I need to use a GeoJSON Layer on my Leaflet map. Here is a sample of my code:
function onEachFeature(feature, layer) {
if (feature.properties && feature.properties.popupContent) {
layer.bindPopup(feature.properties.popupContent);
}
}
myGeoJsonLayer = L.geoJson(data, {
pointToLayer: function (feature, latlng) {
return L.circleMarker(latlng, geojsonMarkerOptions);
},
onEachFeature: onEachFeature
});
myGeoJsonLayer.addTo(map);
TOC.addOverlay(myGeoJsonLayer, "My GeoJSON Layer");
All is working.
Now I'd like to add an attribution on my layer but how?
Best Answer
Copied from the answer on Stack Overflow here: https://stackoverflow.com/questions/25664516/leaflet-how-to-add-an-attribution-on-a-geojson-layer
Quote:
The example js code provided is: