Diving into the world of 3D with QGIS

Gispo Ltd.
13 min readFeb 12, 2024
An example of 3D data opened in QGIS.

Have you ever tried the 3D tools of QGIS? They are very useful and versatile, and in this article we are going to dive into the world of those tools. We’re going to open 3D data with QGIS and I will guide you through the built-in 3D tools of QGIS and teach you how to use them.

The process

To try out the 3D tools we need some 3D data. I used open 3D data from the National Land Survey of Finland. Yes, it’s open data! The National Land Survey of Finland offers a lot of open data on its open data download service (link here). There you can find 3D data, elevation models, orthophotos, topographic maps etc.! I downloaded a two-metre digital elevation model (DEM) and 3D building data for this introduction. The selected area was the district of Kalasatama in Helsinki.

After creating a new QGIS project and adding data, it’s time to open the door to the 3D world of QGIS! Before we start to go through the tools, we need to slightly change the settings of the 3D building data to include the heights of the buildings there. This way, the buildings correspond to their actual heights on the map in relation to the scale.

This is done by opening the properties of the 3D building data. Then we choose the “3D view” option from there and as a symbol we keep the single symbol option. In “Extrusion”, the variable to be installed in a column indicating the height of the buildings, in this case MeasuredHeight column (drop-down menu → Edit → add a column indicating the height of the buildings to the expression from the “Fields and Values” drop-down menu). This way, the 3D buildings on the map correspond to the actual height of the buildings. Here is a gif on how to do it below!

This way you can get dimensions in your 3D buildings data.

3D view

Then we delve into the 3D features of QGIS through the configuration menu. This menu contains all the main functions of this full 3D view. The first thing to do is open the 3D view itself and you can open it by pressing “View”“3D Map Views”“New 3D Map View” from the top menu. Now you can see the 3D view opened in a separate window, but the 2D view still remains in the background.

You can open the configuration menu by clicking the tool icon on the 3D view selection ribbon, which opens a drop-down menu. At the end of the drop-down menu you will see the option “Configure…” and here it is!

How to add a new 3D view to your QGIS project.

Configuration menu

The configuration menu has a tool for every 3D purpose you could need! On the left side is the configuration main menu, where you will find five main categories:

- Terrain

- Lights

- Shadow

- Camera & Skybox

- Advanced

These category names are very concise and descriptive of the tools they contain. Next you can see how to open this configuration menu in QGIS. Luckily it is very easy to find.

You can find most of the 3D features behind this configuration tool.

Terrain

Let’s take a look at these versatile configure functions, one by one! First up is the Terrain tool.

So, it looks interesting right? In the picture I have ticked the checkboxes in both sub-functions (Terrain and Terrain Shading), but if I uncheck the ‘Terrain’ box, all that is left are the buildings and the terrain disappears under them. This is useful when you want to focus on the buildings alone — for example when measuring their heights. ‘Terrain shading’ tool is used to adjust the brightness of the terrain. The ‘Ambient’ setting changes the brightness colour to e.g. green. The ‘Specular’ setting can adjust the highlight colour to e.g. blue (to highlight the roofs of buildings). The ‘Opacity’ slider is used to adjust the opacity of the shading.

Let’s take a closer look at the ‘Terrain’ sub-function. As we can see, it is possible to choose different types of types for terrain. In the image above, you can see that I have DEM selected as the type of terrain, but you can also choose flat terrain, a terrain from an online source (for example from Mapzen) or mesh types. So, it’s up to you! It is also important to select the right elevation if you want to use DEM as the type of terrain (for example I used DEM 2 metres). This setting therefore determines the elevation model to be used. All in all, this DEM tool contains a lot of settings that allow you to fine-tune the DEM level below.

This is what DEM terrain type looks like in 3D view with buildings.

‘Vertical scale’ setting emphasises the height shapes of the DEM layer, so the larger the number the more pronounced the height differences in the DEM layer. ‘Tile resolution’ setting adjusts the sharpness of the layer (the larger the number here, the sharper the DEM layer becomes). ‘Skirt height’ adjusts the thickness of the edge of the DEM layer, and ‘Offset’ moves the view up and down (the layer moves higher when the number here is larger). So as we can see here, this whole ‘Terrain’ function is very useful and versatile! And just wait, we have many more 3D functions to learn!

Lights

This setting allows you to control from which angle and with what intensity the light hits the buildings and also to change the colour of the light from the default white (for example to yellow). It is also possible to add lights in either point light or directional light form. Adjusting lights is a very useful and important setting when viewing 3D buildings as it can be used to enhance and customise the visibility.

But hold on a second, what does the point light and directional light mean? Well, they are different types of light of course! Here’s an example below of how to add a new light source, for example point light.

This is how you add new light source to the 3D view.

Pretty simple right? But what are the actual differences between these two light types? They appear and are positioned slightly differently in the 3D view, depending on the settings you put on them. Below are two example images, one using point light and the other using directional light with the same intensity.

3D view with point light vs. 3D view with directional light.

Aas we can see, the lights hit the buildings slightly differently and in different places. I would say that the directional light is more holistic and stronger. Point light, as its name suggests, focuses only on certain areas. But of course you can customize these lights and see what suits you and your data the best!

Shadow

This feature is very useful when you want to look at how shadows form on buildings and make more detailed analyses. This tool is also very easy to use!

First, you need to choose the light source for the shadow by using the dropdown menu from the ‘Directional light’ option. Note that you can only use directional light type for shadows! The ‘Shadow rendering maximum distance’ setting ensures that shadows are not created on objects too far away. The larger the number is in this setting, the fewer shadows appear to occur. The ‘Shadow bias’ setting avoids the self-shading effects that would make some areas darker than others because of the size of the map, so the lower the value of this setting the better. ‘Shadow map resolution’ setting allows you to adjust the resolution of the shadows to make them sharper. Note that this might reduce performance!

Camera & Skybox

When we want to view and analyse objects in 3D, adjusting the camera settings is crucial to get the most out of the 3D tool! There are many interesting camera settings, so let’s take a closer look at these as well!

You can customize the camera just the way you like. Let me introduce these various settings a bit, starting with the ‘Camera’ section:

In the ‘Projection type’ drop-down menu there are two options: perspective or orthogonal which allow you to view 3D buildings from different angles depending on your need. If you change the projection type, you have to take into account the possible change of lights and shadows!

The ‘Field of View’ has its own setting both in this configuration window and next to the 3D view itself, where it also has its own handy slider. You can also choose your own navigation mode. It can be conveniently switched to terrain based or walk mode (this means that the view is from ground level and the environment can be viewed but not zoomed in). The terrain based mode is more versatile but the walk mode is more suitable when you want to view directly from the ground. Of course it depends on your own preferences!

You may have noticed the axis in the top right corner of the 3D map view in previous images. QGIS lets you hide this axis with just one click, but you can also change its position and shape to a cube!

Under ‘Navigation synchronization’ section you can choose whether you want the 2D map view displayed in the main QGIS window to follow the open 3D map view or vice versa, the 3D view to follow the 2D view. Navigation synchronization makes it easier if you want to view/analyse both map layers at the same time. In this section, you can also choose whether you want the 3D map camera view area to be highlighted in the background 2D map view, so that the 3D area appears as a blue square on the 2D map. This allows you to see exactly where the 3D view borders. These options can also be selected directly by pressing the tool icon in the 3D map view from the top menu. There is also a shortcut button for the “show shadows”, “show eye dome lightning” and “show ambient occlusion” functions.

The ‘Show skybox’ feature allows you to place, for example, a picture of the blue sky in the background of the 3D view! You can insert your own .jpeg file. There are two skybox types that you can choose. With the Panoramic texture option, the same sky object is displayed in 360 degrees and with the distinct faces option you can set a different image for each of the six sides of the box.

Advanced

And finally, you can easily polish your 3D view with ‘Advanced’ tools! The advanced options are very versatile and you can add new dimensions to your data.

This is how the tool looks like in QGIS.

As you can see, there are many different kinds of tools to make your 3D view as optimal as possible! Let me introduce you to some of these tools that I found the most handy.

We can start with basic advanced settings which you can see first in that list. The ‘Map tile resolution’ allows you to adjust the resolution of the map tiles to your liking, the higher the number, the more detailed the map tiles are.

The ‘Max screen error’ setting determines how fast the 3D view uses higher resolution map tiles. The lower the number is in this setting, the more detail the view will show.

Ambient occlusion’ is an effect that can increase shading in areas that are not as exposed to ambient light. The effect affects the entire view and can be used in conjunction with eye dome lighting. This effect allows you to control the radius (how many map units the effect is applied to), the intensity (how strong the effect is, the higher the number the darker) and the occlusion threshold (the lower the percentage point the darker this control makes the view, calculating how many neighbouring points need to be occluded to see the effect).

Apart from these there are much more advanced settings to come! In these settings there are also additional options to choose from, for example to show labels (city districts), to display map tiles and even to display frame rate data! QGIS displays the frame rate in frames per seconds and this number appears in the top right corner of the 3D view. So there are numerous functions to customize your own 3D view and get additional information to suit your needs!

Toolbar tools in the 3D view

When you open the 3D view in QGIS you will find the toolbar shown in the picture above. Here are many other additional 3D tools for you to use in your analysis! These also contain very useful shortcuts. I will go through these in order from left to right.

That white hand icon represents the “Camera control” tool so with this tool selected, the 3D map view can be scrolled. Next to that you can see the little magnifying glass icon. Press this button to zoom the 3D map view so that the background map/other data in the QGIS 2D map view/working mode is also visible, i.e. the tool zooms to the whole map view. Next to this zooming tool is the “Toggle On-Screen Navigation” tool. It closes and displays the navigation tool, from which you can adjust the map view.You can see this navigation tool on the right side of the 3D view when this button is activated. Then we have the “Identify” tool. Clicking on an item the “Layer Styles” panel opens next to the 2D map window, showing the clicked item’s details in the attribute table.

Next to that you can see this ruler icon which represents the “Measurement line”. You can measure the horizontal length of two points you create, e.g. the width of a building or a certain distance on the ground. Press “New” and press the start point at the point you want and the end point at the point you want. Information about the horizontal, vertical and 3D distance between the points will appear in the tool table. From the “Map Units” drop-down menu, you can select the desired unit of measurement, e.g. metres, centimetres or kilometres. Here is a gif to make it a bit easier to understand!

Here’s how to use this measurement tool in 3D view.

Pretty amazing, right? But there is much more! That little triangle icon is an animation tool! You can create your own animation in 3D view. Add a new keyframe using the green “+” button, select the duration in seconds and press OK. You can delete a keyframe by pressing the keyframe drop-down menu to select the desired keyframe and press the red “-” sign. Below is an example of an animation created with this tool.

Animation created with animation tool.

Of course, there is a button where you can save the view as an image! The 3D view can be saved as a jpg file in a location of your choice by pressing “Save as image…”. Now you might be thinking: how can I export this 3D view? Well, there is a tool for that purpose too and you can find it next to this image saving tool (the coloured cube icon). This tool saves the 3D view itself as a file that can be opened in e.g. windows 3D builder. It creates 3D object and MTL file, so it can be opened with Blender for example. Good tool if you need further processing!

We are almost there! Only three tools left from this toolbar. Third tool from the right (that icon with an eye on it) is for setting the view theme. This function allows displaying different levels in the map view, which are from ready-made map themes. Next to this tool is the configuration menu which I introduced earlier. So, the last tool in this toolbar is “Dock 3D Map View”. This is selected by default, in which case the 3D view is displayed normally, but when this option is clicked off, the 3D map layer disappears and only the navigation buttons are visible in 3D view!

But who would use these tools and what for?

Then who could get the most from QGIS? Well, I would say everyone who needs a versatile GIS program for analyzing, visualizing and viewing spatial data! But of course there are usually different professional groups and organizations who have to take the most from open spatial data! These user groups might be for example city planners, architects, traffic planners, researchers…

Possible cases can be for example landscape analysis, modeling of new residential areas and placing buildings optimally in the environment. You can also create fly-by animations for others to visualize new projects. QGIS can also be useful when doing environmental impact assessment.On behalf of professional use, one big positive feature is also that you can create, for example, a building directly in the database and view it directly in QGIS. So, it can be concluded that with QGIS you can do same things as with commercial software. You could say that QGIS is suitable for nearly everyone and in every need…

If this article got you interested and excited about 3D data and you want to know more about possibilities of QGIS, drop us a message at info@gispo.fi !

This article was initially published at www.gispo.fi by Anni Jusslin (Gispo Ltd.).

--

--

Gispo Ltd.

A team of 21 GIS artisans from Finland. We solve spatial problems with open source solutions. https://www.gispo.fi/en