[OpenLayers-Users] How do you represent multiple layers
Arnd Wippermann
arnd.wippermann at web.de
Wed Feb 13 17:38:55 EST 2008
Hi,
i would think, it must look
layers:'states_poly,states_line' as one string.
Also I would suggest, because it is a MapServer layer the title should be
OpenLayers Mapserver.
Mit freundlichen Grüssen
Arnd Wippermann
http://gis.ibbeck.de/ginfo/
________________________________
Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von Matt Priour
Gesendet: Dienstag, 12. Februar 2008 23:41
An: users at openlayers.org
Betreff: Re: [OpenLayers-Users] How do you represent multiple layers
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?
<http://localhost:8085/cgi-bin/mapserv.exe?layer=states_poly&layer=states_li
ne> ",
{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
<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_li
ne
<http://localhost:8085/cgi-bin/mapserv.exe?layer=states_poly&layer=states_li
ne> ",
{map: '/ms4w/apps/app/test.map', mode:'map', format: 'png',
transparent:'false'},
{layers: 'basic'},
{gutter: 15});
Thanks!
More information about the Users
mailing list