Reputation: 858
I couldn't find any function to activate / desactivate layers ( overlayMaps ) when you click a button.
For example, I'm trying to make a zoom and activate (display) all the layers when a user clicks a button.
Any idea? Thanks.
Upvotes: 1
Views: 2622
Reputation: 11882
Leaflet does not have a concept of active versus inactive layers: you can do one of two things:
addTo
or addLayer
to add it back.The latter option is better, because it won't load tiles from the inactive layer. This is what the Leaflet layer control does as well behind the scenes.
Upvotes: 2