Search code examples
gdal

GDAL hillshade artifacts


I'm using gdal to create different kinds of layers, such as color reliefs and hillshades, and Mapnik to combine them into a single image to use as texture for the 3D dem model obtained from a single .hgt file.
Premising that I'm new to gdal, I'm facing some problem with the hillshade layer.
By using the gdal command:
gdal_translate N44E007.hgt N44E007.tif

I get the N44E007.tif file, which in IrfanView looks like this

N44E007.tif in IrfanView

With the following gdal command:
gdaldem hillshade -of PNG .\tif\N44E007.tif .\hillshade_png\N44E007_hillshade.png

The N44E007_hillshade.png file I get is the following

N44E007_hillshade.png

How can I prevent gdal from creating these artifacts in the hillshade .png?
I'm using Windows 7 and cmd.


Update 1

This is the image I get by replacing gdal_translate N44E007.hgt N44E007.tif with gdalwarp -t_srs EPSG:32632 -r bilinear N44E006.hgt N44E006.tif

N44E007_reprojected_hillshade.png
The problem is that the reprojected image is slightly rotated and stretched. How can I get a squared and straight image to use as texture for a 3d plane?


Solution

  • The reason for the artefacts in the first attempt is because the raster horizontal distance units are in degrees, and the vertical are in meters. You can use a scale option to normalise horizontal and vertical distance units, e.g. try:

    gdaldem hillshade -s 111120 -compute_edges -of PNG N44E007.hgt N44E007_hs.png
    

    N44E007_hs.png

    The second attempt (Update 1) reprojects to WGS84 UTM zone 32, which is a transverse Mercator projection centred on a meridian at 9°E, which is close to the SRTM raster, which is centred on 7.5°E. Since the two meridians are not the same, it is expected the raster to be rotated. And it is stretched since the true distance of degrees are not equal in N-S and E-W directions, except at the equator.