Feature request #12984

raster calculator conditional statement

Added by ilaria marengo almost 9 years ago. Updated almost 9 years ago.

Status:Closed
Priority:Normal
Assignee:Victor Olaya
Category:Processing/QGIS
Pull Request or Patch supplied:No Resolution:duplicate
Easy fix?:No Copied to github as #:21062

Description

It would be possible to implement a conditional statement like in SAGA grid calculator
to allow an easier setting of no data to a value? e.g. 0?
In SAGA
ifelse(gt(raster1, 0), raster1, 0)

means:
if raster1 is gt (greater than) 0, then keep raster 1, else give the pixels value of 0

In GRASS in r.calc it is possible to run

if(isnull(raster1),0,raster1)

but the original (not null) data strangely are different and i cannot understand what happens. The formula of Grass is the same one of the tool called fill nodata.

In QGIS, for raster calculator, i saw example like
(raster1 >190) * raster1

which in reality create a mask.
Is there any conditional statement in QGIS?

History

#1 Updated by Nyall Dawson almost 9 years ago

  • Resolution set to duplicate
  • Status changed from Open to Closed

Duplicate of #4476

Also available in: Atom PDF