<html>
<head>
</head>
<body class='hmmessage'><div dir='ltr'>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
<div dir="ltr"> Hi ALL,<br><br>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.<br><pre>Furthermore when I change the layer orders from <font style="" color="#C00000">map.addLayers([layer1,layer2,layer3]);</font> to <font style="" color="#FF0000">map.addLayers([layer2,layer1,layer3]);</font> this time it only shows <br>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?<br><br>Thank you<br><br> <br>layer1 = new OpenLayers.Layer.WMS( "QGIS-MAP","<br>> http://localhost/cgi-bin/mapserv.exe", {layers:<br>> 'ResidentDistrict_2011',map:<br>> '/wwwroot/example1_test/Canada_Mountains.map',} )<br>><br>> layer2 = new OpenLayers.Layer.WMS( "QGIS-MAP","<br>> http://localhost/cgi-bin/mapserv.exe", {layers: 'LAKES',map:<br>> '/wwwroot/example1_test/Canada_Mountains.map',} )<br>><br>> layer3 = new OpenLayers.Layer.WMS( "QGIS-MAP","<br>> http://localhost/cgi-bin/mapserv.exe", {layers: 'BDI_2011',map:<br>> '/wwwroot/example1_test/Canada_Mountains.map',} )<br>><br>> map.addLayers([layer1,layer2,layer3]);<br><br><br><u>here are the html codes</u><br><br><br><html><br><head><br> <title>OpenLayers Example</title><br> <link rel="stylesheet" href="openlayers/theme/default/style.css" type="text/css"><br>
<script src="<a href="http://openlayers.org/api/OpenLayers.js" target="_blank">http://openlayers.org/api/OpenLayers.js</a>"></script><br> </head><br> <body><br> <center><div id="map"></div></center><br>
<style><br> @media screen<br> {<br> #map{width:975px; height:750px; border: 2px solid black;}<br> }<br> </style><br> <script defer="defer" type="text/javascript"><br>
var lon = -84.722147;<br> var lat = 49.298594; <br> <br> var zoom = 6;<br> var map, layer;<br> <br> map = new OpenLayers.Map('map');<br> layer = new OpenLayers.Layer.WMS( "QGIS-MAP",<br>
"<a href="http://localhost/cgi-bin/mapserv.exe" target="_blank">http://localhost/cgi-bin/mapserv.exe</a>", {layers: 'ResidentDistrict_2011,LAKES,BDI_2011',map: '/wwwroot/example1_test/Canada_Mountains.map',} )<br>
<br> map.addLayer(layer);<br> map.zoomToMaxExtent(); <br> map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);<br> <br> map.addControl(new OpenLayers.Control.PanZoomBar());<br>
map.addControl(new OpenLayers.Control.MouseToolbar());<br> map.addControl(new OpenLayers.Control.LayerSwitcher());<br> map.addControl(new OpenLayers.Control.MousePosition());<br> map.addControl(new OpenLayers.Control.OverviewMap());<br>
</script><br><br></body><br></html><br></pre></div>
</div></body>
</html>