QGIS is a very powerful application when it comes to free GIS. One of its potentialities is the possibility of developing plugins that allow specific tasks to be carried out, such as 3D views. These plugins are developed by the community and are flexible tools that allow to increase the already high QGIS capabilities.
While QGIS 3.0 includes direct support for 3D visualization, one of the most comprehensive plugins for 3D visualization is Qgis2threejs developed by Minoru Akagi. This plugin allows you to export terrain (elevation), image and vector data to your web browser. The exported data can be viewed (and interacted with) in any web browser with WebGL support.
Requirements: QGIS installed, qgis2threejs plugin installed (can be obtained from the website indicated or through the QGIS add-in manager), web browser with WebGL support (I use Chrome or Opera, although it works on Firefox and Edge).
Development of the exercise
In QGIS I have added 3 vector layers and 2 raster layers. The vector layers correspond to the boundary of a basin (red), a small hydrographic network (blue) and points representing rainfall stations in the study region (green). The raster layers correspond to a digital elevation model and an orthophoto.
All the information is projected in the same coordinate reference system. The plugin can export altitude information, to visualize it in 3D, with images and vectors, so the most important layer to be able to represent in 3D is precisely the layer that contains the height information, in this case the digital elevation model.
Installed the plugin appears on the QGIS toolbar . Clicking on the button opens the plugin dialog box.
The key part of the configuration is the selection of the MDE layer (which provides the height information) in this case, by default the shaded layer is chosen, however, I select the MDE.
The height values in the MDE layer are those that will be represented in the complement output, that is to say, the information that will give the perception of relief, any error or artifact in this layer will generate errors in the visualization of the same.
In the Display type options, we can choose 4 options, the first one (Map canvas image) will display on the relief generated by the selected MDE, which at that moment we have displayed in our QGIS viewer. For this reason it is important to plan ahead for what we want to represent. The second option displays a selected layer on the relief, the third option an image file and the fourth option only displays the relief with a selected solid color.
Once you have selected the options in the dialog box, click Run. A new tab will open in the default browser, in which the 3D visualization of our model will appear. Additionally, the html file generated by qgis2threejs can be saved for later access.
The following images show the difference between the display of only the DEM and the vector layers and the second image, the same relief, but covered with the orthophoto of the study area.
Advanced Qgis2threejs options
The above procedure, one could say, is the basis of the plugin. However, their capabilities are a bit greater. The plugin offers the ability to customize vector layers for representation in the 3D model. In the following image, when choosing the layer of stations, you can customize the representation of the symbols of that layer in the 3D visualization, in this case, you choose cylinders to represent the stations, which will be red.
When you export, you get the following display:
In addition, the vertical exaggeration of the visualization can be configured, a tool that is particularly useful in areas where the height contrast is not very high and certain features of the terrain need to be enhanced.
The resulting display will be:
In which you can clearly see that the relief is somewhat exaggerated. However, it allows a better visualization of the terrain shapes.
Conclusions and recommendations
- The Qgis2threejs add-on makes it very easy to visualize digital elevation models from QGIS in 3D.
- Complementarily, vector layers can be displayed dynamically, with custom symbology (3D).
- The complement allows the visualization of reliefs covered with aerial photographs and satellite images (as long as it is well georeferenced).
- It has certain limitations for exporting to image formats directly, however, it can easily handle HTML files.
- Additionally, it allows the 3D labeling of vectorial layers (based on an attribute).
- Despite its limitations it is an excellent choice for simple (and not so simple) three-dimensional representations.
Written by: Marlon Calispa
If you want to send the end result to somebody to view in there web browser what files/folders do
you need to send them?
Can I have the Data you used to create this tutorial please?
Hi, well done, but there are some limitations f.e. in creation DHM from high Point density (at least 1m) on 42 hectares.