I use the following code to accomplish this exact thing:

layerName = display name of the layer you wish to turn on or off
layerBoolean = true/false where true is on.

function mapLayerActivateDeactivate(layerName, layerBoolean) {
        var layerArray = map.layers;
        for (var i=0;i<layerArray.length;i++) {
                if (map.layers[i].name == layerName) {
                        map.layers[i].setVisibility(layerBoolean);
                }
        }
}


--
Nathan Gerber


On Fri, Oct 3, 2008 at 1:30 PM, Kenny <[EMAIL PROTECTED]> wrote:

>  Hi All,
>
>
>
> Is it possible (example) to "turn" a layer on / off without using the
> layers switcher on the map?
>
>
>
> I mean if I have a marker layer I can click a link and display / hide a
> specific layer?
>
>
>
> Thanks
>
>
>
> K-
>
>
>
> ------------------------------
> I am using the Free version of SPAMfighter for Personal use.
> SPAMfighter has removed 2722 of my spam emails to date.
> Try SPAMfighter <http://www.spamfighter.com/len> for free now!
>
> The Trial and Professional version does not have this message in the email
>
> _______________________________________________
> Users mailing list
> [email protected]
> http://openlayers.org/mailman/listinfo/users
>
>
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to