[Qgis-user] nodata and raster calc

Stefan Giese Stefan.Giese at wheregroup.com
Mon Feb 11 00:55:07 PST 2019


I've thought that AND and OR are boolean operators and will produce TRUE 
(1) or FALSE (0)

nodata + 1 = nodata
nodata * 1 = nodata
nodata AND 1 = 0 (false)
nodata OR 1 = 1 (true)

Mit freundlichen Grüßen
Stefan Giese
Projektleiter/Consultant
****************************************************************************
FOSS Academy Kompaktkurs "Winterschule 2019"
Grundwissen zum Aufbau von Geodateninfrastrukturen mit Open-Source-Software
https://foss-academy.com/kompaktkurse
****************************************************************************
WhereGroup GmbH & Co. KG
Schwimmbadstr. 2
79100 Freiburg
Germany

Fon: +49 (0)761 / 519 102 - 61
Fax: +49 (0)761 / 519 102 - 11

stefan.giese at wheregroup.com
www.wheregroup.com
Amtsgericht Bonn, HRA 6788
-------------------------------
Komplementärin:
WhereGroup Verwaltungs GmbH
vertreten durch:
Olaf Knopp, Peter Stamm
-------------------------------

Am 11.02.2019 um 09:38 schrieb Havard Tveite:
> nodata + 1 = nodata
> nodata * 1 = nodata
> nodata AND 1 = nodata
> nodata OR 1 = 1
>
> Håvard
>
> On 11. feb. 2019 03:11, Nyall Dawson wrote:
>> Hey all,
>>
>> I'm seeking some feedback on whether our current handling of nodata
>> pixels in the raster calculator is correct, or (my suspicion) annoying
>> and limiting.
>>
>> Currently, we treat nodata pixels the same as a "NULL" value in SQL --
>> so ANY function or operation with nodata as an input results in a
>> nodata output.
>>
>> This means:
>>
>> - nodata + 1 = nodata
>> - nodata * 1 = nodata
>> - nodata AND 1 = nodata
>> - nodata OR 1 = nodata
>>
>> To me this is a mistake. I don't think we should treat nodata the same
>> as NULL, and I think for rasters then "nodata OR 1" should return 1.
>>
>> The end result of the current behaviour is that ANY nodata input
>> blocks processing of that pixel. So you can't do something like take
>> two raster files, and create an output showing where either input has
>> a 1 value (which I would expect raster1 at 1 OR raster2 at 1 to do).
>>
>> Otherwise, we need to have some concept of "coalesce" in the raster
>> calc. So then at least you could do:
>>
>>      coalesce(raster1 at 1, 0) OR coalesce(raster at 1, 0) ....
>>
>>
>> Thoughts?
>>
>> Nyall
>> _______________________________________________
>> Qgis-user mailing list
>> Qgis-user at lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


More information about the Qgis-user mailing list