I have added some layer(s) and a base layer using OpenLayers v 2.11, layer does not appear when it first opened the page, but after zoom out it does appear. Why is behaving in this way, are there any parameteres for always visible?

var map = new OpenLayers.Map("map");
var wms = new OpenLayers.Layer.Google("Google Streets", {
                numZoomLevels: 12
var wms2 = new OpenLayers.Layer.WMS("Basic1", "http://localhost:8080/geoserver/wms",
               layers: 'SomeLayers',
               transparent: true,
               numZoomLevels: 12
           }, {
               isBaseLayer: false
var ls = new OpenLayers.Control.LayerSwitcher();
map.addControl(new OpenLayers.Control.ZoomBox());

map.setCenter(lonlat, 6);
  • you have to define numZoomLevels in the isBaseLayer section as numZoomLevels is openlayers options paremeters not wms getmap parameter. – neogeomat Jun 19 '14 at 4:08
  • Nice i'll post it as answer – neogeomat Jun 19 '14 at 11:40

A openlayers wms layer has 4 parameters name (string), url (string), getMap params (everything inside first {}), options params (everything inside second{})

numZoomLevels is openlayers options parameter not wms getmap parameter. so it should be with the isBaseLayer option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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