[OpenLayers-Users] add, remove base layers depending on zoom, change baselayer

Maria Panagou snowdrop at ath.forthnet.gr
Mon Jan 14 15:17:38 EST 2008


thanks for you idea. I managed to set these options correctly upon creating
the layers e.g:

var satellite = new OpenLayers.Layer.Google( "Google Satellite" , {type:
G_SATELLITE_MAP, MIN_ZOOM_LEVEL: 7, maxExtent:extent,
displayInLayerSwitcher: false, visible: false} );

but how do i change these properties later? i tried the following

 map.events.register("zoomend", map, function() {
			if (map.getZoom()>0) {
			    satellite.displayInLayerSwitcher: true;
			    satellite.visible: true});
                            map.setBaseLayer(satellite);
          		    } 
			else 
			{
			satellite.displayInLayerSwitcher: false;
			satellite.visible: false});
                        map.setBaseLayer(nomoi);
          	} 
		   });

but it doesn't work...


Attila Csipa wrote:
> 
> On Sunday 13 January 2008 19:47:14 Maria Panagou wrote:
>> I'm trying to display a different base layer, depending on zoom levels. I
>> use the following code:
> 
> My first idea would be to put all layers that are referenced (regardless
> of 
> zoom level) in my map and then just change their properties to hide/show
> the 
> ones that are applicable to the given zoom level. See the 
> Layer.displayInLayerSwitcher and Layer.visible properties.
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> 

-- 
View this message in context: http://www.nabble.com/add%2C-remove-base-layers-depending-on-zoom%2C-change-baselayer-tp14789355p14812392.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list