[OpenLayers-Users] layer on/off
Brent Pedersen
bpederse at gmail.com
Sat Oct 4 12:13:33 EDT 2008
or just use:
map.getLayersByName("layername")[0].setVisibility(true)
not sure if that's in 2.6 though.
On Sat, Oct 4, 2008 at 8:40 AM, Nathan Gerber <ngerber999 at gmail.com> wrote:
> 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 <kenny at xarex.com> 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 for free now!
>>
>> The Trial and Professional version does not have this message in the email
>>
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>
>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>
More information about the Users
mailing list