11

For a while now I have been trying to use r.mapcalc from the QGIS Processing Toolbox. However, the algorithm does not give me any output. I have tried several raster layers and different expressions, but the algorithm never outputs anything to the "Results Directory". Below there is an image that shows a simple example of algorithm setup. Maybe I am missing something, but I did not find anything similar online.

Example of algorithm setup

2

Not sure how to get it to work from the Processing Toolbox but instead, you could use the same tool from GRASS Tools. You can do this by:


  1. Running your QGIS Desktop 2.x.x with GRASS 7.x.x.

  1. Then from the menubar, go to:

    Plugins > GRASS > Open Mapset
    

    Or click New Mapset to create a new one where you define a directory to store layers imported into GRASS.


  1. Import your raster using various methods such as r.in.gdal to import via a path or r.in.gdal.qgis to import a loaded raster in QGIS.

  1. Run the r.mapcalc tool which comes with quite a nice GUI modeler. Set up your model:

    GRASS r.mapcalc

    Where "example" is the name of my raster, addition is the operator and adding a constant value of 1. Note that adding the connection lines can be tricky, you need to make sure the circle connection points which are initially red (when unconnected) turn grey (connected).

    Once you made your model, give the output a name and click Run. It will tell you whether or not it ran successfully, if so then click View output to load the result into QGIS.


  1. Result of the model where the value 1 has been added successfully:

    Result

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.