Feature request #4476

Add a 2 cases if() command to Raster Calculator

Added by alobo - over 5 years ago. Updated over 1 year ago.

Status:Feedback Start Date:11/01/2011
Priority:Normal Due date:
Assigned to:- % Done:

0%

Category:Rasters
Target version:Future Release - Nice to have
Platform:all Resolution:
Platform version: Pull Request or Patch supplied:No
Status info: Tag:

Description

An if() command with 2 cases output would be most useful:

if(condition, result1, result2)

where the output value is result1 if condition==T and result2 otherwise.

Agus

History

Updated by alobo - over 5 years ago

  • Category set to Rasters
  • Target version set to Version 1.7.1
  • Platform set to all

Updated by Tim Sutton over 5 years ago

  • Target version changed from Version 1.7.1 to Version 1.7.2

Updated by Giovanni Manghi over 5 years ago

  • Target version changed from Version 1.7.2 to Version 1.7.3

Updated by Giovanni Manghi over 5 years ago

  • Target version changed from Version 1.7.3 to Version 1.7.4

Updated by Giovanni Manghi almost 5 years ago

  • Target version changed from Version 1.7.4 to Version 2.0.0

Updated by Pirmin Kalberer over 4 years ago

  • Target version changed from Version 2.0.0 to Future Release - Nice to have

Updated by Médéric RIBREUX over 1 year ago

  • Status changed from Open to Feedback

Hello, bug triage...

the raster calculator can handle conditions but the expression is not so easy to understand:

("elevation@1" < 50) * 1 + ("elevation@1" >= 50) * 2

will make cells with a value less than 50 have a value of 1 and cells with a value greater than or equal to 50 have a value of 2.

Was your feature request about a way to have conditions in the raster calculator or about the syntax of the condition ?

Updated by alobo - over 1 year ago

Well, that syntax is really odd, I had not even thought on it.
I guess that
if(condition, result1, result2)
would be a lot more transparent and easier to remember

Also available in: Atom