<p dir="ltr">This would require QgsExpression to be extended to support rasters.  </p>
<p dir="ltr">Not sure how much work that would be.</p>
<div class="gmail_quote">On 25/04/2014 7:02 pm, "kimaidou" <<a href="mailto:kimaidou@gmail.com">kimaidou@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div><div><div><div><div><div><div><div>Hi Andreas,<br><br></div>I totally agree with the benefit of using SQL-like syntax as in expressions to calculate rasters.<br><br></div>I would prefer something like<br>

</div>
CASE<br></div>WHEN raster1@1 > raster2@1 THEN raster1@1<br></div>ELSE raster2@1<br></div>END<br><br></div>Having to multiply the result of a condition (0 or 1) by the band value to actually get the band values seems cumbersome for some users.<br>

</div><div>Thanks for raising this issue.<br><br></div>Michael<br> 
</div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-04-24 15:25 GMT+02:00 Andreas Neumann <span dir="ltr"><<a href="mailto:a.neumann@carto.net" target="_blank">a.neumann@carto.net</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Hi Carlos,<br>
<br>
Thanks a lot. This works fine.<br>
<br>
Seems I first have to get used to the raster calculator syntax. Would be<br>
great if it would use the expression editor as is used almost everywhere<br>
else.<br>
<br>
Andreas<br>
<br>
Am <a href="tel:24.04.2014%2012" value="+12404201412" target="_blank">24.04.2014 12</a>:57, schrieb Carlos Cerdán:<br>
<div><div>> Hi Andreas:<br>
><br>
> Yes, it always evaluates to true because of "OR" condition , so try:<br>
><br>
> (lake_mask > 0) * lake_mask + (lake_mask<=0)*dtm<br>
><br>
> Good luck<br>
><br>
> Carlos<br>
><br>
><br>
><br>
><br>
> 2014-04-24 1:53 GMT-05:00 Andreas Neumann <<a href="mailto:a.neumann@carto.net" target="_blank">a.neumann@carto.net</a>>:<br>
><br>
>> Hi,<br>
>><br>
>> I have a hard time understanding the raster calculator syntax.<br>
>><br>
>> I would like to merge two rasters: DTM and lake mask. Let's call the one<br>
>> dtm and the other lake_mask.<br>
>><br>
>> When the lake_mask has a value > 0 then I would like to take the value<br>
>> of the lake_mask, otherwise the value of the dtm.<br>
>><br>
>> What would an appropriate syntax look like?<br>
>><br>
>> I tried something along<br>
>><br>
>> ((lake_mask > 0) * lake_mask) OR dtm<br>
>><br>
>> But all I get in the resulting grid are values of 1. I guess it is<br>
>> because it always evaluates to true?<br>
>><br>
>> Thanks for your help.<br>
>><br>
>> Andreas<br>
>> _______________________________________________<br>
>> Qgis-user mailing list<br>
>> <a href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a><br>
>> <a href="http://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
>><br>
><br>
><br>
><br>
> _______________________________________________<br>
> Qgis-user mailing list<br>
> <a href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a><br>
> <a href="http://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
><br>
<br>
_______________________________________________<br>
Qgis-user mailing list<br>
<a href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-user</a></div></div></blockquote></div><br></div>
<br>_______________________________________________<br>
Qgis-user mailing list<br>
<a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br></blockquote></div>