[Users] Layertree with different sublayers

gbrun gbrun at myopera.com
Mon Sep 26 15:54:51 CEST 2011


Hi!

A tip that may help: maybe there is an easier way to do what you want.

You can create a treePanel by using the  
"GeoExt.tree.WMSCapabilitiesLoader" class. Then, in GeoServer, you can  
fill in the "default WMS path" field of each layer:  
http://docs.geoserver.org/stable/en/user/webadmin/data/layers.html

This field allows GeoServer to create a hierarchy in the WMS Capabilities  
document of your GeoServer. Then, this hierarchy is identified by the  
treePanel, that creates automatically themes and sub-themes.

Geoffrey



Le Mon, 26 Sep 2011 15:18:18 +0200, Kathrin Babiker <k.babiker at gmx.de> a  
écrit:

> Hi,
> I need an idea to build a layertree with consists not only of baselayers
> and overlaylayers but also of different sublayers like this:
> 1 - background
> 2 - theme 1
>    2-1 theme 1 subpoint A
>        2-1-1 subsubpoint A-a
>        2-1-2 subsubpoint A-b
>        2-1-3 subsubpoint A-c
>   2-2 theme 1 subpoint B
>       2-2-1 subsubpoint B-a
>       2-2-2 subsubpoint B-b
> 3 - theme 2
>   3-1 theme 2 subpoint A
> ...
> I mean it should look like a folder structure we know from our own PC.
>
> I tried a layout (taken from tree.js from geoext) with OpenLayers, GeoExt
> and ExtJS but the structure is not going deep enough. The layers at
> subsubpoints should come from geoserver.
>
>
> My code is like this:
>
> var treeConfig = new OpenLayers.Format.JSON().write([{
>         nodeType: "gx_baselayercontainer"
>     }, {
>         nodeType: "gx_overlaylayercontainer",
>         expanded: true,
>         // render the nodes inside this container with a radio
> button,
>         // and assign them the group "foo".
>         loader: {
>             baseAttrs: {
>                 radioGroup: "foo",
>                 uiProvider: "layernodeui"
>             }
>         }
>     }, {
>         nodeType: "gx_layer",
>         layer: "Europäische Union (Gruppe)",
>         isLeaf: false,
>         // create subnodes for the layers in the LAYERS param. If we
> assign
>         // a loader to a LayerNode and do not provide a loader
> class, a
>         // LayerParamLoader will be assumed.
>         loader: {
>             param: "LAYERS"
>         }
>     }], true);
>
>     // create the tree with the configuration from above
>     tree = new Ext.tree.TreePanel({
>         border: true,
>         region: "west",
>         title: "Ebenen",
>         width: 200,
>         split: true,
>         collapsible: true,
>         collapseMode: "mini",
>         autoScroll: true,
>
>         loader: new Ext.tree.TreeLoader({
>             // applyLoader has to be set to false to not
> interfer with loaders
>             // of nodes further down the tree hierarchy
>             applyLoader: false,
>             uiProviders: {
>                 "layernodeui": LayerNodeUI
>             }
>         }),
>         root: {
>             nodeType: "async",
>             // the children property of an
> Ext.tree.AsyncTreeNode is used to
>             // provide an initial set of layer nodes. We use the
> treeConfig
>             // from above, that we created with
> OpenLayers.Format.JSON.write.
>             children: Ext.decode(treeConfig)
>         },
>
>         rootVisible: false,
>         lines: false
>
>     });
>
> Is there anyone who can help me? There MUST be any possibility to get  
> well
> structured tree, or?!
> Thanks
> Kathrin
>


-- 
-- 
Geoffrey BRUN

Étudiant en master SIGMA
Stagiaire au PNR du Haut-Languedoc

Hameau de Brassac
Saint-Pons de Thomières
+33 (0) 6 77 74 44 16


More information about the Users mailing list