6

I am trying to patch two rasters with raster calculator but I am not finding the way to work with no-data values.

  • Lager@1 has some information I need as first option, this has as no-data -9999 (reading in the properties)

  • Lager@2 has the information I want to complete what is nodata in Lager@1

This command does not produce values where Lager@1 is no-data

("Large@1" != -9999) * "Large@1" + ("Large@1" = -9999) * "Lager@2"

I would like to avoid or skip the reclasification becase I might have many zeros and I need to perform this with diferrent rasters that might have different no-data formats, for instance Lager@2 has -99999 instead of -9999.

In GRASS this would be an r.patch task, but I cannot (or I do not know how to) control the order in the r.patch available in the Processing Toolbox.

r.patch input= Lager@1, Lager@2 output=Lager@3

Result of patching of two raster maps containing NULLs using the default settings

2
  • I checked the history of the toolbox and I found the command with r.patch and then I copied and edited for my needs (order of raster files) and pasted the processing.run("grass7:r.patch", {'input':... in the console. It worked, but it was not so frinedly as I would love QGIS to be
    – Marco
    Apr 9, 2020 at 10:07
  • Use Fill NoData cells (see docs.qgis.org/3.16/en/docs/user_manual/processing_algs/qgis/…), also possible in batch mode and change nodata values to 0. I don't know of a direct way, see: gis.stackexchange.com/q/420195/88814
    – Babel
    Mar 9, 2022 at 8:31

1 Answer 1

0

You can do this with r.patch, or using isnull() in r.mapcalc.simple, or using &&& or ||| operators.

2
  • Hi, is ´r.mapcalc` behind the QGIS Calculator? I did not find that information and it would open a door for all its functions and documentation, which is an essential part of a tool. Please confirm my understanding of "r.mapcalc (the QGIS calculator)"
    – Marco
    May 20, 2020 at 7:28
  • Sorry - I was incorrect. You're right, r.mapcalc is not the backend to the QGIS calculator. I've updated the suggestion. You can use r.mapcalc.simple instead of the QGIS calculator.
    – mankoff
    May 20, 2020 at 14:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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