[OpenLayers-Users] How do you represent multiple layers

Matt Priour mpriour at kestrelcomputer.com
Tue Feb 12 17:40:52 EST 2008


Actually that is not a very good idea and bad coding practice.
Your problem was including {layers:'basic'} the word basic is not some variable relating to type or styule of layers it is an actual layer name in the example WMS. Instead of "basic" you should have your layer names listed there. So your code should be:
var loadedMap = new OpenLayers.Layer.MapServer( "OpenLayers WMS",
"http://localhost:8085/cgi-bin/mapserv.exe?",
{map: '/ms4w/apps/app/test.map', mode:'map', format: 'png',
transparent:'false', layers: 'states_poly','states_line'},
{gutter: 15});

 hope that helps
Matt Priour

A variation on your theme worked. I put the multiple layers in the URL

this 
http://localhost:8085/cgi-bin/mapserv.exe?map=/ms4w/apps/app/test.map&layer=states_poly&layer=states_line&mode=map

seems to equal this

var loadedMap = new OpenLayers.Layer.MapServer( "OpenLayers WMS",
"http://localhost:8085/cgi-bin/mapserv.exe?layer=states_poly&layer=states_line",
{map: '/ms4w/apps/app/test.map', mode:'map', format: 'png',
transparent:'false'},
 {layers: 'basic'},
{gutter: 15});

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20080212/c4903765/attachment.html


More information about the Users mailing list