Selecting features for styling
The styling editor lets you create a set of display rules and filters for a layer. This article covers the following topics:
A display rule specifies colors, patterns, and labels for a layer when viewed at a specific zoom level. Zoom level zero (0) is distant (zoomed out), and zoom level 24 is close (zoomed in). You can create multiple display rules, each at a different zoom level or range of zoom levels, to change the appearance of the layer as the user zooms in and out.
Within each display rule, you can specify:
- The appearance of each type of feature. For example, you can specify the color of a line and its border, the fill color of a polygon, the icon associated with a point, or the label for a point or line.
- Filters that apply the display rule to a subset of features in the layer.
Filtering lets you match a particular style to the data in a vector table. For example, imagine a vector table that contains roads and contains the attribute
ROADCLASS, which denotes the importance and size of the road. By filtering on the value of
ROADCLASS, you can create one display rule for national roads, another for regional roads, and yet another for small local roads or paths. Attributes in filters are case-sensitive and must exactly match the spelling of the attribute in the data file.
By using multiple filters, you can specify a more complex set of criteria. For example, suppose you are using a data souce that consists of points that represent populated places. Attributes include population 1950 and population in 2000, and you want to highlight places whose population grew from less than 1 million to over 5 million in those fifty years. You'd choose a specific icon and set two filters:
- One filter matches places whose population is greater than 5 million
- One filter matches places whose population in 1950 was less than 1 million
The display rule applies to a vector only if all the filters match, so only the appropriate features will have the icon.
You don’t have to style all the data, because the default style applies to all features that aren't filtered. For example, if you want to highlight key features by showing them in red but let all other features appear in green, make the default color green and then set a filter to select the key features and color them red.
If there are multiple rules, Maps Engine applies them in the same order that they appear in the style editor. The first rule is applied first, then the next is applied, and so on. Each display rule applies only to the vectors that didn't match the previous rule. Therefore, you'll need to order rules to start with the most specific rule and move down to the least specific rule.
Suppose you have a data set that contains cities with populations of 5 million or greater. You want the map to distinguish three categories of cities: population greater than 5 million, greater than 10 million, and greater than 15 million. You'd create three display rules, each with its own icon, and order them as follows:
- The rule for cities with population greater than 15 million is first
- The rule for cities with populations greater than 10 million is second
- The rule for cities with populations greater than 5 million is last
The order is important. If you reverse the order, the same icon will apply to all cities because Maps Engine will process the first filter and all cities will match the "greater than 5 million" filter.