[Users] Change order of base layers

Andreas Hocevar ahocevar at opengeo.org
Fri Jan 28 13:33:03 CET 2011


On Jan 28, 2011, at 13:30 , Vidal, Antoni wrote:

> Hi Andreas,
> 
> It doesn't work, the layers order is the same and map is not show. My actual MapPanel configuration:
> 
> {
> 	xtype: "gx_mappanel",
> 	map: map,
> 	layers: layerStore
> }
> 
> Any suggestion?

Not without knowing your map object. I'd suggest to let the MapPanel auto-create the map, like in my snippet, and not create a LayerStore manually, also like in my snippet.

Andreas.

> 
> Thanks.
> 
> Toni.
> 
> -----Missatge original-----
> De: Andreas Hocevar [mailto:ahocevar at opengeo.org] 
> Enviat: viernes, 28 de enero de 2011 13:17
> Per a: Vidal, Antoni
> A/c: users at geoext.org
> Tema: Re: [Users] Change order of base layers
> 
> Hey,
> 
> all you have to do is configure your OpenLayers.Map with {allOverlays: false}.
> 
> Also, note that you don't need to create a LayerStore if you're working with a GeoExt.MapPanel. Just configure the MapPanel's layers property with the result from createLayers.
> 
> So your mapPanel configuration could look like this:
> 
> {
>    xtype: "gx_mappanel",
>    map: {allOverlays: false},
>    layers: createLayers()
> }
> 
> Regards,
> Andreas.
> 
> On Jan 28, 2011, at 13:07 , Vidal, Antoni wrote:
> 
>> 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
>> Parc de Montjuïc, E-08038 Barcelona
>> Tel. (+34) 93 567 15 00 (ext. 3228)
>> www.icc.cat
>> 
>> _______________________________________________
>> Users mailing list
>> Users at geoext.org
>> http://www.geoext.org/cgi-bin/mailman/listinfo/users
> 
> 
> 
> -- 
> Andreas Hocevar
> OpenGeo - http://opengeo.org/
> Expert service straight from the developers.
> 
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users

-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.



More information about the Users mailing list