Good day! I was reading one of @ocefpaf 's post and stumbled upon this. https://ocefpaf.github.io/python4oceanographers/blog/2015/03/23/wms_layers/ . How can I make a layer group unchecked on load like the example given on the post? Thanks!
That is a bug we introduced in the latest version that needs fixing. (PRs welcomed :wink:)
Can we have this as a feature? Haha Add a parameter to a layer group that will determine if it is checked/unchecked on load? Like here, on the Programmatic Display section: https://rstudio.github.io/leaflet/showhide.html. I'll try to tinker around this. Thanks!
I tried two different implementations for a default visibility setting for overlays:
Add this functionality to class LayerControl by accepting a list with names of overlays to hide on load. This works fine, but you have to remember which layers you want to hide until adding layer control.
Add a hide parameter to class Layer. Then each child class would also need to accept this extra parameter.
Both end up being used in the template in class LayerControl. I add a layer_object.remove(); line for each layer that should be hidden by default.
I'm new to this scene and didn't find any guidelines so please advice on how to proceed.
I am more inclined to solution number 2.
Allright, I'll make a WIP pull request later for you to see. I'll wait with adding this to all the classes until we're sure this is the way to go.
I was going through the issues and noticed this functionality is the same as asked for in #571.
Most helpful comment
Can we have this as a feature? Haha Add a parameter to a layer group that will determine if it is checked/unchecked on load? Like here, on the Programmatic Display section: https://rstudio.github.io/leaflet/showhide.html. I'll try to tinker around this. Thanks!