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

Özgür Arslan ozgurarslan81 at hotmail.com
Mon Apr 9 16:00:37 EDT 2012





     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>

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20120409/34796807/attachment.html


More information about the mapserver-users mailing list