[OpenLayers-Users] Display WMS layer depending on ZoomLevel

Paul Googlemail paulcurran9 at googlemail.com
Wed Oct 28 09:27:33 EDT 2009


Thanks for the response. Has this worked for you with status of layer  
set to DEFAULT or ON?

Cheers

Sent from my iPhone

On 27 Oct 2009, at 18:00, "Arnd Wippermann" <arnd.wippermann at web.de>  
wrote:

> Hi,
>
> you have added minZoomLevel and maxZoomLevel to the params or your  
> WMS layer. params are used for building the WMS request. Move them  
> to the options of your WMS layer and perhaps it works. I use  
> minScale and maxScale to control the display of layers.
>
> {  gutter:15,
>    minZoomLevel : 5,
>    maxZoomLevel : 10
>    //minScale : 1000000,
>    //maxScale : 45000
> }
> Arnd
> Von: users-bounces at openlayers.org [mailto:users- 
> bounces at openlayers.org] Im Auftrag von Paul Curran
> Gesendet: Dienstag, 27. Oktober 2009 16:08
> An: users at openlayers.org
> Betreff: [OpenLayers-Users] Display WMS layer depending on ZoomLevel
>
> 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/20091028/fcbbd14f/attachment.html


More information about the Users mailing list