O'Reilly logo

OpenLayers 2.10 by Erik Hazzard

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

OpenLayers.Filter class

The Filter class controls the logic of match feature property attributes to see if a rule should be applied or not. We can use a single filter, like in the previous example, or we can combine filters together (e.g., if property1 is greater than 500 and another property2 is less than 200, then apply the style).

Filters can also be spatial—we can check to see if features intersect geometry objects, are within some distance of a point, and more. To do all these things, we use subclasses of the base Filter class, similar to how we use subclasses of the Layer class and other classes.

Filter Subclasses

There are four subclasses we'll cover here—Comparison, FeatureId, Logical, and Spatial.

Filter.Comparison

The Comparison class is ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required