[OpenLayers-Users] HOW TO USE LOGICAL FILTERS

Arnd Wippermann arnd.wippermann at web.de
Wed Jul 28 12:38:55 EDT 2010


So should it work

create filterComparison1 for attribute1

create filterComparison2 for attribute2

create filterLogical with above filters

add filterLogical as filter to the rule


var filterComparison1 = new OpenLayers.Filter.Comparison({
    type: OpenLayers.Filter.Comparison.GREATER_THAN,
    property: attribute1,
    value: 5
});

var filterComparison2 = new OpenLayers.Filter.Comparison({
    type: OpenLayers.Filter.Comparison.LESS_THAN,
    property: attribute2,
    value: 2
});

var filterLogical=new OpenLayers.Filter.Logical({
        type: OpenLayers.Filter.Logical.AND,
        filters:[filterComparison1, filterComparison2]
});

var rule = new OpenLayers.Rule({
        name:"Rule 1",
        filter: filterLogical
    }),
    symbolizer: {graphicName:"circle", pointRadius: 7} 
});

Arnd 

-----Ursprüngliche Nachricht-----
Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von s.williams
Gesendet: Mittwoch, 28. Juli 2010 16:34
An: users at openlayers.org
Betreff: [OpenLayers-Users] HOW TO USE LOGICAL FILTERS


I want to combine two separate filters using a logical filter, the objective
is to use a comparison filter to set the point radius of a marker from
feature "attribute1" and use another filter to set the color of that marker
from "attribute2". Thanks for the help

Here's what I have

                      var rule = new OpenLayers.Rule({
                      filter: new OpenLayers.Filter.Comparison({
                        type: OpenLayers.Filter.Comparison.GREATER_THAN,
                        property: "attribute1",
                        value: 5
                    }),
                    symbolizer: {graphicName:"circle",
                                     pointRadius: 7
				     } 
                        
                    });


                    var rule1 = var rule = new OpenLayers.Rule({
                      filter: new OpenLayers.Filter.Comparison({
                        type: OpenLayers.Filter.Comparison.LESS_THAN,
                        property: "attribute2",
                        value: 2
                    }),
                    symbolizer: {graphicName:"circle",
                                    strokeColor: '#000000',
				    strokeWidth: 1,
				    fillColor: "#0000FF"
				     } 
                    });

                   var rules = new OpenLayers.Filter.Logical({
                                    filters: [rule1,rule2],
                                    type: OpenLayers.Filter.Logical.AND})

These are just some code snippets I have written, any help on how to put
them together would be great
                  

                        

--
View this message in context:
http://osgeo-org.1803224.n2.nabble.com/HOW-TO-USE-LOGICAL-FILTERS-tp5345691p
5345691.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list