[OpenLayers-Users] display specific layer from mapfile

Paul Curran paulcurran9 at googlemail.com
Tue Sep 8 06:32:47 EDT 2009


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090908/c0f3fec0/attachment.html


More information about the Users mailing list