[Users] Loading WMS layer from WMSCapabilities Store

Hugo hfpmartins at gmail.com
Tue Jun 7 11:20:01 CEST 2011


Hello all, once again ;)

Just an update. My problem is just related with correctly loading the layer
as a node in the tree panel. After digging a little bit more i found that
the layer is being added to all containers that have been configured a
specific loader.

For example, having these 2 containers:

var adminLCont = new GeoExt.tree.LayerContainer({
    text: 'Limites Administrativos',
    expanded: true,
    layerStore: adminLStore,
    loader: {
        baseAttrs: {
            radioGroup: 'tematico',
             uiProvider: 'layernodeui',
             iconCls: 'wms'
        }
    }
});

var salBaseCont = new GeoExt.tree.BaseLayerContainer({
    layerStore: salBaseStore,
    text: 'Outra',
    allowDrop: false,
    expanded: true,
});

... the new layer from wmscapabilities store is being added automatically to
the first container and not the second. If i add a loader configuration to
the second container, then the new layer will also be added to the
container.

Is there any property i should define in the loader baseattrs so that thios
situation is avoided?? Altgough i was able to overcome my problem i'm still
interested to know if there is something else that can be defined.

Cheers,
Hugo

On Mon, Jun 6, 2011 at 6:32 PM, Hugo <hfpmartins at gmail.com> wrote:

> Thanks Lucia, for your feedback!
>
> In fact, when testing, the transparency is being requested correctly. I
> think my problem should be related with the isBaseLayer parameter. I think
> this might be issue because whenever i load a layer it is automatically
> added to each of my BaseLayerContainers. Moreover, the tree node is also
> being added to all the overlayconatiners also. The thing i can't understand
> is why is this happening when i specifically define that this new layer
> should be added as a new node into a specific existent tree node.
>
> Any suggestions more?
> Kind regards,
>
> Hugo
>
>
> On Mon, Jun 6, 2011 at 4:48 PM, Morper-Busch, Lucia <
> Lucia.Morper-Busch at sbg.ac.at> wrote:
>
>> Try instead of
>>
>>
>>
>>     layerClone.mergeNewParams({
>>         srs: baseMercator,
>>         format: 'image/png',
>>         transparent: true
>>     },{
>>         isBaseLayer: false,
>>         singleTile: true,
>>         visibility: false
>>     });
>>
>>
>>
>> try this with one curly brace only
>>
>>
>>
>>     layerClone.mergeNewParams({
>>         srs: baseMercator,
>>         format: 'image/png',
>>         transparent: true,
>>
>>         isBaseLayer: false,
>>         singleTile: true,
>>         visibility: false
>>     });
>>
>>
>>
>> My code looks like this:
>>
>>
>>
>> var array = WMSstore.getRange();
>>
>> for(var i = 0 ; i < array.length ;i++){
>>
>> var record = array[i];
>>
>>                 var copy = record.copy();
>>
>>                 copy.data["layer"] = record.getLayer();
>>
>>                 newParams = {
>>
>>                                format: "image/png",
>>
>>                                transparent: "true"
>>
>>                 };
>>
>>                 copy.getLayer().mergeNewParams(newParams);
>>
>>                 map.layers.add(copy);
>>
>> }
>>
>>
>>
>> Hope this helps
>>
>> Lucia
>>
>>
>>
>> *Dipl.-Geogr. Lucia Morper-Busch** | **Researcher***
>>
>> University of Salzburg | Centre for Geoinformatics - Z_GIS
>>
>> Schillerstr.30 | Techno-Z, Block 15, 3rd floor | 5020 Salzburg, Austria
>>
>> Phone +43 (0)662 8044 5298 | Fax +43 (0)662 8044 5260
>>
>> *> Z_GIS…experts for the spatial view <http://www.zgis.at/research>*
>>
>>
>>
>> *Von:* users-bounces at geoext.org [mailto:users-bounces at geoext.org] *Im
>> Auftrag von *Hugo
>> *Gesendet:* Montag, 06. Juni 2011 14:38
>> *An:* users at geoext.org
>> *Betreff:* [Users] Loading WMS layer from WMSCapabilities Store
>>
>>
>>
>> Hello all,
>>
>> I'm having some troubles to add WMS layers from a WMSCapabilities store.
>> The problem is not related with loading the layer itself. The problem i'm
>> facing can be divided into two:
>>
>> 1. When loading the WMS layer there are some parameters that are not being
>> set
>> 2. The layer appears in all the folders and sub-folders of the Tree panel
>> (baselayers and theme layers)
>>
>> About problem one, the layer is loaded but is not transparent as specified
>> in my code. About the second problem, i really don't understand why is this
>> happening once i have configured a sepcific layernode to add to the tree
>> panel.
>>
>> The code i'm using is the following:
>>
>> for (i=0; i<selLayers.length; i++){
>>     var layerClone = selLayers[i].get('layer');
>>     layerClone.mergeNewParams({
>>         srs: baseMercator,
>>         format: 'image/png',
>>         transparent: true
>>     },{
>>         isBaseLayer: false,
>>         singleTile: true,
>>         visibility: false
>>     });
>>
>>     map.addLayer(layerClone);
>>
>>     var addWmsNode = new GeoExt.tree.LayerNode({
>>         layer: layerClone,
>>         text: layerClone.name,
>>         iconCls: 'wms',
>>         leaf: true,
>>         checked: false,
>>         radioGroup: 'tematico',
>>         uiProvider: treeUI
>>     });
>>
>>     userRoot.appendChild(addWmsNode);
>> }
>>
>> What am i missing or doing wrong here?
>> Kind regards,
>>
>> Hugo
>>
>> --
>> Hugo Martins
>> LabNT - ISEGI UNL
>> Campus de Campolide
>> 1070-312 Lisboa
>> N 38°43'56.84", W 9°9'35.74"
>>
>
>
>
> --
> Hugo Martins
> LabNT - ISEGI UNL
> Campus de Campolide
> 1070-312 Lisboa
> N 38°43'56.84", W 9°9'35.74"
>



-- 
Hugo Martins
LabNT - ISEGI UNL
Campus de Campolide
1070-312 Lisboa
N 38°43'56.84", W 9°9'35.74"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20110607/0b3e5320/attachment.htm 


More information about the Users mailing list