2.5 D vector styling

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 a 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 screenshot shows a portion of a city where the buildings are styled using the 2.5 D vector style:

We will now explain the settings that are 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 screenshot shows the settings that are available for the 2.5 D renderer:

There are a number of settings available for the 2.5 D renderer. We will now examine each in detail:

  • Height: This setting determines the height the polygons will be extruded at in map units. This can be either a number you enter, a field in the attribute table, or a calculation. If you enter a number, then all polygons will be extruded to this height. If you enter an attribute field, then the polygons will individually extrude to their associated value. If you click on the Expression button (), then you can create an expression to be evaluated for the polygons' extrusion height. Often, the height values stored in attribute fields are in a different unit than the map unit and will need to be converted so that the rendering is correct. For instance, if the map units are in meters, but the height attribute is in feet, then you would need to multiply the height attribute by 0.3048.
  • Angle: This is the angle at which the extruded polygons will lean. The angle can be specified in values between 0 degrees and 359 degrees, with the default being 70 degrees. 0 degrees is the right of the screen and increases in a counter-clockwise direction, so that 90 degrees is the top of your screen.
  • Advanced Configuration: This section of settings allows you to set the Roof Color (top of the extruded polygon), Wall Color (sides of the extruded polygon), and toggle Shade walls based on aspect. The shading varies the value of the wall colors to simulate shade from a light source. Turning off shading causes the walls to be rendered in the chosen, single, flat Wall Color.
  • Shadow: If this is enabled, a shadow using the set Color and with the set Size will appear around the base of the extruded polygons.

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 that's 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!