[gdal-dev] Hillshade | Raster Band Rendering

Gareth Grewcock garethgrewcock at gmail.com
Mon Mar 23 03:03:54 PDT 2015


Hi - I really appreciate all of your help so far. I am still looking into
this though but will get back to you as soon as I have a solution.

Cheers - Gareth

On Wed, Mar 18, 2015 at 6:17 PM, Joaquim Luis <jluis at ualg.pt> wrote:

>  My objective is to create a hillshaded color-relief image of a DEM using
> commandline/programmatic means only, so the process can be automated and
> combined within an existing GMT/GDAL workflow.
>
>
> If your workflow includes GMT that you have a reach panoply of methods to
> do shade illuminations. See man pages of grdgradient and grdhisteq.
>
> Joaquim
>
>
>
> Currently, I can generate both hillshaded and color-relief rasters using
> gdaldem and combine them with Mapnik (using opacity) to generate a my final
> rendered image. However, this process will use the min-max values in the
> grayscale hillshaded image.
>
>
>
> However, I can achieve an improved or sharper hillshaded image when I
> manually use QGIS to further process the hillshaded image by:
>
> 1. Adding the hillshaded raster to QGIS, which applies by default the
> 'Cumulative count cut 2% - 98%' style.
>
> 2. Then export the hillshaded raster (with the cumulative count style
> applied) as a “Rendered Image”.
>
>
>
> I have annotated a screenshot here
> https://www.dropbox.com/s/ftzk7j2bmznuvjn/raster_band_rendering.png?dl=0
> hopefully illustrating the
>
> 1.    Improved hillshaded raster output from QGIS ('Cumulative count cut)
> compared with,
>
> 2.    gdal+mapnik output (using min-max)
>
>
>
> So, is there an approach using gdal (or similar command-line tool/app) to
> achieve the “improved” hillshaded raster without the “manual” QGIS step?
>
>
>
> As I see it, my options are:
>
> 1. Use gdalinfo with the “-hist” option to export the histogram of the
> hillshaded raster. I guess then I could maybe calculate the 2% and 98%
> percentile(?) values and then manipulate the raster values using
> gdal_calc.py or something else.  However, I’m no statistician, so hoped
> there would be an out of the box solution?!
>
> 2. Maybe, I could use the python api for QGIS to import the hillshade,
> render, style and export back out. I’m sure this is possible, but would
> require an additional python script.
>
> 3. Use another library or framework to achieve either of the above. I’ve
> researched python’s numpy library, which maybe I could do the percentage
> calculation directly on the raster. Again, potentially tricky learning
> curve there…
>
>
>
> Any help or advice would greatly appreciated. If any help, the data I’m
> using is here
> https://www.dropbox.com/s/v0peaa3rzaqbhen/raster_band_rendering.zip?dl=0
>
>
>
> Cheers
>
>
> Gareth
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20150323/693a9102/attachment.html>


More information about the gdal-dev mailing list