[Users] How can I enabe, check node and change the visibility of basemaps with zoomlevel?

Robert Buckley robertdbuckley at yahoo.com
Tue Feb 21 14:50:39 CET 2012


Hi,

I am trying to turn off my basemaps according to the current zoom level....ie for zoom levels over 6 show,enable and check "layer_0", otherwise show,enable and check "layer_1"

<code>
map.events.on({
        "zoomend": function (e) {
            if (this.getZoom() >6) {

                layerTree.getRootNode().findChild('layer', layer_0, true).disable();
layer_0.setVisibility(false);
layerTree.getRootNode().findChild('layer',  layer_0 , true).checked==false; 

            } else {

                layerTree.getRootNode().findChild('layer', layer_1, true).disable();
layer_1.setVisibility(true);
                layerTree.getRootNode().findChild('layer',  layer_1 , true).checked==true;             
                
                
            }
        }
    });


The problems are as follows...

1. The nodes do not "check"

2. The disable method works ok, but when I zoom out again the layer still remains visible but does not zoom?!?


Has anyone done this successfully and can show me how?


yours,

Rob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20120221/0e1447c7/attachment.htm 


More information about the Users mailing list