[mapserver-users] Help

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


Hi all,

Thanks for your respond I really appreciate it.   I am using   map.addControl(new OpenLayers.Control.LayerSwitcher());  
In this Html codes how can I create a second layer by using same map file that I can switch off and on near the base map? 

My html file is below:

Thanks again.

<!-- MapServer Template -->
<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' );
        layer1 = new OpenLayers.Layer.WMS( "QGIS-MAP1", 
                   
 "http://localhost/cgi-bin/mapserv.exe", {layers: 
'ResidentDistrict_2011',map: '/wwwroot/Example/Mountains.map'},
                    {gutter: 15});
                    
        layer2 = new OpenLayers.Layer.WMS( "QGIS-MAP2", 
                   
 "http://localhost/cgi-bin/mapserv.exe", {layers: 'bDI_2011',map: 
'/wwwroot/Example_test/Mountains.map'},
                    {gutter: 15});            
        map.addLayer(layer1, layer2);

        map.zoomToMaxExtent();  
        map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
        
        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/7c17e89e/attachment.html


More information about the mapserver-users mailing list