In QGIS, I had a larger DEM that captured the lake surface and a smaller DEM of the lake bathymetry. I spent a while trying to figure out smart ways to combine the two so as to replace the DEM lake surface with the bathymetry. What worked is using the GDAL merge because it apparently favors the last of the overlapping rasters and the bathymetry happened to be last. If that helps anyone else in my predicament then this post will be worth something.

However I am curious if there is a "better way" to replace the values in one raster file with overlapping values in another (the order of the raster in merge seemed slightly arbitrary and hard to control). It seems so incredibly basic a task I am sure there must be some simple function I am overlooking.

This is very similar to this post, however, the answer would not work as it outputs a raster the size of the smaller bathymetry DEM.

The Saga Mosaic Raster tool with "minimum" set for the "overlapping Areas" also seemed promising, but so far it seems that the tool is broken. I either get incorrectly shaped files or a raster without CRS info. I can't make head or tail of it.

1 Answer 1


If the DEM covers larger area than the bathymetry data then gdalwarp https://gdal.org/programs/gdalwarp.html should work pretty well. Use the existing DEM file as output, bathymetry file as input, and restrict the area that gets updated in the DEM file with a lake shoreline polygon. Don't overwrite the DEM file because you want to keep the heights around the lake. Excerpt from the gdalwarp docs:

The destination file name.

Mosaicing into an existing output file is supported if the output file already exists. The spatial extent of the existing file will not be modified to accommodate new data, so you may have to remove it in that case, or use the -overwrite option.

Polygon cutlines may be used as a mask to restrict the area of the destination file that may be updated, including blending. If the OGR layer containing the cutline features has no explicit SRS, the cutline features must be in the SRS of the destination file. When writing to a not yet existing target dataset, its extent will be the one of the original raster unless -te or -crop_to_cutline are specified.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.