I have a raster elevation map that has two tiers of known elevation, and I am trying to produce a raster that will smoothly contour the area between the two tiers with a gradient corresponding to the slopes between the known elevations. Basically, the interior boundary of the raster (and everything inside it) has an elevation of, say, 600m, and the outer boundary is at 624m. The black areas are zero values that will be snipped away and are irrelevant. I would like to generate contours between these two elevation values in a raster format to visualize the slopes between the two elevations. The final raster will be subtracted from a DEM to visualize an excavation accurately.

Please see the attached image of the raster example to see what I am working with. I am flexible with my methodology but I am trying to keep my workflow 100% within QGIS as I am sure there must be a solution here. I have been looking at many of the functions included in GRASS but have not been successful in getting them to generate contours based on this data.

enter image description here

  • What version of QGIS are you using?
    – jcarlson
    Mar 2, 2018 at 20:15
  • I was initially running 2.18.xx but have also tried 3.0.0 which is what my most recent attempts have been using. I will open up 2.18 again and follow JoshC's response, below.
    – M.R
    Mar 2, 2018 at 20:32

1 Answer 1


You may want to consider using the Interpolation plugin in conjunction with a vector layer.

Create a line vector layer in which you have two shapes similar to the rasters in your question, and assign them the appropriate elevation values.

lines with elevs

In QGIS 2.18:

Open the Interpolation plugin and enter the following:

  1. Input
    1. Vector layers: your_layer
    2. Interpolation attribute: elevation
    3. Click Add
    4. Select Type: Break lines
  2. Output
    1. Select Triangular interpolation (TIN)
    2. Set your columns and rows as you like, as well as the extent.
    3. Output file: your_output.tiff
  3. Click OK, then load your newly created raster:

new TIN

In QGIS 3.0:

TIN interpolation is now built-in, and can be found under Interpolation in the Processing Toolbox. The same settings from above can be successfully applied.

2 lines w/ elevation, tin tool visible

tin dialogue

interp tin in qgis3

You should be able to use this output with your DEM raster. If you need more than a two-point linear slope, simply add other intermediate lines in your vector layer before running the interpolation.

  • Thanks, Josh. This looks like my solution but can I ask what version of Q you are running? I get minidump crashes predictably when I try to interpolate my vector line layer using the settings you had above.
    – M.R
    Mar 2, 2018 at 21:28
  • I did this on 2.18, but could try to replicate it on 3.
    – jcarlson
    Mar 2, 2018 at 21:29
  • The interpolation plugin is not yet released for 3.0, unless I'm missing it.
    – M.R
    Mar 2, 2018 at 21:30
  • Edited my answer to include QGIS 3 instructions. The TIN interpolation is now built-in.
    – jcarlson
    Mar 2, 2018 at 21:43
  • 1
    Thank you, Josh, for really going above and beyond here. I have successfully built the contoured raster using your workflow but am now having difficulties getting the r.series to perform the operation on the two. One step forward... I imagine I would need to post a new question if I can't sort that out, so I've marked this as resolved. Thanks again.
    – M.R
    Mar 5, 2018 at 15:48

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.