OpenLayers disable specific overlays by default


I have been using OpenLayers Wrapper addon and have added serveral layers.

vectorLayer = new VectorLayer();

stationLayer = new VectorLayer();
addLayer(stationLayer );

The thing is, my wish is to unselect (checkbox) the stationLayer by default, by saying its not its base layer.

I have seen that the LayerSwitcher is responsible for enableing/disableing overlays.
My question is, does anyone have an idea how to access this javascript function or have a code example?

Things i have tried on a layer:

-setEnabled : no effect
-setVisible: (ofcourse not showing the layer at all like the name says :blink:)


The enabled flag could be indeed be used in the OpenLayers built-in layer selector. It is just now hooked on the client side. Would you fill a ticket to the project page so we won’t forget this issue.

I have by myself not really used the layer selector, but built my own with core Vaadin component and then just removed/added the layer to map component with the server side API. Table or ListSelect works fine for this kind of “workaround”.



Thanks for looking at the issue.
Filled a ticket @
link to the issue page

Also, i saw that you added a new labelvector in the new openlayer version.
Funny thing is , we needed it so badly , so we constructed one based on the current zoom which did its job.
Early thing this morning we saw the update in openlayers, developers over here were @#!! (just kidding :D).

Will try it out in a couple of days, better be using a function that is supported :grin:
Thanks again,