How can I write something like the sentence below in QGIS Raster Calculator?
Con(condition, true, false)
or, more precisely
Con(raster1 == x, raster1, raster2)
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.Sign up to join this community
As suggested in the official QGIS documentation you can classify raster data by chaining
(raster = pixelvalue1) * classvalue using a
+. You also may check for disjoint values using
A conditional test basically checks, whether data is equal to a parameter, and then gives an output based on the outcome of that check. The huge difference between the raster calc and the field calc is, that with the raster calc you don't have direct access to
case when. The raster calc checks, whether a condition is true or not, and returns 1 or 0, and using this you need to emulate the
Thus, you may run
(raster1 = x) * raster1 + (raster1 != x) * raster2
and if raster 1 equals your value of interest, your output raster gets assigned that value, and where raster 1 isn't equal to that value of interest, the output gets assigned the spatial corresponding value from raster 2.