Digital Geography

2. December 2013

create 3D visualizations: QGIS, GRASS and NVIZ

3D is soooo cool… Okay let’s be honest: the exciting times of Second Life are gone and the Oculus Rift is still not in sight in the end-user stores. But it is and was always cool to create you own 2.5D (we are using GIS not CAD, you know) visualization and make beautiful graphics for your papers or posters. It was always a big drawback for QGIS that ArcGIS was and is so good with ArcScene. But we’re proud users and we’ll use NVIZ. Let me show you how.

First thing you will need is a DEM. I love the SRTM data set as it is quite reliable and much better in my opinion than the comparable ASTER DEM (when it comes to flat terrain you may see cloud artefacts on the ASTER datasets) but I hope we’ll all benefit from the new world dem in a while . So we will start with a fresh download which gave us this dataset. Loaded into QGIS it looks really “boring” but we will deal with this:

SRTM data in QGIS using the add Raster function

 As we need NVIZ from GRASS we need to create a new region / mapset for our analysis. We start with this and give the raster more contrast after this: Make sure you have the GRASS plugin enabled and go to Plugins – GRASS – New Mapset :

This slideshow requires JavaScript.

First we need to import our raster data to the GRASS project. Therefore go to Plugins – GRASS – Open GRASS tools and open up the Modules List. Search for a function called r.in.gdal.qgis (the r stands for raster and not for R) and select your SRTM dataset as input and use a nice name for the output dataset which will look the same as the input once it is drawn in your GRASS project using the Plugins – GRASS – Import Raster dialogue or the show result button in the current function window

We will now clean up the imported raster data. First we need to get rid of the NULL values which are still coded as -32768. We will use a GRASS function called r.null.val! Therefore go to Plugins – GRASS – Open GRASS tools . In the Modules List you can filter by the name of the function and you will be shortly provided by the questions which raster to use and which value to be set to NULL. This will be -32768 in our case. This will result in a view on the data which looks worse than before. But now the r.colors.table function is our helping friend. Use the same raster as input and select the “Maps relative ranges of raster values to elevation color ramp” and your raster will shine like this:

raster after NULL-value processing and color table creation

As we have selected above our current region is a little wide for a 2.5D visualization. So we will create a smaller region to look at with the use of the dialogue Plugins – GRASS – Edit Current GRASS Region and draw the region on the map. Now we are ready to have a look in the 2.5D version using NVIZ in the GRASS tools: Just select the raster as the source for elevation and color and off you go by changing the size of this little fellow