Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
zzolo CreditAttribution: zzolo commentedThe 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/
Comment #2
sebgranel CreditAttribution: sebgranel commentedThe 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.
Comment #3
tmcw CreditAttribution: tmcw commentedLayerSwitcher 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.
Comment #4
sebgranel CreditAttribution: sebgranel commentedThank you tmcw I effectively was setting visibility false on the Vector.RootContainer layer and thats why the problem hapened.