3

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?

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Peter
  • 89
  • 1
  • 5
  • 1
    You might find a solution in one of the workflows submitted on this thread: http://gis.stackexchange.com/questions/130300/burning-road-network-into-dem – DPSSpatial_BoycottingGISSE May 05 '15 at 19:34
  • 1
    General procedures to change values in a DEM have been described at http://gis.stackexchange.com/questions/5239 and http://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 05 '15 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 08 '15 at 09: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 08 '15 at 10:03
  • the raster calculator text given in threads like this: http://gis.stackexchange.com/questions/33764/how-to-change-null-values-raster-values-to-0-in-qgis do not result in valid expressions so i'm at a loss. – Peter May 08 '15 at 10:05
  • @Peter did you ever find a solution to this problem? Or a work-around? Could you please share it with us? Thank you. – PeterB Feb 03 '17 at 23:39
  • This process worked perfectly for me using QGIS 2.18. I have not found a way to accomplish this so easily in QGIS 3.x – paddleman Mar 27 '19 at 17:52
  • This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review – Jakob Mar 27 '19 at 18:17

3 Answers3

5

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

Ed Rollason
  • 3,878
  • 2
  • 19
  • 34
1

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

RafDouglas C. Tommasi
  • 6,479
  • 1
  • 15
  • 41
-1

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 '17 at 04:05