Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a 2 cases if() command to Raster Calculator #14403

Closed
qgib opened this issue Nov 1, 2011 · 13 comments · Fixed by #44839
Closed

Add a 2 cases if() command to Raster Calculator #14403

qgib opened this issue Nov 1, 2011 · 13 comments · Fixed by #44839
Labels
Feature Request Rasters Related to general raster layer handling (not specific data formats)

Comments

@qgib
Copy link
Contributor

qgib commented Nov 1, 2011

Author Name: alobo - (alobo -)
Original Redmine Issue: 4476

Redmine category:rasters


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

@qgib
Copy link
Contributor Author

qgib commented Nov 1, 2011

Author Name: alobo - (alobo -)


  • category_id was configured as Rasters
  • fixed_version_id was configured as Version 1.7.1
  • operating_system was changed from to all

@qgib
Copy link
Contributor Author

qgib commented Nov 12, 2011

Author Name: Tim Sutton (Tim Sutton)


  • fixed_version_id was changed from Version 1.7.1 to Version 1.7.2

@qgib
Copy link
Contributor Author

qgib commented Nov 30, 2011

Author Name: Giovanni Manghi (@gioman)


  • fixed_version_id was changed from Version 1.7.2 to Version 1.7.3

@qgib
Copy link
Contributor Author

qgib commented Dec 16, 2011

Author Name: Giovanni Manghi (@gioman)


  • fixed_version_id was changed from Version 1.7.3 to Version 1.7.4

@qgib
Copy link
Contributor Author

qgib commented Apr 15, 2012

Author Name: Giovanni Manghi (@gioman)


  • fixed_version_id was changed from Version 1.7.4 to Version 2.0.0

@qgib
Copy link
Contributor Author

qgib commented Oct 6, 2012

Author Name: Pirmin Kalberer (Pirmin Kalberer)


  • fixed_version_id was changed from Version 2.0.0 to Future Release - Nice to have

@qgib
Copy link
Contributor Author

qgib commented Dec 5, 2015

Author Name: Médéric RIBREUX (Médéric RIBREUX)


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 ?


  • status_id was changed from Open to Feedback

@qgib
Copy link
Contributor Author

qgib commented Dec 10, 2015

Author Name: alobo - (alobo -)


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

@qgib
Copy link
Contributor Author

qgib commented Apr 30, 2017

Author Name: Giovanni Manghi (@gioman)


  • easy_fix was configured as 0

@qgib
Copy link
Contributor Author

qgib commented Nov 23, 2018

Author Name: Alister Hood (@AlisterH)


Is this ticket really waiting for feeback? Of what in particular?
Perhaps it should be closed, maybe as a duplicate of #16517.


  • description was changed from 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 to 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

@qgib qgib added Feedback Waiting on the submitter for answers Feature Request Rasters Related to general raster layer handling (not specific data formats) labels May 24, 2019
@qgib qgib added this to the Future Release - Nice to have milestone May 24, 2019
@github-actions
Copy link

The QGIS project highly values your report and would love to see it addressed. However, this issue has been left in feedback mode for the last 14 days and is being automatically marked as "stale".
If you would like to continue with this issue, please provide any missing information or answer any open questions. If you could resolve the issue yourself meanwhile, please leave a note for future readers with the same problem and close the issue.
In case you should have any uncertainty, please leave a comment and we will be happy to help you proceed with this issue.
If there is no further activity on this issue, it will be closed in a week.

@github-actions github-actions bot added the stale Uh oh! Seems this work is abandoned, and the PR is about to close. label Jul 14, 2021
@AlisterH
Copy link
Contributor

I don't think this ticket was really waiting for feedback.
The question was asked "Was your feature request about a way to have conditions in the raster calculator or about the syntax of the condition?"
The answer was that the request was about the way to have conditions, but now that we know there is a way, the syntax is "weird" and an if() syntax would be more useful.

That's not to say that keeping the ticket open will achieve anything...

@github-actions github-actions bot removed the stale Uh oh! Seems this work is abandoned, and the PR is about to close. label Jul 15, 2021
@AlisterH
Copy link
Contributor

I see #16517 is still open - maybe this can be considered a duplicate of it, and closed.

@gioman gioman removed the Feedback Waiting on the submitter for answers label Jul 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request Rasters Related to general raster layer handling (not specific data formats)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants