[OpenLayers-Users] How do you represent multiple layers

Matt Priour mpriour at kestrelcomputer.com
Wed Feb 13 21:54:27 EST 2008


Arnd is correct about the layer name list being enclosed in a single string. 
sorry for any confusion.

The "OpenLayers WMS" or "OpenLayers Mapserver" is simply a label for the 
layer in the layer switch box and should actually probably be something more 
meaningful that either of these titles.

Matt Priour

--------------------------------------------------
From: "Arnd Wippermann" <arnd.wippermann at web.de>
Sent: Wednesday, February 13, 2008 4:38 PM
To: "'Matt Priour'" <mpriour at kestrelcomputer.com>
Cc: <users at openlayers.org>
Subject: AW: [OpenLayers-Users] How do you represent multiple layers

> 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