[OpenLayers-Users] Create/Destroy Layers or Show/Hide

bartvde at osgis.nl bartvde at osgis.nl
Tue Jun 3 04:58:36 EDT 2008


You need to iterate over the map.layers array.

The number of layers: map.layers.length

Best regards,
Bart

On Tue, 3 Jun 2008 04:49:55 -0400, "Levii Smith" <smithlev at levii.com>
wrote:
> 
> 
> I need to have a custom layerswitcher [radio buttons, etc], and am
> having a hard time finding examples on modifying layer visibility or
> creating layers on the fly. So I have 2 questions. 
> 
> How do I determine the number of current layers? 
> 
> Given a layer I just created by clicking a checkbox (or one that
> already existed)...how do I grab the layer to modify visibility? 
> 
> OpenLayers.Layer.[layername].setVisibility(true); doesn't work since
> it says the layer doesn't exist. 
> 
> Thanks,
> Levii




More information about the Users mailing list