[Qgis-user] If/Else with raster calculator

Goyo goyodiaz at gmail.com
Tue Feb 25 10:59:54 PST 2014


2014-02-25 18:00 GMT+01:00 Jonathan Moules <jonathanmoules at warwickshire.gov.uk>:
> Hi List,
> How do I do a If/Else with the raster calculator *and* have the ability to
> set arbitrary values for both conditions.
>
> For example, similar to the below psuedocode:
>
>> If(condition):
>>   Cell = 9
>> else:
>>   Cell = 68
>
>
> This seems like it'd be a core part of a raster calculator but all I can
> find is the ability to get True/False and then cludge around that, i.e.
> with:
>>
>> (condition) * 9
>
>
> What am I missing? Good tutorials welcome (the ones I've found don't show
> anything beyond true/false).

(condition) * 9 + (not condition) * 68

Or you are just looking for a better sintax? That is too much verbose
but I do not know a better way.

Goyo



More information about the Qgis-user mailing list