[OpenLayers-Users] rules with multiple filters ?

Didrik Pinte lists at dipole-consulting.com
Tue Nov 4 10:29:37 EST 2008


Hi,

I'm trying to get the following configuration on a GeoJSON point vector
layer with a tree_class attribute and a cluster strategy activated on
the layer. 

When the scale is ok, I want to use a specific externalGraphic based on
the tree_class attribute of the features. When the scale is to small, I
use a cluster strategy showing a circle. Thus, I need to have one style
when in "cluster" view, and one style per externalGraphic when not in
cluster view. 

Here is the question :

Is it possible to define multiple conditions on a rule so that I can
check if attribute count of the feature is > than 1 and the value of the
tree_class attribute ? Something like using a list of filters in the
Rule constructor ?

var noClusterTreeClass1Rule = new OpenLayers.Rule(
            {
                filters: [new OpenLayers.Filter.Comparison(
                    {
                        type: OpenLayers.Filter.Comparison.EQUAL_TO,
                        property: "count",
                        value: 1,
                    }), new OpenLayers.Filter.Comparison(
                    {
                        type: OpenLayers.Filter.Comparison.EQUAL_TO,
                        property: "tree_class",
                        value: 1,
                    })],
                symbolizer: {externalGraphic: "class1.png"}
            });

Thanks

Didrik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://lists.osgeo.org/pipermail/openlayers-users/attachments/20081104/ba13cd56/attachment.bin


More information about the Users mailing list