Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent auto loading KMZ layers on map until user clicks on related L.Control.Layer checkbox #41

Open
kg6uyz opened this issue Jul 13, 2024 · 1 comment

Comments

@kg6uyz
Copy link

kg6uyz commented Jul 13, 2024

Is there a way to load the list of KMZ's but not auto load the KMZ's onto the map until a user clicks one of the check mark boxes?

@Raruto
Copy link
Owner

Raruto commented Jul 15, 2024

L.Control.Layers follows the state of the level:

var kmz = L.kmzLayer().addTo(map);

  1. You can remove them individually as soon as they are loaded (eg. e.layer.remove()):

kmz.on('load', function(e) {
control.addOverlay(e.layer, e.name);
// e.layer.addTo(map);
});

  1. or, simply avoid adding the parent layer to the map (ie. kmz.addTo(map)):

var kmz = L.kmzLayer().addTo(map);

@Raruto Raruto changed the title Auto Load list but not the KMZ until a user clicks the check mark box? Prevent auto loading KMZ layers on map until user clicks on related L.Control.Layer checkbox Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants