The road to 3D Topography

This tutorial will illustrate the process of importing and transforming Digital Terrain Models (DTM) or Digital Surface Models (DSM) into a .xyz or .csv file for further manipulation. DTMs and DSMs are commonly provided by municipalities as base data for planning tasks. However they usually come in the format GeoTIFF, a geo-located picture format, that is incompatible with most CAD programs. To transform the file into a usable three-dimensional topography model, several transformation steps have to be undertaken in QGIS. These steps will be illustrated in the following.

QGIS_Title


Importing DTM / DSM to QGIS

Download a set of GeoTIFFs from a website of your choice. This tutorial will focus on the Klopstockwiese in Zurich from Zurich GIS.

Since larger datasets are usually divided into smaller tiles the download of the selected area as shown in the picture below will likely contain several tiles. In this case your download will include four .tif files.

QGIS_ZH_GIS

Webpage of Zurich GIS, you can search for the location like 'Klopstockwiese' in the top left corner, and its below to find the map you need. Then you can click on the download button above the map and select the desired area to download.

After downloading the different tiles, they have to be unpacked and afterwards combined into one consistent raster file. For this step we are only interested in the .tif file from the download folder. Drag and drop those files into your QGIS workspace to load them. They are currently not connected and have their own colour range indication the height of that raster point. The breaks between the different sets are clearly visible below.

QGIS_LoadDOM_DTM

Window of QGIS, altenative to import GeoTIFF files: Layer > Add Layer > Add Raster Layer.


Merging Raster Layers

As previously mentioned, the downloaded content is typically separated into multiple files. We need to merge these files before proceeding to the next step.

QGIS_LoadDOM_DTM

Step 1: Go to Raster > Miscellaneous > Merge

QGIS_LoadDOM_DTM_II

Step 2: Select the raster sets you would like to combine by clicking on the three dots in the top right corner.

QGIS_LoadDOM_DTM_III

Step 3: Select the maps you want to combine and press OK.


Correcting the Raster Values

After merging, there will be a new layer called 'Merged' in the layer panel. You might notice that the values of the new file are not the same as in the original files (compare the maximum and minimum raster values). This inconvenience can be solved by adjusting the layer properties.

QGIS_LayerProperties

Step 1: Select the 'Merged' raster layer, right-click on it and navigate to Properties.

QGIS_LayerProperties_II

Step 2: Within the properties window navigate to Symbology and expand the Min / Max Value Settings tab by clicking on it.

QGIS_LayerProperties_II

Step 3: Within the Min / Max Value Settings change the accuracy from Estimate (faster) to Actual (slower). Click apply and close the properties window. Now the values should the same as your input layers.

Note: This is a purely cosmetic adjustment. The true values are still saved in the raster, meaning QGIS just estimates them for display purposes.


Clipping the Raster Layer

After the combination, the next step is to limit the raster layer to the area we want to export. Please make sure to choose a rather small extent - the bigger the extent the more computational power is needed in the following steps.

QGIS_ClippingLayerNew

Step 1: Select the 'merged' layer and go to Raster > Extraction > Clip Raster by Extent.

QGIS_LayerClipping

Step 2: In the field Clipping extent, click on the three points and choose Draw on Canvas. Alternatively you could use a preset rectangular shapefile as a clipping boundary. Click Run and close the window.

QGIS_LayerClippingII

Step 3: Disable the merged layer; the clipped extent may appear somewhat like this..


From Raster to Point

Now you should have a new layer 'Clipped(extent)' in the layer panel, to turn our raster data into a point set which we can import and open in Rhinoceros 3D, we have to use the Processing Toolbox. The toolbox offers a wide range of geoprocessing tools and has a surprisingly good search function.

QGIS_Toolbox

Step 1: To open the toolbox panel, go to Processing > Toolbox.

QGIS_Toolbox

Step 2: Search for and use the tool Raster values to points.

QGIS_RasterToPoint

Step 3: Click on the three dots in the to right to select the desired raster layer for the transformation.

QGIS_RasterToPoint

Step 4: Select the 'Clipped (extent)' layer and press okay. For the Type field in the following window, choose (0) nodes and press Run. The calculation might take a while.

QGIS_RasterToPoint

Step 5: The result of this calcualtion should be a layer called 'Shapes', containing various points. Right-click on the layer 'Shapes' and select Attribute Table, you can have a look at the data of each point like the image shows.


Exporting Points as CSV

Now we are ready for exporting. Navigate to the 'Shapes' layer, right-click and select Export > Save Features As. Within the exporting panel perform the following actions:

QGIS_RasterToPoint

  1. Select CSV (Comma Separated Values) as a file format.
  2. Select a place to save the file and give it a name
  3. Untick the box ID.
  4. Click OK to start the export.

Final Adjustments

If you open the exported file in a text editor it will look somewhat like the screenshot below. To make this code readable for the Docofossor plugin we need to delete the first line (marked in the screenshot) and save the file again. If your file is too heavy to open in a text editor it is likely to be too heavy for any of the next steps. Crop the raster extend a bit more and try again.

QGIS_AdjustmentCode

Screenshot of the exported csv file



ETH LogoDArch LogoDesign++ LogoBA LogoLVML Logo
© 2023 Digital Design Methods™