In this section, the eight different vector styling types will be covered. The eight types are single symbol, categorized, graduated, rule-based, point-displacement, inverted polygons, heatmap, and 2.5 D.
Note that even though layer rendering is part of vector style properties, it will be discussed separately in the next section as it is common to all vector styling types.
The single-symbol vector style applies the same symbol to every record in the vector dataset. This vector style is best when you want a uniform look for a map layer, such as when you style lake polygons or airport points.
The following screenshot shows the Single Symbol style type with default parameters for point vector data. Its properties will be very similar to line and polygon vector data.
Let's take a quick tour of the four parts of the properties window for the Single Symbol style type shown in the previous screenshot:
When you have a sub-component (Simple marker for example) selected in the symbol component tree, you have the option to enable Draw effects. These effects are covered in detail in Chapter 7, Advanced Data Visualization in the Learn to use live layer effects section.
As an example of how to use the Single Symbol style properties to create a circle around a gas pump , a second layer with the SVG marker symbol layer type was added by clicking on the Add symbol layer button (), and was then moved on top of the circle by clicking on the Move up button (). The following figure shows the parameters used to create the symbol:
To save your custom symbol to the Style Manager, click on the Save button to name and save the style. The saved style will appear in the Style Manager and the list of library symbols.
The categorized vector style applies one symbol per category of the attribute value(s). This vector style is the best when you want a different symbol that is based on attribute values, such as when styling country polygons or classes of roads lines. The categorized vector style works best with nominal or ordinal attribute data.
The following screenshot shows the Categorized style type with parameters for point vector data of schools. Its properties will be very similar to those for line and polygon vector data.
Styling vector data with the Categorized style type is a four-step process, which is as follows:
Other symbol options (which will change availability based on vector layer type), such as transparency, color, size, and output unit, are available by right-clicking on a category row. Additionally, advanced settings are available by clicking on the Advanced button.
The graduated vector style applies one symbol per range of numeric attribute values. This vector style is the best when you want a different symbol that is based on a range of numeric attribute values, such as when styling gross domestic product polygons or city population points. The graduated vector style works best with ordinal, interval, and ratio numeric attribute data.
The following screenshot shows the Graduated style type with parameters for polygon vector data of the populations of the states. Its properties will be very similar to that of point and line vector data.
Styling vector data with the Graduated style type is a five-step process, which is as follows:
The Legend Format field sets the format for all labels. Anything can be typed in the textbox. The lower boundary of the class will be inserted where %1
is typed in the textbox, and the upper boundary of the class will be inserted where %2
is typed.
If Link class boundaries is checked, then the adjacent class boundary values will be automatically changed to be adjacent if any of the class boundaries are manually changed.
Other symbol options, such as transparency, color, and output unit, are available by right-clicking on a category row. Advanced settings are available by clicking on the Advanced button.
The Histogram tab (shown in the following figure) allows you to visualize the distribution of the values in the selected column. It is often useful to view the histogram before you decide on the classification method to gain an overview of the distribution of the data and to quickly identify any outliers, skew, large gaps, or other characteristics that may affect your classification choice.
To view the data in the histogram, click on the Load values button. You can change the number of bars in the histogram by modifying the value in the Histogram bins box. You can view the mean and standard deviation by checking the Show mean value and Show standard deviation boxes, respectively.
The rule-based vector style applies one symbol per created rule and can apply maximum and minimum scales to toggle symbol visibility. This vector style is the best when you want a different symbol that is based on different expressions or when you want to display different symbols for the same layer at different map scales. For example, if you are styling roads, a rule could be set to make roads appear as thin lines when zoomed out, but when zoomed in, the thin lines will disappear and will be replaced by thicker lines that are more scale appropriate.
There are no default values for rule-based styling; however, if a style was previously set using a different styling type, the style will be converted to be rule-based when this style type is selected. The following screenshot shows the Categorized style type from the previous section that is converted to the Rule-based style type parameters for polygon vector data of the populations of the countries. Its properties will be very similar to that of point and line vector data.
The Rule-based style properties window shows a list of current rules with the following columns:
To add a new rule, click on the Add rule button () to open the Rule properties window. To edit a rule, select the rule and then click on the Edit rule button () to open the Rule properties window. To remove a rule, select the rule and then click on the Remove rule button ().
Additional scales, categories, and ranges can be added to each rule by clicking on the Refine current rules button. To calculate the number of features included in each rule and to calculate the duplicate feature count, click on the Count features button.
When a rule is added or edited, the Rule properties window (which is shown in the next screenshot) displays five rule parameters, which are as follows:
None of the parameters are required (Label, Filter, and Description could be left blank); to exclude Scale range and Symbol from the rule, uncheck the boxes next to these parameters.
As an example of use, using the Populated Places.shp
sample data, capital cities, megacities, and all other places can be styled differently by using rule-based styling. Additionally, each rule is visible to the minimum scale of 1:1, although they become invisible at different maximum scales. The following screenshot shows the rules created and a sample map of selected populated places in the country of Nigeria:
The point-displacement vector style radially displaces points that lie within a set distance from each other so that they can be individually visualized. This vector style works best on data where points may be stacked on top of each other, thereby making it hard to see each point individually. This vector style only works with the point vector geometry type.
The following screenshot shows how the Point Displacement style works by using the Single Symbol renderer, which is applied to the Stacked Points.shp
sample data. Each point within the Point distance tolerance value of at least one other point is displaced at a distance of the Circle radius modification value around a newly-created center symbol. In this example, three groups of circles have been displaced around a center symbol.
The Point Displacement style parameters, shown in the preceding figure, provide multiple parameters to displace the points, set the sub-renderer, style the center symbol, and label the displaced points. Let's review parameters that are unique to the point-displacement style:
The Labels parameters applies to all points (displaced or not) in the vector data. It is important to use these label parameters, rather than the label parameters on the Labels tab of the Layer Properties window, because the labels set in the Labels tab will label the center symbol and not the displaced points.
The inverted polygons vector style inverts the area that a polygon covers. This vector style only works with the polygon vector geometry type.
The following figure shows the Inverted polygons style for a polygon of the country of Nigeria on the left and all countries underneath the transparent inverted polygon of Nigeria on the right. Notice that the entire canvas is covered by the inverted polygon, which has the effect of cutting out Nigeria from the map.
The Inverted Polygons style parameters rely on a sub-renderer to determine the symbol used for the inverted polygons. By choosing the Sub renderer, the polygon rendering is inverted to cover the entire map canvas. The following screenshot shows the Inverted Polygons style parameters that created the inverted polygon of Nigeria:
If multiple polygons are going to be inverted and the polygons overlap, Merge polygons before rendering (slow) can be checked so that the inverted polygons do not cover the area of overlap.
A heatmap represents the spatial density of points visualized across a color ramp. The heatmap vector style can only be applied to point or multipoint vector geometry types. As an example, the following figure uses a heatmap on a city population point layer to visualize the density and distribution of population in the United States of America:
To create a heatmap, open the style properties of a point vector file, and select Heatmap as the renderer. The heatmap vector renderer has five settings (shown in following figure) that determine how the heatmap will display:
0
.Rarely is the default heatmap satisfactory, so it is recommended to iterate through different values of the radius to create the most impactful and meaningful heatmap.
The 2.5 D vector style extrudes two-dimensional (flat) polygons to make them look like they are three-dimensional at a set view angle. This view style is also commonly known as two-thirds (2/3) view, perspective view, or two-and-one-half (2.5) view. Regardless of the name, the 2.5 D vector style can create some compelling scenes. As an example, the following figure shows a portion of a city where the buildings are styled using the 2.5 D vector style:
We will now explain the settings used to create this 2.5 D city map. First, a polygon vector layer must be added to the map canvas; in our case, this was a building polygon layer. Next, open the style properties and choose the 2.5 D renderer. The following image shows the settings available for the 2.5 D renderer:
There are a number of settings available to the 2.5 D renderer. We will now examine each in detail:
Using the 2.5 D renderer is pretty easy and straightforward, but a neat feature is that it can be combined with another renderer (single, categorized, or graduated), which allows the extruded polygons to have different colors based on the second renderer used. To combine renderers, you must first render with the 2.5 D renderer, Apply the renderer, then change the renderer, set the second renderer's settings, and then Apply again. The only downside to combining renders is that the roof and wall colors are set to the same color value, as shown in the following image:
The eight vector layer styles really provide a great deal of control over the way your data is displayed on the map canvas. A number of vector layer styles have been added in recent releases of QGIS and have really increased the cartographic capabilities of the software. Speaking of great improvements to cartographic capabilities, the next section covers layer rendering, which really allows for some great visual effects to be added to your map!