[OpenLayers-Users] Display specific layer from mapfile

Arnd Wippermann arnd.wippermann at web.de
Tue Sep 8 17:34:03 EDT 2009


Hi,
 
from your code both layers should be baselayers. That means only one layer
would displayed. That seems, that in your mapfile both layers have status
default.
 
Arnd

  _____  

Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von Paul Curran
Gesendet: Dienstag, 8. September 2009 23:10
An: users at openlayers.org
Betreff: [OpenLayers-Users] Display specific layer from mapfile



Hi,
 
I am having trouble displaying a specific layer from my mapfile. I have two
layers called '250' and 'uk'. I wish to display my '250' layer origninally,
then zoom closer to display my 'uk' layer. however both my layers are
currenlty displayed at all times.
 
Am i going about this the correct way by having two variables 'layer1 and
'layer2' for layers from the same mapfile?
 
Currently my code is as follows
 
var bounds = new OpenLayers.Bounds(0, 0, 660046, 1229782);
var map, layer1, layer2;
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: "250", map:
'/ms4w/apps/openlayers-2.8/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: "uk", map:
'/ms4w/apps/openlayers-2.8/data/uk2.map', minZoomLevel: 5, maxZoomLevel: 10
},
      { gutter: 15 });
 
map.addLayer(layer1, layer2);
 
Thanks for any help in advance


Paul

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090908/89e756d7/attachment.html


More information about the Users mailing list