I have two raster layers of elevation data. One, of a larger extent, - 'warped' - is to 25m definition. The other, of much smaller extent - '194555-1_25cm_DSM' - but within the bounds of the larger raster, is to a definition of 25 cm. Using QGIS, I want to create one raster layer the size of the larger raster, that uses the elevation values of the "194555-1_25cm_DSM layer within the bounds of that smaller area, but uses elevation values from 'warped' in the area outside the smaller layer.

I have already made the cell sizes in both raster layers the same by using warp, so all cell sizes are now 0.25 in both layers. I have tried various things, but none have given me the result I need.

I did try the raster calculator with an IF clause as follows

if ( "194555-1_25cm_DSM@1", "194555-1_25cm_DSM@1" * 1,"Warped@1" * 1 ) 

but that gave me 194555-1_25cm_DSM values in that area, and no_data values elsewhere.

I think maybe I need something like a 'difference' operation, for raster layers.

Here's a screenshot of the smaller raster lying on the larger. enter image description here

  • What software are you using?
    – John Polo
    Mar 18, 2023 at 23:56
  • Sorry, should have said. QGIS 3.24.2 Tisler. Mar 19, 2023 at 7:23

1 Answer 1


The problem are the "no data" values! Try the following:

  1. Replace the "no data" values by e.g. -9999 with the tool "Fill NoData cells" from the toolbox

  2. Use the raster calculator with an IF clause as follows

    if ( "194555-1_25cm_DSM@1" > -9999 , "194555-1_25cm_DSM@1" * 1,"Warped@1" * 1 )

  • That worked well, thank you oekoplaner. Of course it was the 'no data' cells, which equate I suppose to NULL in the if test, which got in the way. In fact I ended up with 3 calculated raster layers, because each operation required output to a new layer. But essentially using the principal of making sure every cell had a value, and then testing for those value ranges got me the result I required. I am left with the next problem to solve - where the high res area meets the low res area surrounding it, there is a significant jump in cell values, or elevation. I need to smoothe these somehow. Mar 20, 2023 at 10:36

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.