I've tried searching through the existing questions but am struggling to find a succinct answer to what I am trying to achieve.

For background, I am running a flood model in TUFLOW to help support a residential development on greenfield land. Part of the site has been shown to flood in a given event and I now want to reprofile areas of the land to allow additional flood storage. The hope is that with the reprofiled land, the flood extents will be greatly diminished and so there will be more land available to the development.

I have drawn polygons in QGIS over the exact areas that will need to be lowered by specific amounts i.e. the land in one area varies from 66.42-66.73m AOD. This will now be a uniform 66.10m AOD.

Is there a way of simply modifying the existing raster DEM file using the polygons?

  • 1
    You might find a solution in one of the workflows submitted on this thread: gis.stackexchange.com/questions/130300/… May 5, 2015 at 19:34
  • 1
    General procedures to change values in a DEM have been described at gis.stackexchange.com/questions/5239 and gis.stackexchange.com/questions/5675. The common idea is to use the conditional operator of raster algebra to replace parts of one layer by values of a second according to logical values in a third layer.
    – whuber
    May 5, 2015 at 19:43
  • thank you very much for the replies. I've had a look through the threads you gave. To date, here's what I found in steps. 1. convert the polygon to raster using the Raster>Conversion>Rasterise tool. 2. Subtract the new rasterised layer from the existing DEM using "OriginalDEM@1" - "Rasterised_Polygon_extent@1". In theory you should then be able to subtract the resulting layer from the original DEM to give the layer you want. Unfortunately, nothing explicitly states what you would need to enter into the Raster Calculator to get rid of the null values.
    – Peter
    May 8, 2015 at 9:57
  • The null values (no data) means that the subtraction doesn't work and any extents outside of the original polygon extent will simply come back as no data (the original DEM value - null values results in null values) and so is not usable in my model.
    – Peter
    May 8, 2015 at 10:03
  • the raster calculator text given in threads like this: gis.stackexchange.com/questions/33764/… do not result in valid expressions so i'm at a loss.
    – Peter
    May 8, 2015 at 10:05

3 Answers 3


This is actually quite easy (I do it frequently in exactly the same scenario as you're describing) but isn't well documented. What you need to do is to use the rasterise tool.

What you need to do is:

  1. Make a copy of your DEM (because you're going to modify it and just in case...)
  2. Open the rasterize tool (Raster -> Conversion -> Rasterise)
  3. Select the polygon as your vector input and the relevant field as your elevation. Now select the DEM as your output raster, you'll be prompted to overwrite it and you can say yes.
  4. Make sure the "maintain existing raster size and resolution" option is checked
  5. Hit go - your original DTM will be added to the TOC but with the area of the polygon set to the elevation you specified in your shapefile

This approach also works for polylines (excellent for setting defence crests) and for points (excellent for specifying the elevation of outlet and inlet cells for 1d networks.

Here's a very crude example:

  1. The original DTM

enter image description here

  1. The crude polygon

enter image description here

  1. The edited DTM showing the area of the polygon set to 5m

enter image description here


QGIS Version 3.x update

Building upon Ed Rollason's excellent answer (which used to work with QGIS 2.x, and is unfortunately not applicable on QGIS 3.x any londer), one now needs to use Rasterize (overwrite with attribute), which can be found under the Processing Toolbox:

enter image description here

The settings are simple, but beware that the raster is going to be overwritten (as the name implies), so remember to work on a copy of the original raster:

enter image description here


to get rid of null values you need to use 'SAGA > reclassify Raster' and set options to set null values to zero

  • Welcome to GIS SE! As a new user be sure to take the Tour to learn about our focussed Q&A format. Your answer here does not seem to match the question being asked.
    – PolyGeo
    Aug 25, 2017 at 4:05

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.