Intro to QGIS3 3D view with Viennese building data
In this post, I want to show how to visualize building block data published by the city of Vienna in 3D using QGIS. This data is interesting due to its level of detail. For example, here you can see the Albertina landmark in the center of Vienna:
an this is the corresponding 3D visualization, including flying roof:
To enable 3D view in QGIS 2.99 (soon to be released as QGIS 3), go to View | New 3D Map View.
Viennese building data (https://www.data.gv.at/katalog/dataset/76c2e577-268f-4a93-bccd-7d5b43b14efd) is provided as Shapefiles. (Saber Razmjooei recently published a similar post using data from New York City in ESRI Multipatch format.) You can download a copy of the Shapefile and a DEM for the same area from my dropbox. The Shapefile contains the following relevant attributes for 3D visualization
- O_KOTE: absolute building height measured to the roof gutter(?) (“absolute Gebäudehöhe der Dachtraufe”)
- U_KOTE: absolute height of the lower edge of the building block if floating above ground (“absolute Überbauungshöhe unten”)
- HOEHE_DGM: absolute height of the terrain (“absolute Geländehöhe”)
- T_KOTE: lowest point of the terrain for the given building block (“tiefster Punkt des Geländes auf den Kanten der Gebäudeteilfläche”)
To style the 3D view in QGIS 3, I set height to “U_KOTE” and extrusion to
O_KOTE-coalesce(U_KOTE,0)
both with a default value of 0 which is used if the field or expression is NULL:
The altitude clamping setting defines how height values are interpreted. Absolute clamping is perfect for the Viennese data since all height values are provided as absolute measures from 0. Other options are “relative” and “terrain” which add given elevation values to the underlying terrain elevation. According to the source of qgs3dutils:
AltClampAbsolute, //!< Z_final = z_geometry AltClampRelative, //!< Z_final = z_terrain + z_geometry AltClampTerrain, //!< Z_final = z_terrain
The gray colored polygon style shown in the map view on the top creates the illusion of shadows in the 3D view:
Beyond that, this example also features elevation model data which can be configured in the 3D View panel. I found it helpful to increase the terrain tile resolution (for example to 256 px) in order to get more detailed terrain renderings:
Overall, the results look pretty good. There are just a few small glitches in the rendering, as well as in the data. For example, the kiosik in front of Albertina which you can also see in the StreetView image, is lacking height information and therefore we can only see it’s “shadow” in the 3D rendering.
So far, I found 3D rendering performance very good. It works great on my PC with Nvidia graphics card. On my notebook with Intel Iris graphics, I’m unfortunately still experiencing crashes which I hope will be resolved in the future.