-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

OpenLayers 2.10 Beginner's Guide

So far, we've pretty much just been doing a one to one match on properties to specify style. With attribute replacement, we directly replace a value. With addUniqueValueRules
, we see if a property is equal to something. So far, we haven't had much flexibility.
By using Rules and Filters, we can be as flexible as we want. We can do comparisons on properties, such as styling a feature a certain way if, for instance, it has a property less than or greater than some value. We can create filters to check for a multitude of different types of comparisons (greater than, less than, equal to, etc.), and have filters interact with each other.
A filters object belongs to a rule object. A rule object belongs to a style object. Each style object can have multiple rules, and rules can interact with each other depending on how their filters are defined.
To use custom rules and filters, we just need to associate them with a style object. The general syntax...
Change the font size
Change margin width
Change background colour