<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
Fernando,<span id="toBoxTo" style="display: block;"><span class="BlockEmailNoName">fernando@globalgeo.com.br      </span></span><span id="toBoxCc" style="display: block;"><span class="BlockEmailNoName">mapserver-users@lists.osgeo.org</span></span><br><br>Thanks for your respond I really appreciate it.  Also yes I am using   map.addControl(new OpenLayers.Control.LayerSwitcher());  <br>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? <br><br>My html file is below:<br><br>Thanks again.<br><br><!-- MapServer Template --><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="http://openlayers.org/api/OpenLayers.js"></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>        var zoom = 6;<br>        var map, layer;<br>         <br>        map = new OpenLayers.Map( 'map' );<br>        layer1 = new OpenLayers.Layer.WMS( "QGIS-MAP1", <br>                    "http://localhost/cgi-bin/mapserv.exe", {layers: 'ResidentDistrict_2011',map: '/wwwroot/Example/Mountains.map'},<br>                    {gutter: 15});<br>                    <br>        layer2 = new OpenLayers.Layer.WMS( "QGIS-MAP2", <br>                    "http://localhost/cgi-bin/mapserv.exe", {layers: 'bDI_2011_GOLD',map: '/wwwroot/Example_test/Mountains.map'},<br>                    {gutter: 15});            <br>        map.addLayer(layer1, layer2);<br><br>        map.zoomToMaxExtent();  <br>        map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);<br>        <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>        <br>      </script><br><br></body><br></html><br><br><br><div><div id="SkyDrivePlaceholder"></div><hr id="stopSpelling">Date: Mon, 9 Apr 2012 17:18:22 -0300<br>Subject: Re: [mapserver-users] RE: mapserver-users Digest, Vol 51, Issue 11<br>From: fernando@globalgeo.com.br<br>To: ozgurarslan81@hotmail.com<br>CC: mapserver-users@lists.osgeo.org<br><br>Ozgur,<div><br></div><div>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? </div>
<div><br></div><div>In the openlayers.layer.wms you can set this as not a base layer, as options.. after {}, { isBaseLayer: false }</div><div>But remember a base layer need to exist, and there is a way to include a 'blank' layer as base layer.</div>
<div><br></div><div>Good luck,<br clear="all"><img src="http://globalgeo.com.br/assinaturas/fernando.gif"><br><br>
<br><br><div class="ecxgmail_quote">2012/4/9 Özgür Arslan <span dir="ltr"><<a href="mailto:ozgurarslan81@hotmail.com">ozgurarslan81@hotmail.com</a>></span><br><blockquote class="ecxgmail_quote" style="border-left:1px #ccc solid;padding-left:1ex">



<div><div dir="ltr">



<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 color="#C00000">map.addLayers([layer1,layer2,layer3]);</font> to <font 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>> <a href="http://localhost/cgi-bin/mapserv.exe" target="_blank">http://localhost/cgi-bin/mapserv.exe</a>", {layers:<br>> 'ResidentDistrict_2011',map:<br>
> '/wwwroot/example1_test/Canada_Mountains.map',} )<br>><br>> layer2 = 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: 'LAKES',map:<br>
> '/wwwroot/example1_test/Canada_Mountains.map',} )<br>><br>> layer3 = 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: '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></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></div>                                       </div></body>
</html>