[OpenLayers-Users] Layer Switcher Outside of Map Window

Marjie Anderson marjiea1 at gmail.com
Tue May 25 14:10:53 EDT 2010


If I understand what you want correctly, this is shown in the examples.  

 

I used it in my project (demo here):  http://marjie.info/map/

 

In the javascript, after initialiazing your map:

 

map.addControl(new OpenLayers.Control.LayerSwitcher(

                { 'div': OpenLayers.Util.getElement('right') }));

 

In the html:

 

<div id="right" class="olControlLayerSwitcher"></div>

 

You will probably want to override the ControlLayerSwitcher style in your CSS as well.

 

-          Marjie

 

From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] On Behalf Of Tonton
Sent: Tuesday, May 25, 2010 6:26 AM
To: users at openlayers.org
Subject: [OpenLayers-Users] [openlayers users]

 

hello 

i would like to have a layers switcher in external of the map box.

is it possible to use OL for or is it necessary to use a other JS library with



i thing about something like that 

</script>
 function valider()
{  var valeur = document.choisir.nomdeCouche;

    for (var i=1;i < valeur.length; i++)
    {    if ( valeur[i].checked )
        {   map.layerContainerDiv.children([valeur[i].value].setvisible=true);
    }   else {map.layerContainerDiv.children([valeur[i].value]).setvisible=false;}
  }
}</script>

 <FORM form id='choisir' name='choisir' method=get action="javascript:void(0);" onSubmit="valider(); return false;">
<input id="wms1" name="nomdeCouche" type="checkbox"  value="wms1"><br>
<input id="wms2" name="nomdeCouche" type="checkbox" value="wms2"><br>
<input id="wms3" name="nomdeCouche" type="checkbox" value="wms3"><br>
<input id="wms4" name="nomdeCouche" type="checkbox" value="wms4"><br>
<input type="submit" value="ajouter" >
                        </FORM>

thanks for your comments

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100525/4dc823c0/attachment.html


More information about the Users mailing list