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

Rules and filters

For even more fine grained control, we can style objects by using the Rule and Filter classes. These two classes allow us to apply different styles to different features based on some arbitrary 'rules' we choose. We can use the feature's attributes property to apply certain styles if one (or more) of the properties match some value we choose.

How do we follow rules?

Rules allow us to apply symbolizers when certain conditions occur. Those conditions are handled via the Filter class. We can have multiple rules and filters, and even use logical operators (such as OR and AND) with them. Before we talk about that though, there are two ways we can use rules.

The first is by using the addUniqueValueRules method of the StyleMap class. ...

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