[OpenLayers-Users] displayInLayerSwitcher option

Erik Uzureau erik.uzureau at metacarta.com
Fri Apr 27 11:15:00 EDT 2007


Actually, I think the problem is that you are passing displayInLayerSwitcher
as a parameter istead of as an option. The parameter values get added to the
WMS request string, whereas the options values get added to the javascript
layer object itself. Maybe give this a try:

var params = {
    'layers': "mylayer",
    'format': "'image/png"
};
var options = {
    'displayInLayerSwitcher': false,
    'isBaseLayer': false
};
var myvar= new OpenLayers.Layer.WMS( "Mylayername",
                                                                           "
http://mywmsserver/wms?",

params,

options);

On 4/27/07, Eric Lemoine <Eric.Lemoine at camptocamp.com> wrote:
>
> On 4/27/07, andy <aborruso at tin.it> wrote:
> > Hi all,
> > another stupid question. I would like to hide a layer in the
> > layerswitcher. I know I can use displayInLayerSwitcher option, but
> > probably my lack of javascript knowledge is too big.
> >
> > I have tried with unsuccess with this kind of syntax (openlayers 2.3):
> > "var myvar= new OpenLayers.Layer.WMS( "Mylayername",
> > "http://mywmsserver/wms?", {layers: 'mylayer', format:
> > 'image/png',displayInLayerSwitcher: 'false'},{isBaseLayer: false});"
> >
> > Which is the right way to hide a layer from LayerSwitcher?
> >
> > Thank you for all your dev and support job,
>
> Hi Andy,
>
> Try removing the quotes around false, in the same way as isBaseLayer.
>
>
> --
> Eric Lemoine
>
> Camptocamp France SAS
> Savoie Technolac, BP 352
> 73377 Le Bourget du Lac, Cedex
>
> Tel : 00 33 4 79 44 44 96
> Mail : eric.lemoine at camptocamp.com
> http://www.camptocamp.com
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20070427/5b3d0903/attachment.html


More information about the Users mailing list