<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p dir="ltr">Hi Michi and everyone,<br>
Coincidentally, I also spent the better part of a whole day trying
to figure out how to do the exact same thing yesterday with two
float32 geotiff rasters. I tried many of the suggestions in the
links Nicolas provided to no success (and many more leads - see
below). I think one of the issues is most of the posts related to
this are addressing how to replace a given value with a null value
for symbology, versus replacing null values with some real number
for calculations. In ArcGIS, after you have extended your example
raster B to the extent of raster A (which fills in the new area of
raster B with nodata values), you can use the Con(IsNull)
statement to transform to null values to zero for use in raster
calculations. I have learned a lot about QGIS in the process of
sorting this out, but do not have a ready answer for what must be
a fairly common user context. Any help would be greatly
appreciated.<br>
</p>
<p dir="ltr">Regards,<br>
Rob<br>
</p>
<p dir="ltr"><a class="moz-txt-link-freetext" href="http://gis.stackexchange.com/questions/108641/qgis-raster-calculator-need-values-to-be-set-to-0-instead-of-no-data">http://gis.stackexchange.com/questions/108641/qgis-raster-calculator-need-values-to-be-set-to-0-instead-of-no-data</a><br>
<a class="moz-txt-link-freetext" href="http://gis.stackexchange.com/questions/110248/saga-raster-calculator-ifelse-command-syntax-problem">http://gis.stackexchange.com/questions/110248/saga-raster-calculator-ifelse-command-syntax-problem</a><br>
<a class="moz-txt-link-freetext" href="http://gis.stackexchange.com/questions/42555/what-to-do-with-3-4e38-nodata-values">http://gis.stackexchange.com/questions/42555/what-to-do-with-3-4e38-nodata-values</a><br>
<a class="moz-txt-link-freetext" href="http://gis.stackexchange.com/questions/81640/how-to-set-all-pixels-with-value-0-to-nodata-in-dem-raster">http://gis.stackexchange.com/questions/81640/how-to-set-all-pixels-with-value-0-to-nodata-in-dem-raster</a>
(hoping to reverse engineer this process)<br>
<a class="moz-txt-link-freetext" href="http://gis.stackexchange.com/questions/22786/how-to-exclude-missing-values-from-raster-layer">http://gis.stackexchange.com/questions/22786/how-to-exclude-missing-values-from-raster-layer</a><br>
</p>
<p dir="ltr">Hi,<br>
I am not a raster math genius but I will give this a shot.</p>
<p dir="ltr">1)". In this case all cells outside the extent of
rasterB get assigned "nodata" which is the default
-3.4028234663852886e+38 in my case. Is that correct? </p>
<p dir="ltr">-Yes that is a standard null data for float 16 or float
32 files. It can be change with gdal-warp or gdal-translate. I
suspect that is you save the file in ASCII grid format, you will
have no more null values... And less hard drive space!</p>
<p dir="ltr">-If you multiply a value by a null value, you will get
a null value in the answer. That explains what is going on in
point 1 and 2.</p>
<p dir="ltr">As for point 4, you can probably do it with a mask.
Something like rasterA/rasterA should give you a mask with 1 where
there is data and zero when not (I think. If not reset with
gdal-translate). Then you can use the AND function to combine
areas and find where raster A and B intersect and work your way
from there. You could also find the extent of the rasters (in
vectors) and then use the vectors to raster operation to create a
mask.</p>
<p dir="ltr">Stuff I found:<br>
<a class="moz-txt-link-freetext" href="http://gis.stackexchange.com/questions/22786/how-to-exclude-missing-values-from-raster-layer">http://gis.stackexchange.com/questions/22786/how-to-exclude-missing-values-from-raster-layer</a></p>
<p dir="ltr"><a class="moz-txt-link-freetext" href="http://gis.stackexchange.com/questions/12418/how-to-redefine-the-nodata-value-into-zero-in-qgis">http://gis.stackexchange.com/questions/12418/how-to-redefine-the-nodata-value-into-zero-in-qgis</a><br>
</p>
<p dir="ltr"><a class="moz-txt-link-freetext" href="http://gis-lab.info/qa/rastercalc-eng.html#How_does_it_work">http://gis-lab.info/qa/rastercalc-eng.html#How_does_it_work</a></p>
<p dir="ltr"><a class="moz-txt-link-freetext" href="http://gis.stackexchange.com/questions/33764/how-to-change-null-values-raster-values-to-0-in-qgis">http://gis.stackexchange.com/questions/33764/how-to-change-null-values-raster-values-to-0-in-qgis</a></p>
<p dir="ltr"><a class="moz-txt-link-freetext" href="http://docs.qgis.org/2.6/en/docs/training_manual/rasters/terrain_analysis.html#moderate-fa-using-the-raster-calculator">http://docs.qgis.org/2.6/en/docs/training_manual/rasters/terrain_analysis.html#moderate-fa-using-the-raster-calculator</a></p>
<p dir="ltr"><a class="moz-txt-link-freetext" href="http://docs.qgis.org/2.2/en/docs/training_manual/processing/no_data.html">http://docs.qgis.org/2.2/en/docs/training_manual/processing/no_data.html</a></p>
<p dir="ltr">Good luck</p>
<p dir="ltr">Nicolas Cadieux M.Sc.<br>
Les Entreprises Archéotec inc. <br>
8548, rue Saint-Denis Montréal H2P 2H2<br>
Téléphone: 514.381.5112 Fax: 514.381.4995<br>
<a class="moz-txt-link-abbreviated" href="http://www.archeotec.ca">www.archeotec.ca</a></p>
Le 2015-02-24 12:26, "Michael.Scholz [via OSGeo.org] " <<a
rel="nofollow"
href="http://osdir.com/user/SendEmail.jtp?type=node&node=5189844&i=0"
target="_blank" link="external">[hidden email]</a>> a écrit :<br
type="attribution">
Hey!
<br>
In QGIS 2.6.1 I spent the whole day on the raster calculator for
some super-simple overlay calculations and I'm ending up in rage and
fury. I don't want to complain about the unintuitive syntax. Rather
I have some questions:
<br>
1) I have two raster with different extents. rasterA entirely
contains rasterB. When I add these rasters (rasterA + rasterB) and
set the output extent to the same as of rasterA, my result is only
defined at the overlapping area of both rasters. In this case all
cells outside the extent of rasterB get assigned "nodata" which is
the default -3.4028234663852886e+38 in my case. Is that correct?
<br>
2) I extended rasterB to have the same extent as rasterA by filling
the missing cells with "nodata". rasterA + rasterB still gives the
same result as in 1). Why is "rasterA + nodata = nodata"? I just
want values from rasterB to be added to values of rasterA AND
keeping rasterA entirely where rasterB has no values.
<br>
3) How can I query the "nodata" value of a band?? Without being able
to query it, I cannot set it to 0 which would solve all my problems.
<br>
4) I would like to express something like "(rasterB = nodata AND
rasterA != nodata) * rasterA + (rasterB != nodata) * (rasterA +
rasterB)". Is that possible?
<br>
<br>
Still in love with QGIS
<br>
Michi Scholz
</body>
</html>