Leaflet layers on different zoom levels. How?
okay. I would go like this:
map.on('zoomend', function() {
var zoomlevel = map.getZoom();
if (zoomlevel <10){
if (map.hasLayer(points)) {
map.removeLayer(points);
} else {
console.log("no point layer active");
}
}
if (zoomlevel >= 10){
if (map.hasLayer(points)){
console.log("layer already added");
} else {
map.addLayer(points);
}
}
console.log("Current Zoom Level =" + zoomlevel)
});