6

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

6
  • 1
    An example of how your map looks would be helpful. Commented Dec 27, 2019 at 19:27
  • There is an example and what I want to do is to make smooth the contour line between colors as the example have.
    – Iven Pepa
    Commented Dec 27, 2019 at 19:39
  • 1
    Please edit your question to show the pictures
    – Ian Turton
    Commented Dec 27, 2019 at 19:46
  • 1
    Have you created a polyline feature using the contour lines? If so you can use the simplify/smooth tool in qgis to accomplish this.
    – Kartograaf
    Commented Dec 27, 2019 at 22:37
  • @Kartograaf, your answer was really useful and I think that you deleted it? If you can rasterize the smoothed contours the output will look great. Commented Dec 28, 2019 at 5:12

2 Answers 2

8

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:

2
  • I'm trying in this way as you explained step by step but i have some problems during the r.resamp.rst process. At the first step after finishing r.resamp.rst process checking only the slope raster, at log window is an ERROR 6: SetColorTable() only supported for Byte or UInt16 bands in TIFF format. although the process finished resampling slope raster. So, at the last step using r.resamp.rst > selecting output and slope raster > same resolution (200 cell size) > deleting Rows/columns and Spline tension > result : ERROR: Map <rast_5e1f80a7de6704> is the wrong resolution, and couldn't finish.
    – Iven Pepa
    Commented Jan 15, 2020 at 21:20
  • @IvenPepa, Hi. The ColorTable error is not important, a color table cannot be written for float format values, but we are not interested in the color table. The problem is with the resolution when running the algorithm again. If the CRS is a geographic one, the resolution of 200 degrees is not possible. If you cannot solve the resolution problem, please start a new question about all detailed steps to reproduce it and a complet log paste in your question. Commented Jan 15, 2020 at 22:35
6

There are several tools that exist in qgis to smooth contour lines as opposed to smoothing the raster itself , including vector->geometry->simplify, the vector geometry tool "smooth", and the GRASS function v.generalize.

Personally, I like the results of the SAGA module line smoothing ("http://www.saga-gis.org/saga_tool_doc/2.2.2/shapes_lines_7.html), and the results in the sample data I used look pretty similar to what you provided.

To use it, make sure you have the SAGA installed (https://sourceforge.net/p/saga-gis/wiki/SAGA%20Installation/) then select the tool from the processing toolbox (#1). Use the method drop-down menu to select the improved iterative averaging (SIA) algorithm (#2).

instructions

Before:

before

After:

after

You can then convert the lines back to raster format via GRASS package's r.surface.contour or similar. Creating a contour raster from contour lines shapefile

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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