I know you can use a loader with a filter to specify which layer you do not want to append to a container<br><br>new GeoExt.tree.OverlayLayerContainer({<br>            text: text,<br>            layerStore: layerStore,<br>
            expanded: true,<br>            iconCls: iconCls,  //If not specified, defaults to original image<br>            loader:{<br>                filter: function(record) {<br>                    //return record.get(&quot;layer&quot;).name.indexOf(&quot;Tasmania&quot;) !== -1 This code means attach any layers with &quot;Tasmania&quot; in their name, notice the the (!== -1)<br>
                    return record.get(&quot;layer&quot;).name.indexOf(&quot;Photos&quot;) == -1 &amp;&amp; record.get(&quot;layer&quot;).name.indexOf(&quot;OpenLayers.Handler.Polygon&quot;) == -1 &amp;&amp; record.get(&quot;layer&quot;).name.indexOf(&quot;OpenLayers.Handler.Path&quot;) == -1; This code means do NOT take any layers with &quot;Photos&quot;, &quot;OpenLayers.Handler.Polygon&quot;, or &quot;OpenLayers.Handler.Path&quot; in their name notice the (== -1)<br>
                }<br>            }<br>        })<br><br><br>Hope this help you somehow<br><br>Happy Mapping,<br><br>elshae<br><br><br><div class="gmail_quote">On Tue, Jan 18, 2011 at 4:09 AM, Robert Buckley <span dir="ltr">&lt;<a href="mailto:robertdbuckley@yahoo.com">robertdbuckley@yahoo.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div style="font-family: arial,helvetica,sans-serif; font-size: 8pt;">Hi,<br><br>I have defined a treepanel which has child elements which work as data folders for wms layers....<br>
I have added a grid which lists the other layers on my server (from the getcapabilities doc) and adds them to the map . <br><br>I have successfully achieved this, but am having the problem that the newly added layers from the window are being assigned to <span style="font-weight: bold;">each and every</span> root.child. <br>
<br>To solve this, I would like to add the layers from the gecapabilities doc grid to a new root.child called &quot;MyLayers&quot;.<br><br>My logic is this.....II need to then write code to firstly check if the root.child with an id&quot; MyLayers&quot; exists, and if not... create it, and then add any layers to this child.<br>
<br>Is this possible? and how?<br><br><br>My Code...<br><br><div><span style="color: rgb(255, 0, 0);">// Layer root container</span><br><br>    var layerRoot = new Ext.tree.TreeNode({<br>          text: &quot;Karteninhalt&quot;,<br>
          expanded:false<br><br>        });<br><br><span style="color: rgb(255, 0, 127);">// These are the content layer stores</span><br><br>// Baselayers<br>    var layerListBase = new GeoExt.tree.BaseLayerContainer({<br>
          text: &quot;&lt;span class=&#39;TreeHeader&#39;&gt;Hintergrundkarten&lt;/span&gt;&quot;,<br>          map: map,<br>          expanded: false<br><br>    });<br><br>// Layer Stores - Nachrichtlich<br>    var nachrichtlich_store = new GeoExt.data.LayerStore({<br>
        text:
 &quot;Grenzen&quot;,<br>        map:map,<br>        initDir: 0,<br>        layers:[Grenzen]<br>    });<br><br>    // Layer Stores - WIND<br>    var wea_store = new GeoExt.data.LayerStore({<br>        text: &quot;Windenergie&quot;,<br>
        map:map,<br>        initDir: 0,<br>        layers:[layer_windpotential,layer_wea_f,layer_wea]<br>    });<br><br><span style="color: rgb(255, 0, 0);">// the tree is made here</span><br><br>layerRoot.appendChild(layerListBase);<br>
<br>    layerRoot.appendChild(new GeoExt.tree.OverlayLayerContainer({<br>        text: &quot;&lt;span class=&#39;TreeHeader&#39;&gt;Nachrichtlich&lt;/span&gt;&quot;,<br>        layerStore:
 nachrichtlich_store,<br>        expanded: false<br>        })<br>    );<br><br>    layerRoot.appendChild(new GeoExt.tree.OverlayLayerContainer({<br>        text: &quot;&lt;span class=&#39;TreeHeader&#39;&gt;Windenergie&lt;/span&gt;&quot;,<br>
        layerStore: wea_store,<br>        expanded: false<br>        })<br>    );<br><br><br>...the extract from the button in the grid which adds the layers from the getcapabilities doc...<br><br>bbar: [new Ext.Button({<br>
                 text: &quot;Layer hinzuf&amp;uuml;gen&quot;,<br>                 tooltip : &#39;Layer hinzuf&amp;uuml;gen&#39;,<br>       
          handler: function() {<br><br>                // select layer from grid<br>                    capabilitiesgrid.getSelectionModel().each(function(record) {<br>                     var clone = record.clone();<br>
                     clone.get(&quot;layer&quot;).mergeNewParams({<br>                        format: &quot;image/png&quot;,<br>                         transparent: true<br>   
                  });            <br><br>            // add layer to map<br>            mapPanel.layers.add(clone);<br>                       <br>            if(node) {<br>            var node = tree.getNodeById(&#39;MyLayers&#39;); <br>
            tree.node.add(node,clone);<br><br>            }<br>        <br>                //  zoom to nely added layer<br>   
     var bounds = new OpenLayers.Bounds.fromArray(clone.get(&quot;llbbox&quot;))<br>        bounds.transform(epsg4326, map.getProjectionObject());<br>        map.zoomToExtent(bounds)<br>        <br>                <br>            });<br>
        }<br>        })<br>        ,<br><br><br>Thanks for any help,<br><br><br>Robert<br><br><br><br><br><br><br><br><br></div>
</div><br></div><br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@geoext.org">Users@geoext.org</a><br>
<a href="http://www.geoext.org/cgi-bin/mailman/listinfo/users" target="_blank">http://www.geoext.org/cgi-bin/mailman/listinfo/users</a><br>
<br></blockquote></div><br>