[Users] Change order of base layers

Vidal, Antoni antoni.vidal at icc.cat
Fri Jan 28 13:07:44 CET 2011


Hello list,

 

I have two base layers created on the following way:

 

In layout.js:

 

New Ext.viewport({

.....

                    items: [{

                                   title: 'Layers',

                                    xtype: "treepanel",

                                    loader: new Ext.tree.TreeLoader({

                                        applyLoader: false

                                    }),

                                   rootVisible: false,

                                    root: {

                                               children: createChildren()

                                    }

.....

 

Function : createChildren():

 

                var createChildren = function(){

                               return [{

                                                                              "nodeType": "gx_baselayercontainer",

                                                                              "text" : "Base",

                                                                              "expanded": true

                                                               },{

                                                                              "nodeType": "gx_overlaylayercontainer",

                                                                              "text" : "Overlays",

                                                                              "expanded": false

                                                               }]

                };

 

.....

 

        init: function() {

                                               

            var layers = createLayers();

            var layerStore = createLayerStore(map, layers);

.....

 

    var createLayers = function() {

        return [

                                 new OpenLayers.Layer.WMS(

                                   "Topo", "http://server/tilecache/tilecache.py?",

                                               {layers: 'topo', format:"image/jpeg", isBaseLayer: true}

                                 ),

                                 new OpenLayers.Layer.WMS(

                                   "Orto", "http://server/tilecache/tilecache.py?",

                                               {layers: 'orto', format:"image/jpeg", isBaseLayer: false}

                                 ),

......

 

    var createLayerStore = function(map, layers) {

        return new GeoExt.data.LayerStore({

            map: map,

            layers: layers

        });

    };

 

Order showned inside viwer is:

 

Orto (not actived)

Topo (actived)

 

How can I put Topo over Orto and remain active?

 

Thanks in advance.

 

Antoni Vidal

Unitat d'Aplicacions SIG-WEB
Institut Cartogràfic de Catalunya <http://mercuri.icc.cat/website/mob_nf/mob1/mob2/inici2.htm?CONSULTA=Institut%20Cartogr%25E0fic%20de%20Catalunya&XYADDRESS=429486:4580392> 
Parc de Montjuïc, E-08038 Barcelona
Tel. (+34) 93 567 15 00 (ext. 3228)
www.icc.cat <http://www.icc.cat/> 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20110128/6c659b51/attachment.htm 


More information about the Users mailing list