[OpenLayers-Users] setVisibility VS visibility:false

Alexandre Dube adube at mapgears.com
Thu Jan 29 15:17:04 EST 2009


Sorry, I meant only on layer creation only.  I see in some examples this 
kind of practice :

        var twms = new OpenLayers.Layer.WMS("base_world",
            "http://world.freemap.in/cgi-bin/mapserv?",
            {
                map: '/www/freemap.in/world/map/factbooktrans.map',
                layers: 'factbook',
                format: 'image/png'
            }
        );
        twms.setVisibility(false);
        map.addLayer(twms);

... insead of using {visibility:false}. I guess there's no particular 
reason for that or did someone had an issue using {visibility:false} ?


Eric Lemoine wrote:
> On Thu, Jan 29, 2009 at 9:00 PM, Alexandre Dube <adube at mapgears.com> wrote:
>   
>> Hi list,
>>
>>  Is there a difference between layer.setVisibility(false) and the
>> {visibility:false} option directly specified in the layer ?  Is one a
>> better practice than the other ?
>>     
>
> You'll use setVisibility if you need to change the visibility after
> the layer creation, when some button is clicked for example.
>
> --
> Eric
>   


-- 
Alexandre Dubé
Mapgears
www.mapgears.com




More information about the Users mailing list