2

I'm trying to figure a way to output some nice vector features out of a raster DEM in order to have a pleasant visualization on a vector map. I was first trying to play with some algebraic manipulations and combinations between the DEM itself, the hillshade, aspect, slope, TPI, TRI, and many more kernel based approaches...

TPI
TPI (Topographic Position Index)

Slope
Slope

Aspect
Aspect

Hillshade
Hillshade

DEM
Actual underlying DEM

But I quickly noticed that the possibilities are almost infinite in the space of derived raster that you can compute from a single DEM.

Based on this observation, I was wondering if there are any 'good practices' to render nice elevation maps in a vector form from a raster DEM. But this question is unfortunately too broad and may be opinion based, even if I am intimately convinced that it can be the subject of genuine scientific research, with all its rigor, at the intersection between the disciplines of GIS and imagery visual perception.

Among my researches, I found this nice QGIS algorithm which I never seen before -- this may be because it is quite well hidden; it does not exist in any of the Raster sub-menus --, called "Relief" and which output looks like:

Relief
QGIS Relief
Its documentation is here at the time of writing: https://docs.qgis.org/3.16/en/docs/user_manual/processing_algs/qgis/rasterterrainanalysis.html

I usually like to go under the hood and watch what's going on, and I was expecting a bunch of GDAL commands here, because one can see on the resulting image that at least three algorithms have been used (the computation of some contours, a TPI, and a hillshade). So I looked at the console output, but it is surprisingly quiet:

Loading resulting layers
Algorithm 'Relief' finished
QGIS version: 3.16.3-Hannover
QGIS code revision: 94ac9f21b8
Qt version: 5.9.5
GDAL version: 2.4.0
GEOS version: 3.7.1-CAPI-1.11.1 27a5e771
PROJ version: 493
Processing algorithm…
Algorithm 'Relief' starting…
Input parameters:
{ 
  'AUTO_COLORS' : True,
  'COLORS' : '',
  'INPUT' : '/media/data/gis/DEM.tif',
  'OUTPUT' : 'TEMPORARY_OUTPUT',
  'Z_FACTOR' : 5
}

Execution completed in 1.05 seconds
Results:
{
  'FREQUENCY_DISTRIBUTION': '',
  'OUTPUT': '/tmp/processing_1g3wgU/63301c1a5/OUTPUT.tif'
}

Loading resulting layers
Algorithm 'Relief' finished

I now want to tweak, experiment and configure this algorithm on a headless server where QGIS is not installed (but where GDAL is), hoping I can get some results for my desired vector features out of it.

Hence the first question that came to my mind was; is the QGIS Relief algorithm only based on GDAL commands? Because it looks so to me. And as kindly commented by @user2856 it seems that it's a native QGIS algorithm: https://github.com/qgis/QGIS/blob/master/src/analysis/raster/qgsrelief.cpp

Question

So, how close to the Relief result could we go using a combination of GDAL based tools only?

Other interesting links I came across:
https://www.nature.com/articles/sdata201840.pdf
https://blog.datawrapper.de/shaded-relief-with-gdal-python/
https://grass.osgeo.org/grass78/manuals/addons/r.geomorphon.html

3
  • 1
    It's a native QGIS algorithm, not GDAL. – user2856 Feb 21 at 20:32
  • Argh, c++! :D Okay. And a lots of great devs by the way. I wish there was an equivalent GDAL suite of commands to generate such a nice output... But the algorithm seems to already be based on some gdal utils... hmmm... – s.k Feb 21 at 21:03
  • 1
    @s.k gdal is mostly used to read and write to raster has it has the driver side of things. The rest of the to create the fancy render is in c++. – Al rl Feb 21 at 22:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.