Hi all, I have to display near to 40 layers on a map so I couldn't use the layer switcher because there is no scroll. I add a javascript tree to the page and when a layer is checked in the tree, I do a setVisibility(true) to the concern layer. The problem is after that layers are not moving at the same speed than the baseLayer. I tried using the layer switcher (even if I can't select all the layers) and it works there is no problem. So can you help me? Is the layer switcher doing more than a setVisibility?

PS : I tried to use the open layers mailing list but I have no response.

Comments

zzolo’s picture

The OpenLayers examples are pretty good. Not sure if there is one that does exactly what you want:
http://openlayers.org/dev/examples/
http://openlayers.org/dev/examples/layerswitcher.html

Either way, you'll have to create a new behavior for this. You might want to look at Managing News as well, since there is a custom layer switcher in there, I believe.
http://managingnews.com/

sebgranel’s picture

The only thing I want is to be able to switch On/Off Layers (what layer switcher exactly do) but with 40 layers the layer switcher is more than 900px height so some layers are impossible to enable. Finally I use dynatree to switch between layers but the setVisibility method seem to cause a bug and I wanted to know what layerswitcher do to use that instead of setVisibility.

tmcw’s picture

LayerSwitcher only calls setVisibility as far as I can see. You will run into weird cases if your LayerSwitcher replacement calls setVisibility or remove on all layers except those checked - there's an invisible Vector.RootContainer layer added to all maps with multiple Vector layers, and if removed, it'll cause very odd map behavior.

sebgranel’s picture

Status: Active » Closed (fixed)

Thank you tmcw I effectively was setting visibility false on the Vector.RootContainer layer and thats why the problem hapened.