[OpenLayers-Users] Toggle visibility of baselayer
Robert Buckley
robertdbuckley at yahoo.com
Wed Feb 22 05:23:01 EST 2012
Hi,
In my app I am automatically changing the baselayer according to zoomlevel as follows...
function mapEvent(event) {
ZoomLev = map.getZoom();
switch(ZoomLev){
case 0:
if(map.BaseLayer!=layer_5mil){map.setBaseLayer(layer_5mil);}
break;
case 1:
if(map.BaseLayer!=layer_5mil){map.setBaseLayer(layer_5mil);}
break;
case 2:
if(map.BaseLayer!=layer_500){map.setBaseLayer(layer_500);}
break;
case 3:
if(map.BaseLayer!=layer_500){map.setBaseLayer(layer_500);}
break;
case 4:
if(map.BaseLayer!=tk_100){map.setBaseLayer(tk_100);}
break;
case 5:
if(map.BaseLayer!=tk_100){map.setBaseLayer(tk_100);}
break;
case 6:
if(map.BaseLayer!=tk_50){map.setBaseLayer(tk_50);}
break;
case 7:
if(map.BaseLayer!=tk_25){map.setBaseLayer(tk_25);}
break;
case 8:
if(map.BaseLayer!=tk_10){map.setBaseLayer(tk_10);}
break;
}
}
What I need to do now is toggle the visibility of the current basemap so the user can turn off base layer...ie just have a white basemap. I have tried various methods including using this...
action = new GeoExt.Action({
icon: 'images/tick.png',
map: map,
tooltip: {
title: 'turn baselayer off'
},
handler: function () {
var map = Ext.getCmp("mapPanel");
mapPanel.map.setBaseLayer(emptymap);
}
});
but the map will not change to leer.
can anyone see what I could do?,
yours,
Rob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120222/454c7038/attachment-0001.html
More information about the Users
mailing list