Previous topic

Aggregate layer

Next topic

LegendWindow

This Page

TreePanelΒΆ

The TreePanel widget is the classical layers tree.

Hide code
<script type="text/javascript">
function init() {
      var map14 = new GeoAdmin.Map();
      var mappane14 = new GeoAdmin.MapPanel({renderTo: "mymap4", map:map14, width: 500, height:340});
                  mappane14.map.addLayer(GeoAdmin.layers.buildLayerByName('ch.bafu.bundesinventare-auen'));


 var model = [{
                 text: OpenLayers.i18n("Umwelt, Biologie und Geologie"),
                 expanded: true,
                 children: [
                     {
                         text: OpenLayers.i18n("Schutzgebiete"),
                         expanded: true,
                         children: [
                            {layerType: "wmts", layer: 'ch.bafu.bundesinventare-auen'}]
                     }
                 ]
         }];

 var treePanel = new GeoAdmin.TreePanel({
     model: model,
     title: "Treepanel",
     layerStore: mappane14.layers,
     renderTo: 'mytreepanel4'
 });
 }
</script>
<body onload="init();">
  <div id="mymap4" style="width:400px;height:340px;border:1px solid grey;padding: 0 0 0 0;margin:10px !important;"></div>
  <script type="text/javascript" src="https://api.geo.admin.ch/loader.js"></script>
</body>