[OpenLayers-Users] LayerSwitcher

Christopher Schmidt crschmidt at metacarta.com
Mon Feb 26 10:10:57 EST 2007


On Mon, Feb 26, 2007 at 04:06:27PM +0100, Lars Schrader wrote:
> Hi,
> 
> I have got a problem.
> I have a map with two base layers. By using the radio buttons I can switch 
> between the two layers.
> I`m searching for a possibility to readout which base layer is active at the 
> moment. Is there a variable which I can read out by a javascript function?

On the map object, there is a 'baseLayer' property. This is the layer
which is currently the base layer.

On http://openlayers.org:

>>> map.baseLayer.name
"World Map"

You can attach a unique property to your layers if the name isn't enough
information for you to differentiate.

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list