[Qgis-user] Raster calculation: if Layer1 is > 1, then Layer2 should be 0

Bernd Vogelgesang bernd.vogelgesang at gmx.de
Thu Feb 17 14:56:23 PST 2022


Hi Nyall,

sorry, mixed things up. The native raster calculator only threw errors,
while the GDAL worked.

Now that I tried again, everything is fine. Strange hickup.

Anyway, everything ist fine now and things start getting sorted.

Happy again :)

Cheers,

Bernd



Am 17.02.22 um 23:22 schrieb Nyall Dawson:
> On Fri, 18 Feb 2022 at 08:08, Bernd Vogelgesang
> <bernd.vogelgesang at gmx.de> wrote:
>> Hi Sebastian,
>>
>> thanx, that worked.
>>
>> But somehow, the hole process feels a bit clumsy.
>>
>> Having to fumble together a classification with "thru" (juck!), then the toolbox reclassify just seems to be broken,
> Which reclassify tool are you referring to exactly? The native QGIS
> ones are 100% NOT broken. (The SAGA one may be, but that's a 3rd party
> tool.)
>
> Nyall
>
>
> gladly gdal calculator does ...
>> Why isn't there some "raster SQL" that saves one from all these stupid single steps?
>>
>> Ok, will then try to build a model and hope it will work for the tests to come…
>>
>> Thanks a lot,
>>
>> Bernd
>>
>>
>> Am 17.02.22 um 22:19 schrieb Sebastian Gutwein:
>>
>> Reclassify your Layer 1 to be anything greater than 1 = 0 everything else equals 1. This will give you a binary 1 and 0 raster (Layer 3)  that you can use in the raster calculator: Layer 2 * Layer 3.  Anywhere where layer 3 is 1 your layer 2 values will stay the same and anywhere where layer 3 is 0 your layer 2 values will become 0.
>>
>> On Thu, Feb 17, 2022 at 3:19 PM Bernd Vogelgesang <bernd.vogelgesang at gmx.de> wrote:
>>> Hi folk,
>>>
>>> I hardly never work with raster calculations, and unfortunately there is nowhere a collection of syntax examples for different use cases to be found (documentation :( ).
>>>
>>> Anything apart from +-*/ is beyond my scope.
>>>
>>> So,
>>>
>>> I made a viewshed analysis over a digital surface model (try the awesome Visibility Analysis plugin form Zoran Čučković and buy him a beer!)
>>>
>>> A lot of "views" are caught by tree canopy, but I am only interest in the flat grounds.
>>>
>>> So I substracted the surface model layer from the ground model layer, and this is Layer 1.
>>>
>>> Giving a threshold of 1 meters difference for inaccuracities, all pixels in this layer above 1 should result in 0 (zero) in my viewshed raster (Layer 2)
>>>
>>> Please give me some hints,
>>>
>>> Cheers,
>>>
>>> Bernd
>>>
>>>
>>> _______________________________________________
>>> 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