[GRASS-user] how to use r.mapcalc in GRASS

Hello,

I am trying to calculate the difference between two raster layers. For that, I am using GRASS in QGIS. I use the command r.mapcalc. In the field “expression to evaluate” I wrote
r.mapcalc expression=diff =TIN_12_17-TIN_06_18
TIN_12_17 and TIN_06_18 are the names of my two rasters.
I then select the region on my canevas.
When I click "run" I don't have any error but no file is created in my project. I would like to have a new raster file with the difference of the two previous ones.

What am I doing wrong?

Thank you,
Marion

Hi Marion,

Don’t know how is it from QGIS, but in the native GRASS GIS we first se the computational region with g.region [0] and then run r.mapcalc as:

r.mapcalc expression=“diff = map1 - map2”

HTH,
Vero

[0] https://grass.osgeo.org/grass74/manuals/g.region.html

El lun., 2 jul. 2018 a las 12:18, marion-brunet (<marion-brunet@sfr.fr>) escribió:

Hello,

I am trying to calculate the difference between two raster layers. For that, I am using GRASS in QGIS. I use the command r.mapcalc. In the field “expression to evaluate” I wrote
r.mapcalc expression=diff =TIN_12_17-TIN_06_18
TIN_12_17 and TIN_06_18 are the names of my two rasters.
I then select the region on my canevas.
When I click "run" I don't have any error but no file is created in my project. I would like to have a new raster file with the difference of the two previous ones.

What am I doing wrong?

Thank you,
Marion_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Hello Marion,

On Mon, Jul 2, 2018 at 12:18 PM, marion-brunet <marion-brunet@sfr.fr> wrote:

Hello,

I am trying to calculate the difference between two raster layers. For that,
I am using GRASS in QGIS. I use the command r.mapcalc. In the field
"expression to evaluate" I wrote
r.mapcalc expression=diff =TIN_12_17-TIN_06_18

be sure to have white spaces around the - (minus)

TIN_12_17-TIN_06_18
--> TIN_12_17 - TIN_06_18

and, as Vero wrote, perhaps quotes. So, pls try:

r.mapcalc expression="diff =TIN_12_17 - TIN_06_18"

Best,
Markus