2.5D rendering in Context

“2.5D rendering is used to extrude polygons from their surrounding features, creating an illusion of depth in your map”

In this module we will examine the 2.5D renderer in QGIS and understand the basic options that can be used to specify how extrusion should take place.

You try:

Goal: To learn basic workflows behind working with the 2.5D renderer

You need to do the following tasks to achieve results like the example above :

  • Add the buildings layer from exercise data.
  • Symbolize the layer above using the 2.5D renderer.
  • Use the default options provided with the 2.5D render and visualize your changes.
  • Experiment with the roof, wall colours to improve the visualization.
  • Navigate to the symbolization again and this time use an expression for the height in 2.5D render settings.

Hint Try out the expressions Linear scaling or Exponential scaling.

  • Try to create your own expressions for height and see what your building looks like.
  • After applying your 2.5D render switch the render type to Catogorized and symbolize using the options below

Check your results:

Your map looks similar to the image above

Name Expectation

Linear scaling

scale_linear( "pop_capacity" , 4645, 19028000, 2, 10)

Exponential scaling

scale_exp( "pop_capacity" , 4645, 19028000, 2, 10, 1.1)

Categorized - Column Name

STRUCTURE

Categorized - Color ramp

Random

More about 2.5D rendering

In order to simulate perspective for extruded objects, an algorithm is used to compute the distance of each object from the top of the map. This distance is then used to render the objects, starting with those closest to the top of the map, ending with those closest to the bottom. You can view (and modify) this formula in the 'control feature rendering order' expression editor.

2.5D renderer uses a special symbol layer style called 'geometry_generator' to compute the extruded geometry for the 'walls' and 'roof' of the extruded polygon. You can use the geometry generator to do other cool stuff like buffering geometries on the fly.

If you change the renderer to single symbol renderer QGIS will create a number of symbol layers and preserve the 2.5D rendered style. You can use these symbol layers to manipulate the 2.5D rendering in fine-grained detail. You can also add additional geometry generator symbol layers to create effects like this:

One other important thing to note: 2.5D renderer uses two special layer variables to store the qgis_25d_angle and qgis_25d_height. If you try to copy the style from one layer to another, these values will NOT be copied, so you need to manually set them on the destination layer if needed.

Check your knowledge:

  1. 2.5D Renderer can be used with these feature types:

    1. point layer
    2. line layer
    3. polygon layer

Further reading:

Download the sample data for the lesson.