I am new to Leaflet and recently did a course on using Leaflet to make maps. I followed the instructions to implement leaflet marker cluster, but, when trying to extract data to fill the popup from my GeoJSON, each popup contains the same data.
While the marker clustering works very well and picks up all the point sin the GeoJSON, the data going into there popup is always the same!
The code I have used looks like this:
var markers = L.markerClusterGroup({
showCoverageOnHover: false,
});
json.features.forEach(function (feature) {
markers
.addLayer(
L.marker([
feature.geometry.coordinates[1],
feature.geometry.coordinates[0],
])
)
.bindPopup(feature.properties.Name);
});
map.addLayer(markers);
How can I get the relevant info onto each popup?