Converting 0 values to 1 in QGIS 3 using r.mapcalc GUI

by Oliver Burdekin   Last Updated August 25, 2018 18:22 PM

I'm using GRASS 7.4.1 in QGIS 3.2 and would like to change 0 values of a slope raster to 1. I've been following this video tutorial and my r.mapcalc function looks exactly the same. However the output adds 1 to all values in the slope raster. The model looks like this in the GUI:

enter image description here

And the formula in the output reads "slope_1 = ((slope+((slope==0)+1)))"

How can I convert only 0 values to 1 instead of adding 1 to all values? In ArcGIS raster calculator I would use something like Con(raster==0,1,raster)

Stripping the GRASS r.mapcalc function back further the output from this created a raster with original 0 values converted to 2 and all other values converted to 1:

enter image description here

Related Questions

Purpose of comma in calc in GRASS GIS 7.4

Updated October 09, 2018 20:22 PM

Conditional operation with two raster files

Updated October 05, 2017 22:22 PM

Import ESRI ASCII raster with python to GRASS

Updated February 27, 2017 22:22 PM