[mapserver-users] RE: mapserver-users Digest, Vol 51, Issue 11

Fernando Norte fernando at globalgeo.com.br
Mon Apr 9 16:18:22 EDT 2012


Ozgur,

You said that layers are BASE layers. Base layers can't switch to off an
on, there is only one base layer active, there you can switch between them.
Are you using the OpenLayers.Control.LayerSwitcher, to see the layers?

In the openlayers.layer.wms you can set this as not a base layer, as
options.. after {}, { isBaseLayer: false }
But remember a base layer need to exist, and there is a way to include a
'blank' layer as base layer.

Good luck,




2012/4/9 Özgür Arslan <ozgurarslan81 at hotmail.com>

>       Hi ALL,
>
> Thanks for all responds. I tryed all suggestions and when I use these
> lines it only shows layer1 like a base map and I can't switch off and on. I
> would like create 3 separate layer that I can switch off and on each layer
> individually.
>
> Furthermore when I change the layer orders from map.addLayers([layer1,layer2,layer3]); to map.addLayers([layer2,layer1,layer3]); this time it only shows
> the second layer(layer2) as a base layer and I can't switch off and on. Could you please share your ideas with me about the issue?
>
> Thank you
>
>
> layer1 = new OpenLayers.Layer.WMS( "QGIS-MAP","
> > http://localhost/cgi-bin/mapserv.exe", {layers:
> > 'ResidentDistrict_2011',map:
> > '/wwwroot/example1_test/Canada_Mountains.map',} )
> >
> > layer2 = new OpenLayers.Layer.WMS( "QGIS-MAP","
> > http://localhost/cgi-bin/mapserv.exe", {layers: 'LAKES',map:
> > '/wwwroot/example1_test/Canada_Mountains.map',} )
> >
> > layer3 = new OpenLayers.Layer.WMS( "QGIS-MAP","
> > http://localhost/cgi-bin/mapserv.exe", {layers: 'BDI_2011',map:
> > '/wwwroot/example1_test/Canada_Mountains.map',} )
> >
> > map.addLayers([layer1,layer2,layer3]);
>
>
> *here are the html codes*
>
>
> <html>
> <head>
>   <title>OpenLayers Example</title>
>    <link rel="stylesheet" href="openlayers/theme/default/style.css" type="text/css">
>
>
>     <script src="http://openlayers.org/api/OpenLayers.js"></script>
>     </head>
>     <body>
>       <center><div id="map"></div></center>
>
>
>       <style>
>     @media screen
>     {
>         #map{width:975px; height:750px; border: 2px solid black;}
>     }
>     </style>
>       <script defer="defer" type="text/javascript">
>
>
>         var lon = -84.722147;
>         var lat = 49.298594;
>
>         var zoom = 6;
>         var map, layer;
>
>         map = new OpenLayers.Map('map');
>         layer = new OpenLayers.Layer.WMS( "QGIS-MAP",
>
>
>             "http://localhost/cgi-bin/mapserv.exe", {layers: 'ResidentDistrict_2011,LAKES,BDI_2011',map: '/wwwroot/example1_test/Canada_Mountains.map',} )
>
>
>
>         map.addLayer(layer);
>         map.zoomToMaxExtent();
>         map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
>
>         map.addControl(new OpenLayers.Control.PanZoomBar());
>
>
>         map.addControl(new OpenLayers.Control.MouseToolbar());
>         map.addControl(new OpenLayers.Control.LayerSwitcher());
>         map.addControl(new OpenLayers.Control.MousePosition());
>         map.addControl(new OpenLayers.Control.OverviewMap());
>
>
>       </script>
>
> </body>
> </html>
>
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20120409/c8039f55/attachment.html


More information about the mapserver-users mailing list