Feature request #4476
Add a 2 cases if() command to Raster Calculator
Status: | Feedback | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | Rasters | ||
Pull Request or Patch supplied: | No | Resolution: | |
Easy fix?: | No | Copied to github as #: | 14403 |
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
#1 Updated by alobo - about 13 years ago
- Category set to Rasters
- Target version set to Version 1.7.1
- Operating System set to all
#2 Updated by Tim Sutton about 13 years ago
- Target version changed from Version 1.7.1 to Version 1.7.2
#3 Updated by Giovanni Manghi about 13 years ago
- Target version changed from Version 1.7.2 to Version 1.7.3
#4 Updated by Giovanni Manghi almost 13 years ago
- Target version changed from Version 1.7.3 to Version 1.7.4
#5 Updated by Giovanni Manghi over 12 years ago
- Target version changed from Version 1.7.4 to Version 2.0.0
#6 Updated by Pirmin Kalberer about 12 years ago
- Target version changed from Version 2.0.0 to Future Release - Nice to have
#7 Updated by Médéric RIBREUX about 9 years 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 ?
#8 Updated by alobo - almost 9 years 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
#9 Updated by Giovanni Manghi over 7 years ago
- Easy fix? set to No
#10 Updated by Alister Hood about 6 years ago
- Description updated (diff)
Is this ticket really waiting for feeback? Of what in particular?
Perhaps it should be closed, maybe as a duplicate of #7581.