I have a SRTM DEM and I want to create a shaded relief from it. I created the shaded relief in GRASS and the result is very nice, but a little rough because the area is near flat and the DEM is 90m in resolution.

What I want is to make the DEM smoother in order to generate a smooth shaded relief. Is there an algorithm or interpolation method to do that?

Here is the shaded relief to get an idea, I want to flatten these small bumps:

Image

up vote 39 down vote accepted

How about John Stevenson's r.denoise, from the GRASS AddOns wiki:

r.denoise denoises (smooths/despeckles) topographic data, particular DEMs derived from radar data (including SRTM), using Xianfang Sun's denoising algorithm. It is designed to preserve sharp edges and to denoise with minimal changes to the original data.

mdenoise

I read further from this website (that I also give credit for the above animation) that a more generic method would be to use an Esri ASCII Grid file. The location of mdenoise (downloaded from Sun's website) needs to be in your PATH variable (e.g., Windows users: drop MDenoise.exe in the bin folder with your OSGeo4w or FWTools install). Then, for example, you can use the following shell command to process the ASCII grid file:

# gdal_translate -of AAIGrid my_dem.tif my_dem.asc      # convert to .asc
mdenoise -i my_dem.asc -n 5 -t 0.99 -o my_dem_DN.asc    # denoise
# gdal_translate -of GTiff my_dem_DN.asc my_dem_DN.tif  # convert back to .tif

Denoise is under GNU license, see here

  • Any python / gdal portage ? – Hugolpz May 6 '15 at 12:47
  • 1
    You can always run any command from Python. – Mike T May 7 '15 at 5:53
  • I mean a python equivalent which doesn't need R. – Hugolpz Jul 13 '16 at 21:24
  • 1
    This doesn't require R. From Python, use os.system('mdenoise ...') to run the executable. – Mike T Jul 14 '16 at 0:20
  • To clarify: The r. here stands for raster. The command is from GRASS GIS, not from R. – bugmenot123 Jul 21 '17 at 11:34

Tom Patterson, the lead cartographer at the U.S. National Parks Service has some excellent tutorials on working with DEM data to make beautiful shaded reliefs. Part of his workflow involves using Natural Scene Designer and Adobe Photoshop.

For my own workflow I like to use GDAL to resample the size of the DEM before rendering a shaded relief. This often helps with reducing the amount of detail and noise, not to mention file size. I have a tutorial on Github that demonstrates how to do this.

Basically the process is to specify a new width and/or height (in pixels) for an output DEM that is smaller than the original file size. For example doing:

gdalwarp -ts 3000 0 -r bilinear kings_canyon_2228.tif kings_canyon_2228_rs.tif

Will reduce the width of the DEM to 3000 pixels from the original width of 3800 pixels. Setting the height to 0 will let GDAL determine the best height of the new file based on the original's aspect ratio.

  • beautiful tutorials.. thanks – dof1985 Jul 17 '16 at 15:23

You could run a simple filter on the DEM - say, a 5x5 moving window average filter.

I used GIMP plugin wavelet noise reduction tool and I get good results and fast:

GIMP Plugin Wavelet noise reduction

enter image description here

enter image description here

  • I smoothed my raster (hillshade) however the file (tiff) has lost spatial reference. So, when I put it into my qgis project the one didn't overlay correctly with other layers. Have happened this with you? – Diogo Caribé Sep 23 '16 at 8:37
  • There are ways to reinject the geolocation. – Hugolpz Oct 3 '16 at 13:22
  • Yes, in QGIS export the hillshade in raster menu, and expor to to PNG. – SamTux Apr 3 '17 at 20:30

In ArcMap I like to use the Spatial Analyst>focal statistics tool to smooth out lidar prior to making contours...this might also help in your hillshading case. It's a similar function to the above post I believe.

  • oops, just read the GRASS part...well I'm sure there is a similar operation... – aug_aug Jul 29 '11 at 21:49

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.