[Users] Layer Tree Tutorial questions

Andreas Hocevar ahocevar at opengeo.org
Sat Feb 12 18:53:05 CET 2011


Hi,

the key to understanding the LayerParamLoader is the combination of the
param and delimiter params. Think of a layer with

Cql_filter: "state_abbr=MD or state_abbr=PA"

If you load this layer with a LayerParamLoader configured with

param: "CQL_FILTER",
delimiter: " or "

you will get two layer nodes, one for Maryland and one for Pennsylvania.

To answer your questions:

1. The LayerParamLoader takes a param from a layer and splits it at the
delimiters. A node is created for each of the splitted parts. By checking
and unchecking nodes you control which parts will be joined by the
delimiter. After each check change, the layer will be reloaded with the
resulting param.

2. The use case is to be able to turn parts of the filtered view on and off,
without the need to create a Layer object for every part of the filter. This
can be very useful for OR filters.

3. Yes, layer.mergeNewParams is used to update the layer and re-request the
tiles after every check change.

4. Using LayerParamNode nodes directly (i.e. not created by the
LayerParamLoader) allows you to add and remove LAYERS from a Layer object
without the need for creating a Layer object with the full list of LAYERS
you want.

5. The LayerParamNode (not the LayerParamLoader) is responsible for updating
the param on the target layer and calling mergeNewParams to reload the
tiles.

I don't think we have an example for the CQL_FILTER use case, but it was the
use case that was the reason for creating the LayerParamNode in the first
place.

Your attempt with the FORMAT does not make sense, unless you use mutually
exclusive nodes (i.e. with radio buttons instead of checkboxes) for
LayerParamNodes representing one image format each. You cannot use the
LayerParamLoader to create these.

Another vendor param of GeoServer that would make a nice use case for the
LayerParamLoader would be FEATUREID, which is a list of featur ids.

I hope I was able to demystify the LayerParamNode and LayerParamLoader.

Regards,
Andreas.

Am 12.02.2011 01:15 schrieb "Gary White" <gary_white at verizon.net>:

Can someone please explain the “Sub-Layers” section of this tutorial (
http://www.geoext.org/tutorials/layertree-tutorial.html#sub-layers)?
Specifically I’m wondering how the param property in the loader works.  I
understand that the loader is a LayerParamLoader but the underlying
mechanics are unclear.  I was originally under the assumption that this was
used as a read-only mechanism to grab data from an already
configured/retrieved layer as in using "LAYERS" in order to retrieve the
following layers from groupLayer:



        layers: [

            "topp:tasmania_state_boundaries",

            "topp:tasmania_water_bodies",

            "topp:tasmania_cities",

            "topp:tasmania_roads"

        ],



After reading the note about using the “CQL_FILTER” param I became
confused.  Here are some questions that can hopefully clear things up for me
(and possibly others):



1 - Is this used to create a new “CQL_FILTER” and/or modify an existing one
or just to read one that already exists?

2 - What would be the use case for reading a “CQL_FILTER” that already
exists?

3 - If creating/modifying a “CQL_FILTER”, does this reinitiate a WMS etc.
request in order to fulfill the new filter?

4 - If this is not used for just read-only purposes, can you also
create/modify a layer list using "LAYERS"?

5 - What is the lifecycle of the LayerParamLoader and the underlying (in
this case) OpenLayers.Layer.WMS?   i.e. Does the LayerParamLoader trigger
the WMS request from the server or is that request initiated separately?



Is there a working example showing the use of “CQL_FILTER” in this manner?
(I couldn’t find one)



BTW, I was even more confused when playing around with a value other than
"LAYERS" for the param property.  For instance, when I changed it as
follows:



        loader: {

            param: "FORMAT"

        }



the group layer node was populated with a single node displaying the text
“image/gif” but the map displayed all 4 layers when I clicked the checkbox.
Can anyone explain this behavior?



Thanks!

Gary

















_______________________________________________
Users mailing list
Users at geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20110212/007b6160/attachment.htm 


More information about the Users mailing list