OpenLayer : Overlays(LayerSwitcher) imitation in client side


I tried switching layers thru a list of checkboxes instead of the LayerSwitcher.
i used map.removeLayer() and map.addLayer() on each checkbox click.
I tried to use layer.setVisible(false) but nothing changed the layer is still visible.
The solution is working fine by removing layers, but in each layer i have approximately 4000 Vector point, which is taking lots of time to draw (5 + sec ), but when i use the layer switcher to switch the same layer on off it does it instantly less than 1 sec.
Do you have any idea how can i imitate the layerSwitcher from the client side?

Thanks in advance.


setVisible method should indeed work directly with the OL:s own layer selector, but there is just a small piece of clue code that is missing. Somebody else also just asked for this same feature. You could check if the ticket exists on the project page and “vote” for it.