[Users] LayerTree in Drake

Andreas Hocevar ahocevar at opengeo.org
Mon Feb 16 11:38:04 CET 2009


Hi,

now I understand what your use case is. I think it will be good to 
support that in GeoExt. See my comments inline.

Alexandre Dube wrote:
> - I want to have one Openlayer.Layer.WMS object only
> - That layer should contain all "layers" from a mapfile, so 
> params.LAYERS should looks like "foo1,foo2,foo3,etc..."
> - I have so many layers in that mapfile (around 70 I think) that I must 
> find a way to build a tree by :
> GROUP

This is already possible with LayerNode

> LAYER

There is something similar that I have created, but this changes the 
layer's CQL_FILTER param instead of the LAYERS param: a 
FilteredLayerNode [1] instead of a LayerNode for the GROUP, and 
CqlFilterNodes [2] for the LAYERs. If you look at [2], you see that only 
two lines would have to change for this functionality (currently L54-58):

if(filters.length == 0) {
     // (not needed) delete this.attributes.layer.params.CQL_FILTER;
} else {
     newParams = {"LAYERS": filters};
}

So it seems that the FilteredLayerNode can be made more generic with two 
new config options, one for the param to change and one for the 
concatenation string (not required in the case of ","). The 
CQLFilterNode is already generic enough to support that, but could use 
more generic variable and event names.

> and then, if possible, display the CLASS icon as a legend

Tim Coulter is currently working on a tree node that can display a 
legend graphic (e.g. from a GetLegendGraphic request) [3], but this is 
not fully functional yet.

> - Using a mapserver query in mode=legend with a html template that 
> outputs javascript objects, I generate an array of groups that has layers.

You could create a Tree configuration, as shown in [4] when clicking on 
"Show/Edit Tree Config".

> - Using that array, I must find a way to build a model for the ext.tree

Not required if you look at [4], if you manage to create a valid tree 
config with your mapserver template.

> - In the end, I would have my tree, and clicking on a group would 
> refresh the OL.Layer.WMS with all the "layers" names the group contains...

exactly!

> In mapfish, when you give no model to the tree, it builds its own and 
> when, using OL.Layer.WMS or MapServer, you define an array of 
> params.LAYERS instead of a string, it automatically generate a model by 
> "layers" in the mapfile. That's what I want but with a level of GROUPS 
> and maybe, if possible, display the CLASS icons as a legend.
> 
> So that's about it. It's a bit hard to explain more. Can GeoExt achieves 
> what I want ?

As you can see, the CLASS stuff is being worked on (you might to support 
Tim here), and the Layer/Group stuff is as easy as changing two lines of 
code in the short term, and making a few things more generic by more or 
less just changing names in the long term.

Regards,
Andreas.

[1] 
http://projects.opengeo.org/who/browser/ems/trunk/lib/WHO/FilteredLayerNode.js
[2] 
http://projects.opengeo.org/who/browser/ems/trunk/lib/WHO/CqlFilterNode.js
[3] 
http://geoext.org/trac/geoext/browser/sandbox/opengeo/drake/trunk/core/lib/GeoExt/widgets/tree/WMSLegendNode.js
[4] http://demo.opengeo.org/ems/examples/gx-tree-demo.html

> Christopher Schmidt wrote:
>> On Sat, Feb 14, 2009 at 11:52:52AM +0100, Andreas Hocevar wrote:
>>  
>>> Alexandre Dube wrote:
>>>    
>>>> Nevermind.
>>>>
>>>> What I want to do will be easier in MapFish ( I think ).
>>>>
>>>> I want to have one Openlayer.Layer.WMS with a tree like this :
>>>>
>>>> Groups
>>>>  |__Layers
>>>>      |__Class
>>>>       
>>> I think I'm missing something here. What would such a tree do to one 
>>> WMS layer? Or are you talking about a nested WMS layer. In that case, 
>>> I would be interested to see the GetCapabilities for this layer.
>>>     
>>
>> I'm not sure I understand the "Layers", "Class" stuff, but I think that
>> in general, there is a desier to have multiple WMS Layers (from the
>> GetCaps) merged into one Layer.WMS -- so when you turn on two layers,
>> instead of two OpenLayers.Layer classes, you have one with a
>> 'layers':'abc,123'.
>>
>> Regards,
>>   
> 
> 


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


More information about the Users mailing list