Inverted Polygon Renderer in Context

“The Inverted Polygon Renderer is used to render outside of the polygons defined in your vector polygon layer.”

In this module we will explore the inverted polygon renderer. There are two primary uses for this renderer: masking and graduated outlines which extend away from polygons rather than into them.

You try:

Goal: To learn how to create a coastline effect around country polygons.

  • Load your countries layer and set the properties according to the table.
  • Experiment with different options and ramps to see if you can make a nice graduated coastline effect.

Check your results:
Once you have finished, you should have the interior of your country boundaries transparent, the exterior filled with a pleasing sea colour.

Try put another layer behind the countries and verify that you can see through the interior of the countries

Name Expectation

Layer

countries from ne.sqlite

Renderer

Inverted polygons

Sub renderer

Single symbol

Symbol layer 1:

Symbol layer type

Simple fill

Fill style

no brush

Border width

1 mm

Symbol layer 2:

Sub layer type

Shapeburst fill

Gradient colours

Two colours

#2b6adb to #6a94db

Shading style

Shade to set distance 5mm

Blur strength

10

More about

One useful thing you can do with the inverted polygon render is feature masking. For example if you are trying to make a map of your country, and want to exclude surrounding territories you can create a copy of your country layer filtered to your focus country and then use the inverted polygon renderer to hide all countries except the focus country. One gotcha with this is that labels will not be masked (as of QGIS 2.14 and below). You can do some clever tricks to mask the labels which we will look at in the expressions module - see also the Mask plugin which makes it easier to manage label masking in your expressions.

Check your knowledge:

  1. Use the inverted renderer when:

    1. You need to draw outside your polygons rather than inside
    2. You want to switch the colour around
    3. You need to mask some data from other layers
  2. Inverted rendering can be used with:

    1. point layers
    2. line layers
    3. polygon layers
    4. raster layers

Further reading:

Download the sample data for the lesson.