I have 2 rasters of the same area, one has some null pixels and the other one doesn't and I would like to fill in the nulls in raster 1 by values from raster 2.

How to perform in raster calculator?


Before starting Raster calculator, there is an important first step.

(1) Uncheck Transparency - No data value

enter image description here

You will also note the actual value assigned as the No Data value. (above example is -99999).

(2) Start Raster calculator and try something like:

("Raster_a@1" = -99999) * "Raster_b@1" + ("Raster_a@1" != -99999) * "Raster_a@1"

enter image description here


r.patch from GRASS GIS commands is a safe way to do this. See the manual, they have nice example with NULL values there.


  • GRASS GIS 7 commands must be activated (should be by default): Processing > Options > Providers > GRASS GIS 7 > Activate
  • Find command in QGIS: Processing > Toolbox > r.patch

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.