I'm pretty new with Leaflet and have a basic question: I added this pop-up to my loaded GeoJSON file according to Leaflet, but it won't work.
Any hint?
// load external GeoJSON file
var nonregWash = $.getJSON("../assets/NonRegulatoryWashes.geojson", function (data) {
// create GeoJSON layer and add it to the map
L.geoJson(data, {
style: function (feature) {
switch (true) {
case feature.properties.Name.includes('Non-Regulatory'):
return {
color: "CornflowerBlue", weight: 1
};
case feature.properties.Name.includes('Regulatory'):
return {
color: "DarkBlue", weight: 1
};
default:
return {
color: "Black", weight: 1
};
}
}
}) ** // add popup to the layer**
.bindPopup(function (layer) {
return layer.feature.properties.description;
}).addTo(map);
});
NonRegulatoryWashes.geojson
file contains points, lines or polygons?