I've been given a raster with flood elevation limits along a river, it's not a constant flood level so elevations range by ~35m. I need to do an analysis of the impacts if these elevations were 2m higher - I know I can raise the elevations in the raster calculator, but how can I project where the new limits would fall horizontally on the underlaying surface raster?
2 Answers
How about this:
If you subtract the original DEM from the flood elevation raster, you will get water depth. All areas with positive values are flooded (positive water depth) and all areas outside the flood are negative. Now add 2 meters to this new raster, and then extract all pixels with positive values. This should become the new flood limits.
(Caveat: adding a constant water level to a flood plain is not really the correct way to map a new flood event. There are flow constraints that would cause the new flood plain to have new, varying flood levels)
@Marco, Regarding NULL values...
Since the flood elevation raster might have NULL values outside the extent of the flood, the arithmetic operation of subtracting would return NULL values for all those pixels. Here are two ways to deal with that using GRASS GIS.
GRASS GIS has a module r.null
which can be used to "artificially" set all NULL pixels to some value. So in this case, a new flood elevation raster could be prepared using (assuming the flood elevation is named "flood_elevation"):
r.null flood_elevation null=0
Then the subtraction would not return any NULL pixels.
A second option, without changing the flood elevation raster, would involve a raster calulcator expression to catch NULL pixels in the flood elevation, as follows (assuming the original DEM is named "DEM"):
r.mapcalc "flood_depth = if(isnull(flood_elevation), 0 - DEM, flood_elevation - DEM)"
Either method should avoid NULL values in the result.
-
I think it is very clever, but I miss something. I have always struggled with operations with NULLs and this seems to have one, so I draw the case. Let´s say there is a cell near a flood area, the cell at +21 m and water level at +20 m. How do I get value -1 m out of the water depth operation? I need to extend the water flood raster with the values at it edges, how can we do that?– MarcoFeb 5, 2021 at 16:58
-
Like Micha's answer correctly notes, technically you'd have to recompute water levels. Anyway, taking a glance at your map, if you want a pragmatic approach, I'd do the following:
- Take the flood levels, add 2.0 m
- Do a nearest neighor fill
- Subtract the DEM
- Categorize positive and negative
All of these steps can be done with the QGIS raster calculator, and you should be able to do the nearest neighbor fill using the GDAL > Raster analysis > Fill nodata
option in your QGIS Processing Toolbox.
I'd expect this to give a "good enough" answer for > 95 % of your area. Near sharp transitions, it might not go exactly as you want, but you could always do a little touching up of the of the filled raster, using e.g. this plugin to select some cells and change their values: