<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<blockquote type="cite"><b style="color: rgb(0, 0, 0); font-family:
"Times New Roman"; font-size: medium; font-style:
normal; font-variant-ligatures: normal; font-variant-caps:
normal; letter-spacing: normal; orphans: 2; text-align: start;
text-indent: 0px; text-transform: none; white-space: normal;
widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration-thickness: initial; text-decoration-style:
initial; text-decoration-color: initial;">Bernd Vogelgesang</b><span
style="color: rgb(0, 0, 0); font-family: "Times New
Roman"; font-size: medium; font-style: normal;
font-variant-ligatures: normal; font-variant-caps: normal;
font-weight: 400; letter-spacing: normal; orphans: 2;
text-align: start; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255); text-decoration-thickness: initial; text-decoration-style:
initial; text-decoration-color: initial; display: inline
!important; float: none;"><span> </span></span><a
href="mailto:qgis-user%40lists.osgeo.org?Subject=Re%3A%20%5BQgis-user%5D%20Raster%20calculation%3A%20if%20Layer1%20is%20%3E%201%2C%0A%20then%20Layer2%20should%20be%200&In-Reply-To=%3C962b4ae7-f8cd-5c70-e4d5-fec2f81891f1%40gmx.de%3E"
title="[Qgis-user] Raster calculation: if Layer1 is > 1, then
Layer2 should be 0" style="font-family: "Times New
Roman"; font-size: medium; font-style: normal;
font-variant-ligatures: normal; font-variant-caps: normal;
font-weight: 400; letter-spacing: normal; orphans: 2;
text-align: start; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px;">bernd.vogelgesang at gmx.de</a><br
style="color: rgb(0, 0, 0); font-family: "Times New
Roman"; font-size: medium; font-style: normal;
font-variant-ligatures: normal; font-variant-caps: normal;
font-weight: 400; letter-spacing: normal; orphans: 2;
text-align: start; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; text-decoration-thickness:
initial; text-decoration-style: initial; text-decoration-color:
initial;">
<i style="color: rgb(0, 0, 0); font-family: "Times New
Roman"; font-size: medium; font-variant-ligatures: normal;
font-variant-caps: normal; font-weight: 400; letter-spacing:
normal; orphans: 2; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal; widows: 2;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration-thickness: initial; text-decoration-style:
initial; text-decoration-color: initial;">Thu Feb 17 12:19:12
PST 2022</i><span style="color: rgb(0, 0, 0); font-family:
"Times New Roman"; font-size: medium; font-style:
normal; font-variant-ligatures: normal; font-variant-caps:
normal; font-weight: 400; letter-spacing: normal; orphans: 2;
text-align: start; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255); text-decoration-thickness: initial; text-decoration-style:
initial; text-decoration-color: initial; display: inline
!important; float: none;"></span>
<pre style="white-space: pre-wrap; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">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 :( ).
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)</pre>
</blockquote>
<br>
Hi Bernd,<br>
what QGIS version are you using? What raster calculator are you
using (there are 5 raster calculators, including also the ones
provided by GDAL, SAGA and GRASS)?<br>
<br>
Have you read the documentation for the main raster calculator of
QGIS at
<a class="moz-txt-link-freetext" href="https://docs.qgis.org/3.22/en/docs/user_manual/working_with_raster/raster_analysis.html#raster-analysis">https://docs.qgis.org/3.22/en/docs/user_manual/working_with_raster/raster_analysis.html#raster-analysis</a>
?<br>
It seems to me it contains some examples, including:<br>
<br>
<<...<br>
If you want to mask out parts of a raster – say, for instance,
because you are only interested in elevations above 0 meters – you
can use the following expression to create a mask and apply the
result to a raster in one step.<br>
<br>
("elevation@1" >= 0) * "elevation@1"<br>
<br>
In other words, for every cell greater than or equal to 0 the
conditional expression evaluates to 1, which keeps the original
value by multiplying it by 1. Otherwise the conditional expression
evaluates to 0, which sets the raster value to 0. This creates the
mask on the fly.<br>
<br>
..>><br>
<br>
Best regards.<br>
<br>
Andrea Giudiceandrea<br>
</body>
</html>