1

I have created a WMS layer in geoserver. I have added that WMS layer using openlayers and geoext. The WMS layer is displaying, but when I zoom in, the layer disappears and when zoomed out the layer is again visible as a dot.

My code is:

 new OpenLayers.Layer.WMS("Layers",
                "http://localhost:8080/geoserver/cite/wms",
                {
                    "LAYERS":'layer1',
                   srs:'EPSG:3857',
                   transparent: true,
                    format: "image/png"
                }, 

                {
                    isBaseLayer: false,

                    buffer: 0,
                    // exclude this layer from layer container nodes
                    displayInLayerSwitcher: false,
                    visibility: false
                }
            )
1
  • can you tell the zoom level on which the layer disappears? May 13, 2016 at 5:30

1 Answer 1

1

You can use a maxExtent for your map. In combination with a 3rd-party background-layer this can prevent the problem you described.

var extent = new OpenLayers.Bounds(-2003750.34, -2003750.34, 2003750.34, 2003750.34);

map = new OpenLayers.Map("map", {
        maxExtent: extent
});
3
  • Hi thanks for your reply.I have tried your code but i am facing the same problem.
    – user46218
    May 13, 2016 at 16:59
  • Can you post more of your code (especially map initialization and baselayers)?
    – Thomas B
    May 13, 2016 at 17:21
  • Thank you . your code i working fine. before i have added extent inside the layer, so it didnt worked. Now it is working.
    – user46218
    May 13, 2016 at 17:43

Your Answer

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

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