PärPod by Claude
PärPod by Claude
PärPod by Claude
The Style Layer: Symbology, Labels, and the Swiss Algorithm in Your Map
16m · May 13, 2026
The Style Layer: Symbology, Labels, and the Swiss Algorithm in Your Map

The Style Layer: Symbology, Labels, and the Swiss Algorithm in Your Map

The Same Data, Two Maps

Two cartographers get the same dataset. Borehole locations in Jämtland, three thousand nine hundred dots scattered across the kommun boundaries. Both open QGIS, load the data, hit zoom to layer.

The first map shows three thousand nine hundred uniformly small black dots, evenly hued, on the default QGIS green background, with the operating system default Helvetica labels stacking on top of each other. It looks like every map any QGIS user has ever shown anyone. The reader's eye finds nowhere to land.

The second map shows the same three thousand nine hundred boreholes, but the points drilled before nineteen-eighty are tiny grey dots, the ones from nineteen-eighty to two thousand are mid-sized blue, and the post-two-thousand drillings are larger amber triangles. The kommun boundaries are a thin dashed grey. The hillshade fades from dark to light at zoom out. Place labels appear only at the right scale, with white haloes against the dark terrain. The reader's eye lands immediately on the amber, then traces the pattern back to the older drillings, and a story is visible in the data.

Both maps came from the same vector layer. The difference is symbology, plus a labeling configuration, plus scale-dependent rules. None of it changed the underlying data by a single byte. All of it is in the project file. And once you know what the renderers can do, the second map takes about twenty minutes longer to produce than the first one.

This episode is about the renderers, the symbol layers, the blend modes, the labels, and the small Swiss-engineered algorithm that decides where each label sits on the page.

The Four Renderers

Every vector layer in QGIS has a renderer. You see it in the layer properties under Symbology, in a dropdown at the top of the dialog. There are several renderers, but four of them are what you actually use.

Single Symbol. Every feature drawn the same way. The default. The boring one. Useful when you want all features to read as members of one set, like all the kommun boundaries in one dataset, all drawn the same.

Categorized. An attribute drives the style. Pick a column, click Classify, and QGIS produces a symbol per unique value. For the boreholes, this is the renderer to use if mine type or drilling company defines what the symbol should look like. Iron mines as triangles in one colour, gold mines as triangles in another, sulphide mines as squares, and so on. The legend writes itself.

Graduated. A numeric attribute drives the style across a colour ramp. Pick a column, pick a number of classes, pick a classification method, pick a colour ramp. QGIS bins the numeric values and assigns each bin a colour. For depths, ages, populations, concentrations, anything continuous. The classic choropleth map is built this way.

Rule-Based. The everything renderer. You write rules, each rule has an expression, each rule has a symbol. Rules stack, lower rules override higher ones, and each rule can have child rules. This is what to reach for when the styling logic is conditional, layered, or simply does not fit Categorized or Graduated.

Most maps need a mix. Kommun boundaries as Single Symbol. Boreholes as Categorized by mine type. Depth values as Graduated. Decorative overlays as Rule-Based for the edge cases.

Categorized: When an Attribute Picks a Style

For the gruvor work, Categorized is the workhorse. You have a mine type attribute, a drilling era attribute, a company attribute. Each one can become a categorical style.

The dialog flow. Set renderer to Categorized. Set the value field to mine type. Click Classify. QGIS scans the layer and produces one row per unique value, each with a random symbol. Then you spend the next ten minutes assigning meaningful symbols to each row. Iron triangles, copper squares, sulphide diamonds, whatever cartographic convention fits your data. Save your work as a style file.

The trick that gets missed: you can use an expression instead of a plain field as the value source. Click the expression button next to the value dropdown. Now you can categorize on something computed, like CASE WHEN drilling year less than nineteen-eighty THEN historic, WHEN drilling year less than two thousand THEN modern, ELSE recent. Three categories from a continuous field, defined inline. Useful when the data has too many unique values to categorize directly.

There is also a Symbol Levels button hidden in the Categorized dialog. By default, QGIS draws categorized features in random order, which means a small triangle might end up under a big diamond. Symbol Levels lets you set explicit draw order per category. The amber post-two-thousand triangles draw last, on top, so they are always visible.

Graduated: When a Number Picks a Colour

Graduated is the choropleth tool. The dialog has more controls than Categorized because the choices around binning are consequential.

The Classification Mode dropdown is the important one. Equal Interval splits the range into equal-width bins. Quantile splits so each bin has the same number of features. Natural Breaks, also called Jenks, finds bin boundaries that minimise within-bin variance and maximise between-bin variance, which is the cartographer's default for most distributions. Standard Deviation puts the breakpoints at standard deviation distances from the mean. Pretty Breaks rounds the boundaries to human-friendly numbers like five hundred or one thousand.

For a centerfold map showing borehole depths, Quantile gives you equal visual weight per bin, which is usually what you want. Equal Interval can produce maps where ninety percent of features land in one bin and the legend has four colours nobody can see. Try multiple modes, look at what each does to the visual story, pick the one that tells the truth.

The colour ramp is the other big choice. Avoid the rainbow palette, it lies about ordinality. Use a sequential ramp like yellow-orange-red for sequential data, a diverging ramp like blue-white-red for data that has a meaningful zero or midpoint. The ColorBrewer ramps that ship with QGIS are good defaults; Cynthia Brewer designed them for cartography specifically.

Rule-Based: The One That Does Everything

Rule-Based is where the cartographic gloves come off. Each rule is an expression plus a symbol plus an optional scale range plus optional child rules.

The pattern that works: start by converting your Categorized renderer to Rule-Based using the right-click menu. You now have one rule per category, with the symbol from your categorization. From here, you can edit each rule's expression freely, add new rules, set scale visibility per rule, or nest rules so that the post-two-thousand triangles only show above one to a hundred thousand scale and the historic dots only show below.

The scale-aware rule is the move that makes a map feel professional. At wide-area zoom, you want fewer dots, larger, more legible. As the reader zooms in, you want more detail to appear progressively. This is exactly what rule-based renderers with scale ranges allow.

A second move: use a rule to filter out noise. A rule with expression for drilling year is null, with no symbol attached, means features with missing dates simply do not draw. Cleaner than filtering the layer or maintaining a separate query.

Symbol Layers and Blend Modes

A single symbol can have multiple symbol layers, the way CSS allows multiple backgrounds per element. Each symbol layer is its own little symbol, drawn on top of the previous.

The most common stack: a fill layer underneath, an outline layer on top. But you can stack arbitrarily. A point symbol can have a circular shadow, a coloured fill, an SVG icon on top, and a small label-position dot above that. The whole composite is what the user sees.

This is how cartographic effects emerge. A road symbol that looks like a road is usually two line layers stacked: a wide grey casing line on the bottom, a narrow white centerline on top. A country boundary with a fade is a thick faded line under a thin sharp line. A point that glows is a soft blurry blob under a hard symbol.

Blend modes are the second half of the trick. Each symbol layer can use a blend mode borrowed from image editors like Photoshop. Multiply darkens what is underneath. Screen lightens it. Overlay does both depending on lightness. For a hillshade under coloured kommun boundaries, set the hillshade layer's blend mode to Multiply, and the terrain bleeds through the colours without washing them out. This is the single trick that takes most amateur maps from "screen-bright and flat" to "subtly three-dimensional and professional".

Blend modes also live on the layer level, not just the symbol layer level. The whole hillshade layer can be set to Multiply against everything beneath it. For the gruvor centerfold, this is the move that integrates the Lantmäteriet hillshade naturally with the marktäcke land cover above. Without it, you have two competing colour systems fighting for the reader's eye. With Multiply, you have one image with depth.

Scale-Dependent Visibility

A serious cartographic project uses the same QGIS project for many outputs. The screen view at zoom one to two million for an overview. The centerfold at zoom one to two hundred thousand for print. The detail view at zoom one to fifty thousand for a sub-region inset.

The same project, the same layers, but the right symbology and labels appear at the right scales. This is what Scale-Dependent Visibility achieves, and it is configured at the layer level and the rule level.

In layer properties, under Rendering, you can set minimum and maximum scales. The layer only draws between those scales. Below the minimum, it disappears. Above the maximum, it disappears. A satellite base map might only show at zoom in below one to fifty thousand. A road network might show across all scales but with different rules: highways always visible, secondary roads only below one to a hundred thousand, footpaths only below one to twenty thousand.

The rule-based renderer supports the same on a per-rule basis. So one layer of boreholes can have one rule for "show all dots when zoomed in close" and another rule for "show only the post-two-thousand triangles when zoomed out wide." Same data, different rendering at different scales.

For the Årebladet centerfold workflow, this means the same project file produces a clean screen view, a clean print centerfold, and a clean detail inset, each automatically. You configure the scale ranges once, and the map looks right at every scale.

The PAL Engine, or, A Swiss Thesis in Your Map

Now to labels. Every label on every QGIS map is placed by an algorithm called PAL, which stands for Automated Placement of Labels Library. PAL was written in two thousand and eight by Maxence Laurent, a Master's student at the University of Applied Sciences of Western Switzerland in a town called Yverdon, supervised by Eric Taillard. They published a paper in two thousand and nine called PAL, A Cartographic Labelling Library. The library was integrated into QGIS shortly after, and it has been the labeling engine ever since.

What PAL actually does is solve a combinatorial optimization problem. For each feature that wants a label, it generates a set of candidate positions, eight around a point feature by default, multiple positions along a line feature, multiple positions inside a polygon. Each candidate has a cost: a penalty for overlapping another label, a penalty for falling outside the visible area, a penalty for being in a less-preferred position. PAL then searches for the global combination of candidate selections that minimises total cost. The technique is called POPMUSIC, a name only an academic could love, and the details are in the original paper.

For a small map with twenty labels, this is instant. For a map with five thousand labels at full national scale, PAL is doing real computational work between every zoom and pan. The fact that the labels almost always land in sensible positions is the result of years of refinement by the QGIS team on top of Maxence's original library.

You can tune PAL's behaviour. In the layer's labels dialog, under Placement, you choose the strategy: around point, offset from point, fixed positions only. Under Rendering, you set the priority of this layer's labels versus other layers, the maximum number of candidate positions, whether labels can be repeated along long lines.

The reason this matters in practice: when labels collide and PAL drops some, you can fix it. Move the colliding layer's labels to a different priority. Reduce the font size. Restrict the labels to a higher zoom level. Manually move specific labels using the move-label tool. The collision is solvable.

Halos, Buffers, and Expression-Driven Labels

The label engine has rich typography controls. Buffer adds a coloured halo around the text. For labels against a dark hillshade, a white buffer two pixels wide makes the text legible without competing with the background. For labels against a light area, a dark buffer does the same. Buffer is the single most important label setting for readability.

Callouts are the other key feature. When a label cannot fit next to its feature, a callout draws a line from the label to the feature. This is what you see on dense road maps where village names are placed in empty space with a thin line back to the village dot. Configure callouts under the label dialog's Callouts tab.

Expression-driven labels are the cartographic power move. Instead of using a plain field as the label, use an expression. CASE WHEN population greater than one thousand THEN name ELSE NULL END means only places with population over a thousand get a label. CASE WHEN size class equals one THEN upper of name ELSE name END means the largest places get capitalised names. Concatenation lets you build labels like name plus newline plus the population in parentheses.

For the gruvor centerfold, an expression-driven label is what lets you show only the most significant mines by name, automatically, without manually editing the data. The same expression scales: when you load new boreholes next year, the same rule still picks the right ones to label.

Style Manager and the QGIS Hub

You will spend hours tuning symbology you want to reuse. The Style Manager, under Settings, is where that work persists.

A style file in QGIS can be an XML file with one layer's symbology, called a QML file, or a binary database of many styles, called a SQLite-backed Style Manager. You can save individual symbols, colour ramps, label settings, or whole layer styles. You can import and export. You can share. You can publish to the QGIS Hub, which is the project's public sharing site, and find styles other people have published.

For Swedish cartography specifically, there are existing style libraries for Lantmäteriet datasets, for OpenStreetMap rendering in a Swedish convention, for SGU geological data. The QGIS Resource Sharing plugin pulls these in with one click.

The pattern: do the styling work once, save the style to a QML file, store the QML file in the project repository alongside the build script. Anyone who later opens the project, including future you, gets the same look without redoing the work. For a long-running gruvor pipeline, this is the difference between fragile one-off styling and a real reusable asset.

Why the Triangles Work

Back to the centerfold. The decision to render mines as triangles is a small cartographic choice with real reasoning behind it. At print scale, point density is the main visual challenge. Three hundred points in close proximity render as a blob of circles. The same three hundred points as triangles render as something you can read. Orientation gives the eye an extra cue. The empty negative space inside a triangle outline is easier to separate from neighbours than a filled circle. And triangles in different colours are distinguishable even when partly overlapping.

Triangles also have semantic weight. A triangle reads as "marker, attention, point of interest" in a way a circle does not. Circles read as natural objects or general points. Triangles read as artificial, deliberate, signposted. For mining sites, that semantic is exactly right. For wells or natural features, it would be wrong.

The same logic applies to every styling choice. Why categorical not graduated for mine type? Because mine type is nominal, not ordinal. Why a muted background palette? Because the markers need to pop. Why white halos on labels? Because the hillshade is dark in many areas and the labels need contrast. Each choice has a cartographic reason. The cumulative effect is a map that does not look like a screenshot of QGIS, but like a map.

Maxence Laurent, sitting in a Swiss engineering school in two thousand and eight, wrote a label placement library because his Master's thesis needed one. Eighteen years later, that library decides where the word Östersund lands on a centerfold for a paper in northern Sweden. Open source software keeps doing this. Someone's small specific contribution becomes infrastructure that other people, in other places, in other languages, with other problems, use without ever knowing the original author's name.

Tomorrow, in Mörkret, when you tune the symbology on the gruvor centerfold and watch the labels arrange themselves around the borehole triangles, that is PAL running. That is Maxence's algorithm at work in real time, doing combinatorial optimization between every pan and zoom. Give it good rules and it will give you good cartography back.

That is the trilogy. Tools and the people who built them. Tomorrow you put them to use.