[GIS] How to uncheck a layer in LayerSwitcher on map load

openlayers-2

I have four layers in the LayerSwitcher. When the map is loaded all the layers are checked by default. I do not want to show all Layers as checked.How do I uncheck a layer when the map is loaded?

Best Answer

Use the layer's setVisibility function to turn them off before you add them to the map.