[Users] Customizing Layer Trees and Layer Nodes

IT Intern itintern12 at gmail.com
Wed Sep 22 19:30:33 CEST 2010


Hello GeoExt List,

I am new to GeoExt and so far I am very grateful that such a library is out
there.  I have made a map browser and now I want to have a customized layer
panel.  I have somewhat a grasp on how to create general layer trees, but
I'd like to be able to customize mine as much as possible.  I am not sure if
it's because such options do not exist or if I am just unaware.

Here's a list of what I'd like to do:

1.  I'd like to be able to have a few variables for my layers as so:

          var tib_townships = new OpenLayers.Layer.WMS(
                            "Townships (Tibetan trans)", "
http://10.0.102.11:8080/geoserver/wms", {layers: 'cite:tib_townships',
transparent: true}, {isBaseLayer: false, displayInLayerSwitcher: true,
visibility: true}
                       );

            var chn_villages = new OpenLayers.Layer.WMS(
                            "Villages (Chinese trans)", "
http://10.0.102.11:8080/geoserver/wms", {layers: 'cite:chn_villages',
transparent: true}, {isBaseLayer: false, displayInLayerSwitcher: true,
visibility: false}
                       );

            var tib_villages = new OpenLayers.Layer.WMS(
                            "Villages (Tibetan trans)", "
http://10.0.102.11:8080/geoserver/wms", {layers: 'cite:tib_villages',
transparent: true}, {isBaseLayer: false, displayInLayerSwitcher: true,
visibility: true}
                       );

and then create this layernode to house these layers

var layerRoot = new Ext.tree.TreeNode({
                text: "All Layers",
                expanded: true
                });

                layerRoot.appendChild(new GeoExt.tree.BaseLayerContainer({
                text: "Base Layers",
                map: map,
                expanded: true
                }));

                layerRoot.appendChild(new GeoExt.tree.LayerNode({
                text: "Tibetan Villages",
                layer: tib_villages,
                loader: {param: "LAYERS"},
                expanded: true
                }));
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20100922/07538e58/attachment.htm 


More information about the Users mailing list