[Users] Change order base layers of gx_baselayercontainer

Andreas Hocevar ahocevar at opengeo.org
Fri Apr 29 14:47:20 CEST 2011


Note that there are many different ways to add layers to a
GeoExt.MapPanel, and they differ in the time that the layers are
actually added:

* Layers added to the MapPanel's map object before the MapPanel is
rendered will be added immediately.

* Layers added to the MapPanel's layers store before the MapPanel is
rendered will be added as soon as the MapPanel is rendered.

* Layers added after the MapPanel is rendered will be added immediately.

Also, note that after the BaseLayerContainer is added to the tree, and
if it's still empty, that the first layer added to it will be set to
visible because a radio group in the tree enforces one item to be
visible.

With this knowledge at hand, be advised that you should add your base
layers before the BaseLayerContainer is added to the tree, and you
will be fine.

Andreas.

On Fri, Apr 29, 2011 at 2:11 PM, Vidal, Antoni <antoni.vidal at icc.cat> wrote:
> Hi again,
>
> I get the same result. Topo layer above orto and orto selected by default. My intention is to flip actual order and show first and up "Topo" selected by default. Bellow and seccond, "Orto".
>
>
> My actual code:
>
>
>    var createLayers = function() {
>        return [
>                  new OpenLayers.Layer.WMS(
>                    // Si es canvia el nom de la capa cal canviar on es cerca la capa base per canviar-la amb map.setBaseLayer
>                    lyrOrto, "http://sagitari.icc.cat/tilecache/tilecache.py?",
>                        {layers: 'orto', format:"image/jpeg"},{isBaseLayer: true, visibility: false}
>                  ),
>                  new OpenLayers.Layer.WMS(
>                    lyrTopo, "http://sagitari.icc.cat/tilecache/tilecache.py?",
>                        {layers: 'topo', format:"image/jpeg"},{isBaseLayer: true}
>                  ),
>                .....
>
>
> Thanks.
>
> Toni.
>
> -----Missatge original-----
> De: Sarah Schuessler [mailto:sarah_flip at yahoo.de]
> Enviat: viernes, 29 de abril de 2011 14:01
> Per a: Vidal, Antoni; Andreas Hocevar
> A/c: users at geoext.org
> Tema: AW: [Users] Change order base layers of gx_baselayercontainer
>
> Hi,
>
> Layers.WMS("nameofyourlayerinmap", "urltoyourwms", {layers: "namespace:layer",
> format: "image/png"},{isBaseLayer: true, visibility: true})
>
> HTH
> Sarah
>
>
>
> ----- Ursprüngliche Mail ----
>
> Hi Sarah,
>
> Maybe you can enlighten me. In fact "layers" param doesn't exists in OL docu
> http://dev.openlayers.org/releases/OpenLayers-2.10/doc/apidocs/files/OpenLayers/Layer-js.html
>
>
> What's the correct way?
>
> Thanks in advance.
>
> Toni
>
>
> -----Missatge original-----
> De: Sarah Schuessler [mailto:sarah_flip at yahoo.de]
> Enviat: viernes, 29 de abril de 2011 13:42
> Per a: Vidal, Antoni; Andreas Hocevar
> A/c: users at geoext.org
> Tema: AW: [Users] Change order base layers of gx_baselayercontainer
>
> Hi,
>
> you mixed options and params at your Layer.WMS.
>
> HTH
> Sarah
>
>
>
> ----- Ursprüngliche Mail ----
>
> Hi,
>
> I've done, but the result is the same, and layer continue visible and active.
>
>    var createLayers = function() {
>        return [
>          new OpenLayers.Layer.WMS(
>            lyrOrto, "http://mytilecache.com/tilecache/tilecache.py?",
>            {layers: 'orto', format:"image/jpeg", isBaseLayer: true},
>            {visibility: false}
>          ),
>        ....
>
> Thanks,
>
> Toni.
>
> -----Missatge original-----
> De: andreas.hocevar at gmail.com [mailto:andreas.hocevar at gmail.com] En nom de
> Andreas Hocevar
> Enviat: viernes, 29 de abril de 2011 11:14
> Per a: Vidal, Antoni
> A/c: users at geoext.org
> Tema: Re: [Users] Change order base layers of gx_baselayercontainer
>
> There is currently no option to flip the layer order in
> LayerContainers. You can, however, configure one of your base layers
> with "visibility: false", so it won't be active.
>
> Hope this helps,
> Andreas.
>
> On Tue, Apr 26, 2011 at 6:01 PM, Vidal, Antoni <antoni.vidal at icc.cat> wrote:
>> Hi list,
>>
>>
>>
>> I've two base layers, they are part of a gx_baselayercontainer nodetype
>> inside an Ext.Viewport. These layers are ordered backward that they are
>> created. That's my problem because if I change the order when create the
>> layers, then active layer is not the one I want.
>>
>>
>>
>> Somebody knows how to change the order of base layers in a
>> gx_baselayercontainer?
>>
>>
>>
>> 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