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

Eric Lemoine eric.c2c at gmail.com
Tue May 20 12:00:25 EDT 2008


Hi. I think you must add your filters to a rule object then add the
rule to the style object. Can't really check right now, am on a cell
phone. Cheers

2008/5/20, Dejung Gewissler <dejung.gewissler at oit.state.nj.us>:
> 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:
> "gray"}}
>         }
> );
> GeoJSON_style.addRules([rulePopGreat, elseRule]);
> var GeoJSON = new OpenLayers.Layer.GML("GeoJSON Vectors",
> "County_JSON_Simplified.json",
>         {visibility:false, maxResolution:5000, minResolution:1, format:
> OpenLayers.Format.GeoJSON,
>             styleMap: new OpenLayers.StyleMap({
>                 "default": GeoJSON_style})
>         }
> );
>
> Thanks,
> Dejung
>
> Eric Lemoine wrote:
>> With 2.6 and trunk you should indeed OpenLayers.Filter.Comparison.
>>
>> --
>> Eric
>>
>



More information about the Dev mailing list