[OpenLayers-Users] (LayerSwitcher) How I get all activated layers?

Christopher Schmidt crschmidt at metacarta.com
Fri Feb 16 08:35:13 EST 2007


On Fri, Feb 16, 2007 at 12:00:44AM -0800, Thomas Zuberb??hler wrote:
> 
> Hey there
> 
> How can I get all activated layers at runtime? I am using LayerSwitcher. 	
> I assume that encase the variables (baseLayerInputs and dataLayerInputs)
> this information. Is that correct? 

The best way to do this is probably:

 for(i=0; i < map.layers.length; i++) { 
   if (map.layers.getVisibility()) {
     // record the layer information you need into some
     // variable
   }
 }

Does that answer your question?

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list