3
  layer_gesamt = new OpenLayers.Layer.WMS(
            "Geoserver layers - Tiled", "http://mygeoserver/xyz/wms",
                {
                    LAYERS: 'myLayer',
                    STYLES: '',
                    format:  'image/png',
                    transparent: true,
                    tiled: true,
                    tilesOrigin : map.maxExtent.left + ',' + map.maxExtent.bottom,
                },
                {
                    buffer: 0,
                    displayOutsideMaxExtent: false,
                    isBaseLayer: true,
                    yx : {epsg : true}
                } 

          );
  layer_gesamt.setVisibility(false);


  map.addLayers([
     layer_gesamt,
     layer_selectable,
                 ]);
  map.setCenter(config.init_center.getCenterLonLat(),config.init_zoom);

I want the layer_gesamt in the example NOT to be displayed, but to be loaded. That's why I set layer_gesamt.setVisibility(false);. However, the layer is still displayed. What can I do?

3
  • 1
    Welcome to the GIS.SE. Can you give us a little more detail to help us answer your question? For example, what software and software version are you using? Thanks. Oct 2, 2014 at 11:56
  • 1
    Thank you! OpenLayers Version Numer: Release 2.14, GeoServer Version 2.4.4
    – Lokomotywa
    Oct 2, 2014 at 12:03
  • Browser: Firefox 30.0
    – Lokomotywa
    Oct 2, 2014 at 12:08

2 Answers 2

1

What I found out: It works, when I create a new base layer and set the parameter layer_gesamt.isBaseLayer = false.

0

You are setting the Visibility BEFORE you add the layer to the Map so it has no effect ....

Try this ..

layer_gesamt = new OpenLayers.Layer.WMS(
        "Geoserver layers - Tiled", "http://mygeoserver/xyz/wms",
            {
                LAYERS: 'myLayer',
                STYLES: '',
                format:  'image/png',
                transparent: true,
                tiled: true,
                tilesOrigin : map.maxExtent.left + ',' + map.maxExtent.bottom,
            },
            {
                buffer: 0,
                displayOutsideMaxExtent: false,
                isBaseLayer: true,
                yx : {epsg : true}
            } 

      );

map.addLayers([
 layer_gesamt,
 layer_selectable,
             ]);

layer_gesamt.setVisibility(false);

map.setCenter(config.init_center.getCenterLonLat(),config.init_zoom);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.