Feature request #7581

raster calculator really needs support for conditional statements (to allow reclassify rasters)

Added by Giovanni Manghi over 6 years ago. Updated over 2 years ago.

Status:Open
Priority:High
Assignee:-
Category:Rasters
Pull Request or Patch supplied:No Resolution:
Easy fix?:No Copied to github as #:16517

Description

One of the most common tasks a user can do in a raster workflow is to reclassify raster maps.

At this stage the raster calculator does not support conditional statements, so it is not possible to say (for example):

([email protected]<=30)=1 OR ([email protected]>30)=2 OR ([email protected]>200)=5

the workaround is awful

([email protected]<=30)*1 + ([email protected]>30)*2 + ([email protected]>200)*3

as the raster calc just return 1 or 0, so the user must multiply for the needed value doing also a few sums along the way (because it is not possible to use conditions).


Related issues

Related to QGIS Application - Bug report #11682: Raster calculator produces only 0 values with conditional... Closed 2014-11-18

History

#1 Updated by Alexander Bruy about 6 years ago

Probably related to #4476

#2 Updated by Michael Douchin over 5 years ago

I agree. For example, we could use full expression syntax, such as

CASE
WHEN [email protected] > [email protected] THEN [email protected]
...
ELSE [email protected]
END

It is related to #4815 too

#3 Updated by Giovanni Manghi over 5 years ago

  • Target version set to Future Release - High Priority

#4 Updated by Luiz Andrade over 2 years ago

Agreed, this would be great!

#5 Updated by Giovanni Manghi over 2 years ago

  • Easy fix? set to No

Also available in: Atom PDF