I am working on a map and I would like to remove all features from the map on a certain event. The features are in multiple layers which are plotted dynamically.
Som
You can use the following truthy check to see if it's a valid geoJSON object:
map.eachLayer(function(layer) { if (!!layer.toGeoJSON) { map.removeLayer(layer); } });