[Qgis-user] QGIS Raster Calculator - cannot add two mutually exclusive areas with logical statement because nodata excludes the other's data

Nicolas Cadieux nicolas.cadieux at archeotec.ca
Wed Jun 3 09:10:12 PDT 2015


Hi,
The first step is to remove the nodata value from the file.  In 
"translate" that would give the following command (that needs to be 
manipulated using the yellow pencil.)

ex: gdal_translate *-a_nodata none* -of GTiff 
C:/Users/Nicolas/Desktop/SRTMGL12delete/Que/Que_SRTMGL1_WGS84_EGM96.tif 
"C:/Users/Nicolas/Desktop/for 6tb/Que_SRTMGL1_WGS84_EGM96b.tif"

In my case, this gives me a file with new value (-32768).  I can now 
manipulate that value. Now I need to change this value (-32768 = missing 
SRTM Tiles in the sea with no land) to zero (the sea level).  This can 
be done in raster Math.
ex:
(("Que_SRTMGL1_WGS84_EGM96b at 1" = -32768)*0) + 
(("Que_SRTMGL1_WGS84_EGM96b at 1" > -32768)*"Que_SRTMGL1_WGS84_EGM96b at 1")
What is going on???

A) ("Que_SRTMGL1_WGS84_EGM96b at 1" = -32768): creates a mask with 1 and 0 
(1=satisfy condition, 0=does not satisfy condition)
B) Then you multiply this mask with a value : *0. Therefore -32768 
becomes 0  (if it was *30, then this would reclassify all -32768 to 30).
C) You then add to this map the pixels that are bigger than  -32768: 
(("Que_SRTMGL1_WGS84_EGM96b at 1" > -32768)
D) And finally, you multiply this mask by the original values: 
*"Que_SRTMGL1_WGS84_EGM96b at 1")

You can also reclassify using GRASS and SAGA in the processing plugin.

Hope this helps
Nicolas




Le 2015-06-03 10:26, robertlozar [via OSGeo.org] a écrit :
> Thank you for your reply.
>
> I realize you can change zeros to nodata. I wish to know how to do 
> opposite: change nodata to zeros in QGIS.  As I mentioned, I would 
> like to know how it is done in QGIS as I have already done it in the 
> other plugins.  Is it possible, or is this a bug in QGIS?
>
> Thanks, Bob
>
> ------------------------------------------------------------------------
> If you reply to this email, your message will be added to the 
> discussion below:
> http://osgeo-org.1560.x6.nabble.com/QGIS-Raster-Calculator-cannot-add-two-mutually-exclusive-areas-with-logical-statement-because-nodataa-tp5208547p5208951.html 
>
> To start a new topic under Quantum GIS - User, email 
> ml-node+s1560n4125267h38 at n6.nabble.com
> To unsubscribe from Quantum GIS - User, click here 
> <http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4125267&code=bmljb2xhcy5jYWRpZXV4QGFyY2hlb3RlYy5jYXw0MTI1MjY3fDYzNDQ4MjQxNg==>.
> NAML 
> <http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> 
>





--
View this message in context: http://osgeo-org.1560.x6.nabble.com/QGIS-Raster-Calculator-cannot-add-two-mutually-exclusive-areas-with-logical-statement-because-nodataa-tp5208547p5208981.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/20150603/309a6e19/attachment.html>


More information about the Qgis-user mailing list