QGIS – Smoothing Elevation Contours of Raster in QGIS

contourhillshadeqgis-3rastersmoothing

I am using QGIS 3.6.

I have raster of Europe map which I want to make a colored relief model.
After duplicating the layer, used hillshade on backward layer and colored the upper layer interpolation > discrete then 65 % transparency.
But the contour of color levels are not smoothed as the image shows.

enter image description here

Is there any way to do that?

Ex (photo): enter image description here

Best Answer

In my case, I have a DEM with continue values, going from 100 to 103 meters. The spatial resolution is 0.25 x 0.25 degrees, defined in EPSG:4326. The DEM is styled with a discrete color ramp with three classes:

1


To smooth it, first I will make a raster algebra. Because I want a raster with only three values. I am using the following formula:

("testDEM@1"  <= 100) * 100 +
("testDEM@1"  > 100  AND  "testDEM@1" <= 101) * 101 +
("testDEM@1" > 101 AND "testDEM@1" <= 103) * 103

2

Don't worry about its style, because it is an intermediate step:

3


For the smooting, I will use GRASS provider r.resamp.rst algorithm, in two steps. First, we need the slope output to use it as a smoothing raster. So run the algorithm without smooth raster. Set the spatial resolution and delete row/column overlap and spline tension values:

4

From the outputs, I have removed all of them except the slopes raster:

5


Finally, run the GRASS provider r.resamp.rst algorithm again, defining the slopes output as smoothing raster:

6

We just need the Resampled output. But now, we will style it with a linear interpolation instead discrete:

7


Now, you can use that raster with a 65% transparency over a hillshade:

8


External Reference:

Related Question