[Qgis-user] Raster calculator: different extents and nodata

Nicolas Cadieux nicolas.cadieux at archeotec.ca
Tue Feb 24 22:20:14 PST 2015


Hi, 
I am not a raster math genius but I will give this a shot. 
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?  
-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! 
-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. 
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. 
Stuff I found: 
http://gis.stackexchange.com/questions/22786/how-to-exclude-missing-values-from-raster-layer 
http://gis.stackexchange.com/questions/12418/how-to-redefine-the-nodata-value-into-zero-in-qgis 
http://gis-lab.info/qa/rastercalc-eng.html#How_does_it_work 
http://gis.stackexchange.com/questions/33764/how-to-change-null-values-raster-values-to-0-in-qgis 
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.2/en/docs/training_manual/processing/no_data.html 
Good luck 
Nicolas Cadieux M.Sc. 
Les Entreprises Archéotec inc.  
8548, rue Saint-Denis Montréal H2P 2H2 
Téléphone: 514.381.5112  Fax: 514.381.4995 
www.archeotec.ca 
Le 2015-02-24 12:26, "Michael.Scholz [via OSGeo.org]	" <ml-node+s1560n5189746h87 at n6.nabble.com> a écrit : 

	Hey!
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:
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?
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.
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.
4) I would like to express something like "(rasterB = nodata AND rasterA != nodata) * rasterA + (rasterB != nodata) * (rasterA + rasterB)". Is that possible?
Still in love with QGIS
Michi Scholz
_______________________________________________
Qgis-user mailing list
[hidden email] 
http://lists.osgeo.org/mailman/listinfo/qgis-user 

	
	
	
	
	
	
	
		If you reply to this email, your message will be added to the discussion below: 
		http://osgeo-org.1560.x6.nabble.com/Raster-calculator-different-extents-and-nodata-tp5189746.html 
	
	
		To start a new topic under Quantum GIS - User, email ml-node+s1560n4125267h38@n6.nabble.com 
		To unsubscribe from Quantum GIS - User, click here . 
		NAML 
	



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Raster-calculator-different-extents-and-nodata-tp5189746p5189844.html
Sent from the Quantum GIS - User mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20150224/9c591467/attachment.html>


More information about the Qgis-user mailing list