I have 2 DEM raster in QGIS. I want to merge them, but they have a difference in height of approx. 9m. This means that when I merge them, there is a kind of break-off edge at the transition. Can I correct this somehow? For example, by saying that the values of raster 2 are shifted by 9 meters so that they are on the same height level or is there a special algorithm in QGIS for this?
1 Answer
If you need to do that just once, a rather simple way is to copy one of the DEM files with gdal_translate by using scaling https://gdal.org/programs/gdal_translate.html#cmdoption-gdal_translate-scale
There is a usage example later in the documentation
-a_scale
Set band scaling value. No modification of pixel values is done. Note that the -unscale does not take into account -a_scale. You may for example specify -scale 0 1 <offset+scale> to apply a (offset, scale) tuple, for the equivalent of the 2 steps: gdal_translate input.tif tmp.vrt -a_scale scale -a_offset offset followed by gdal_translate tmp.vrt output.tif -unscale
The description may be a bit unclear, but the 9 meter shift should go like this:
gdal_translate -scale 0 1 9 10 input_dem.tif output_dem.tif
It means "value 0 of the input will become 9, value 1 will become 10, and all the other values are converted linearly in the same way".