[OpenLayers-Dev] rules and filters. i'm confused

Dejung Gewissler dejung.gewissler at oit.state.nj.us
Tue May 20 11:37:31 EDT 2008

Thanks Eric. I've changed my OpenLayers.Rule.Comparison to 
OpenLayers.Filter.Comparison and the data loads ok. The problem I face 
now is that all the features are rendered with the else filter and the 
comparison filters aren't honored.

var GeoJSON_style = new OpenLayers.Style();
var rulePopGreat = new OpenLayers.Filter.Comparison(
            type: OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO,
            property: "POP2000",
            value: 500000,
            symbolizer: {
                Polygon: {fillColor: "#FFFF00", strokeColor: "gray"}
var elseRule = new OpenLayers.Filter(
        {elseFilter: true,
            symbolizer: {Polygon: {fillColor: "#FFFFFF", strokeColor: 
GeoJSON_style.addRules([rulePopGreat, elseRule]);
var GeoJSON = new OpenLayers.Layer.GML("GeoJSON Vectors", 
        {visibility:false, maxResolution:5000, minResolution:1, format: 
            styleMap: new OpenLayers.StyleMap({
                "default": GeoJSON_style})       


Eric Lemoine wrote:
> With 2.6 and trunk you should indeed OpenLayers.Filter.Comparison.
> --
> Eric

More information about the Dev mailing list