Advertisements

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.

Advertisements
18 comments
  1. Hello, I have to recover well the data and follow-up your instructions but:

    1. I do not see appearing in the data line DIFF_O_U: difference between O_KOTE and U_KOTE

    2. Don’t I have pas de returned 3D of the layer of construction???

    3. Is this a problem of graphic card? I use version 2.99 of QGIS. Thank you for your answer. Maths

    • You can compute DIFF_O_U using the expression O_KOTE-coalesce(U_KOTE,0).

      I don’t understand your second question, sorry. Feel free to post in French and I’ll try my luck with Google translate.

      • Oui désolé pour cette très mauvaise traduction. Le problème est que je ne parviens pas à avoir un effet 3 D. J’ai pourtant téléchargé la version 2.99 de QGIS et suivi vos instructions. Mais je n’ai pas d’effet 3d. Je dois faire une erreur quelque part.
        Merci pour votre repone.

        Math

      • Merci beaucoup. Je vais à nouveau faire la manipulation à partir de vos données. Je vous tiens au courant et vous remercie encore d’avoir pris la peine de me répondre. Math.

      • Je viens d’essayer à nouveau avec vos données mais je n’ai toujours pas l’effet 3D.

        1. Je mets la hauteur sur U_KOTE à l’aide de l “Assistant”

        2. Je mets l’extrusion sur DIFF_O_U à l’aide de l'”Assistant”

        Mais rien ne se passe ??

        Est-ce un problème lié à une mauvaise manipulation, de version de la 2.99 ou de carte graphique ??

        Encore merci pour votre aide.

        Math

      • Can you provide a few screenshots? It’s hard to guess what might be wrong. When did you last update your 2.99 install? (Mine is 2 days old.)

      • Re-bonjour,

        Je viens donc d’installer cette version de QGIS 2.99 :

        http://qgis.org/downloads/weekly/?C=M;O=D

        Mais je n’ai toujours pas de 3D sur ma couche de construction.

        J’ai plusieurs captures d’écran mais je ne sais pas comment les insérer ici.

        Math

      • Those size assistant settings don’t look right to me and you don’t need it. Instead, set the value directly as shown here:

        Use the middle mouse button to tilt the camera in 3D view so you can actually see the results.

      • Une autre capture d’écran où j’ai bien essayé de jouer avec la molette de la souris et fait varier l’orientation…

      • Bon, je vais d’essayer avec un autre ordinateur et cela semble fonctionné…mais la partie supérieure. Est-ce normal ?

        Bonne fin de journée et encore merci.

        Math

      • Looks good.

      • Merci beaucoup pour votre aide votre grande patience.
        Au plaisir de vous lire…J’ai déjà appris beaucoup de choses avec vos ouvrages dont qgis_map_design.

        Bonne fin de soirée,

        Math

  2. On my notebook with Intel HD Graphics 5500 it mostly crashes when enableing the 3d renderer for the building shapes. Only when the notebook is restarted and I start qgis the first time, then it works…but thanks for that example. Would you mind, if I use your example in a qgis3 workshop?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: