Ozgur,<div><br></div><div>Change the STATUS to ON at the mapfile, and the Venkar suggestion probably will works.</div><div>The DEFAULT at STATUS make the layer allways visible. And the ON make then visible at LAYER declararion.</div>
<div><br></div><div>My regards,<br clear="all"><img src="http://globalgeo.com.br/assinaturas/fernando.gif"><br><br>
<br><br><div class="gmail_quote">2012/4/9 Venkat Shesu Reddem <span dir="ltr"><<a href="mailto:venkat.shesu@gmail.com">venkat.shesu@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Sorry for previous mail.<br><br>layer1 = new OpenLayers.Layer.WMS( "QGIS-MAP","<a href="http://localhost/cgi-bin/mapserv.exe" target="_blank">http://localhost/cgi-bin/mapserv.exe</a>", {layers: 'ResidentDistrict_2011',map: '/wwwroot/example1_test/Canada_Mountains.map',} )<br>
<br>layer2 = new OpenLayers.Layer.WMS( "QGIS-MAP","<a href="http://localhost/cgi-bin/mapserv.exe" target="_blank">http://localhost/cgi-bin/mapserv.exe</a>", {layers: 'LAKES',map: '/wwwroot/example1_test/Canada_Mountains.map',} )<br>
<br>layer3 = new OpenLayers.Layer.WMS( "QGIS-MAP","<a href="http://localhost/cgi-bin/mapserv.exe" target="_blank">http://localhost/cgi-bin/mapserv.exe</a>", {layers: 'MDI_2011',map: '/wwwroot/example1_test/Canada_Mountains.map',} )<br>
<br>map.addLayers([layer1,layer2,layer3]);<br><br>with regards<span class="HOEnZb"><font color="#888888"><br>Venkat</font></span><div class="HOEnZb"><div class="h5"><br><br><br><div class="gmail_quote">On Mon, Apr 9, 2012 at 9:51 AM, Venkat Shesu Reddem <span dir="ltr"><<a href="mailto:venkat.shesu@gmail.com" target="_blank">venkat.shesu@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear Friend,<br><br>This may be help you.<br>..................<br>.................<br>layer = new OpenLayers.Layer.WMS( "QGIS-MAP","<a href="http://localhost/cgi-bin/mapserv.exe" target="_blank">http://localhost/cgi-bin/mapserv.exe</a>", {layers: 'ResidentDistrict_2011',map: '/wwwroot/example1_test/Canada_Mountains.map',} )<br>
<br>layer = new OpenLayers.Layer.WMS( "QGIS-MAP","<a href="http://localhost/cgi-bin/mapserv.exe" target="_blank">http://localhost/cgi-bin/mapserv.exe</a>", {layers: 'LAKES',map: '/wwwroot/example1_test/Canada_Mountains.map',} )<br>
<br>layer = new OpenLayers.Layer.WMS( "QGIS-MAP","<a href="http://localhost/cgi-bin/mapserv.exe" target="_blank">http://localhost/cgi-bin/mapserv.exe</a>", {layers: 'MDI_2011',map: '/wwwroot/example1_test/Canada_Mountains.map',} )<br>
<br>map.addLayers([ResidentDistrict_2011, LAKES, MDI_2011]);<br><br>...................<br>..................<br><br>with regards<br>Venkat<br><br><div class="gmail_quote"><div><div>On Mon, Apr 9, 2012 at 9:44 AM, Özgür Arslan <span dir="ltr"><<a href="mailto:ozgurarslan81@hotmail.com" target="_blank">ozgurarslan81@hotmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>
<div><div dir="ltr">
HI All,<span style="display:block"><span></span> </span><br>
<br>
I am working on open layers and map file and I have a question. I am
trying to create several layers from 1 map file on open layers, and I
want to switch off and on but I couldn't separate the layers in
OpenLayers. When I set layers to DEFAULT in map file it displays all
layers together like a one layer. I can't create different layers from
one map file. Are there any ideas? Codes are below;<br>
<br>
Thank you<br><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> var 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,MDI_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> </div></div>
<br></div></div>_______________________________________________<br>
mapserver-users mailing list<br>
<a href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>
<br></blockquote></div><br>
</blockquote></div><br>
</div></div><br>_______________________________________________<br>
mapserver-users mailing list<br>
<a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>
<br></blockquote></div><br></div>