[OpenLayers-Users] Display WMS layer depending on ZoomLevel

Paul Curran paulcurran9 at googlemail.com
Tue Oct 27 11:07:51 EDT 2009


Hello i need your help.

I currently have two layers. i would like to display one layer initially
then zoom in closer and display the second layer. I have been trying to do
it like this:

var options = { maxExtent: bounds, maxResolution: 600, numZoomLevels: 10};

layer1 = new OpenLayers.Layer.WMS("OpenLayers WMS",
"http://127.0.0.1/cgi-bin/mapserv.exe?", { layers: "uk", map:
'/ms4w/apps/openlayers-2.5/data/uk2.map',
minZoomLevel: 1, maxZoomLevel: 4 },
      { gutter: 15 });


layer2 = new OpenLayers.Layer.WMS("OpenLayers WMS",
"http://127.0.0.1/cgi-bin/mapserv.exe?", { layers: "UK250", map:
'/ms4w/apps/openlayers-2.5/data/uk2.map',
minZoomLevel: 5, maxZoomLevel: 10},
      { gutter: 15 });

      map.addLayer(Layer1, Layer2);
      map.zoomToExtent(bounds);
      map.setCenter(bounds);
      map.zoomToMaxExtent();

My main problem is i can only display a layer when status is DEFAULT within
mapfile however i cannot hide the layer if set to this. When Set to ON the
layer is not displayed atall.

Any help much appreciated

Cheers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20091027/b0899b2d/attachment.html


More information about the Users mailing list