Book Image

OpenLayers 2.10 Beginner's Guide

Book Image

OpenLayers 2.10 Beginner's Guide

Overview of this book

Table of Contents (18 chapters)
OpenLayers 2.10
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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 the filter class we've been using so far. Like the name implies, this class will compare properties based on the specified parameters of the filter object. The type of comparison applied is specified by the type property. We also have to specify a value...