[OpenLayers-Users] Layer not checked in LayerSwitcher

Andreas Hocevar ahocevar at opengeo.org
Thu Sep 3 09:04:38 EDT 2009


Hi,

Maren Kiehl wrote:
> I have some Layers in my OpenLayers-map as overlaysThe problem is they 
> shouldn't be checked in the LayerSwitcher by loading the map.
> That's how I tried it, but without success:
>
> var wms = new OpenLayers.Layer.WMS.Untiled(
>                     "Plan 1924",
>                     
> "http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/osnamap/includes/wms.map",
>                     {visibility:false, isBaseLayer:false, transparent: 
> true, layers: 'plan1924'}
>                 );
>
> Could anybody tell me how to switch the layer of?
>   

The Layer.WMS constructor takes 4 arguments: name, url, params and
options. visibility:false and isBaseLayer:false have to go in the
options (4rd) argument:

var wms = new OpenLayers.Layer.WMS.Untiled(
    "Plan 1924",
    "http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/osnamap/includes/wms.map",
    {transparent: true, layers: 'plan1924'},
    {isBaseLayer: false, visibility: false}
);


Regards,
Andreas.

-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.




More information about the Users mailing list