[Qgis-user] If/Else with raster calculator

Jonathan Moules jonathanmoules at warwickshire.gov.uk
Wed Feb 26 05:55:27 PST 2014


Hi,
Thanks but I'm looking for better syntax, ideally more readable/user
friendly. I guess maybe it doesn't exist then?

I can see your method will work but it seems QGIS forces it to be quite...
ugly in its nature.

Does anyone know what scope there is for improving the syntax of raster
calculator?

Cheers,
Jonathan


On 25 February 2014 18:59, Goyo <goyodiaz at gmail.com> wrote:

> 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
>

-- 
This transmission is intended for the named addressee(s) only and may 
contain sensitive or protectively marked material up to RESTRICTED and 
should be handled accordingly. Unless you are the named addressee (or 
authorised to receive it for the addressee) you may not copy or use it, or 
disclose it to anyone else. If you have received this transmission in error 
please notify the sender immediately. All email traffic sent to or from us, 
including without limitation all GCSX traffic, may be subject to recording 
and/or monitoring in accordance with relevant legislation.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20140226/189a3d81/attachment.html>


More information about the Qgis-user mailing list