qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.35k stars 2.98k forks source link

GRASS r.mapcalc cumbersome to use, issues on Windows #16019

Open qgib opened 11 years ago

qgib commented 11 years ago

Author Name: Pedro Venâncio (Pedro Venâncio) Original Redmine Issue: 6894

Redmine category:processing/grass Assignee: Victor Olaya


Hi,

I think it's very important to include GRASS r.mapcalc on Sextante. At this moment, is lacking on Sextante an advanced raster calculator, with the potential of r.mapcalc (with advanced operators and functions). http://grass.osgeo.org/grass64/manuals/r.mapcalc.html

Is there any limitation that prevents the inclusion of this tool? Right now it seems to me the biggest absence on Sextante.

Thanks!


qgib commented 11 years ago

Author Name: Victor Olaya (@volaya)


r.mapcalc takes the name of raster layers to use...which is a problem, since those names are temporary names, because layers have to be imported into the mapset. This could be changed, but will definitely take time.

Tha SAGA map calculator, which has the same functionality, takes the list of layers to be used, and then names them using a, b, c, d...etc, which is much easier to handle. The SAGA calcualtor should be working fine, so if you have time to try it, maybe you can get the functionality you need.

This is an important feature, and I will probably create a better interface for it soon, but relying on SAGA is a much safer bet (IMHO) than relying on GRASS for this. The GRASS mapset makes thinks much more difficult...


qgib commented 11 years ago

Author Name: Pedro Venâncio (Pedro Venâncio)


Oh, now I understand Victor, it makes r.mapcalc very difficult to use.

So, Grid Calculator has all the functions of r.mapcalc (or most of them)? Is there any place where we can see the list of functions? In this case, it should be preferable to adopt Grid Calculator as the main Sextante raster calculator.

qgib commented 11 years ago

Author Name: Pedro Venâncio (Pedro Venâncio)


Victor,

I think I've the answer for my question. The best source of information about Grid Calculator should be your great "A Gentle Introduction to SAGA GIS" - Chapter 7.5 http://downloads.sourceforge.net/saga-gis/SagaManual.pdf

It's a fairly comprehensive list, and from those functions that I regularly use, I'm just noting the lack of a round funtion:

Is there any other way to achieve the round function? We can always use: int((x+0.5))

Thanks!

qgib commented 11 years ago

Author Name: Markus Neteler (Markus Neteler)


See also Feature #6372 - r.mapcalculator

qgib commented 10 years ago

Author Name: Pedro Venâncio (Pedro Venâncio)


Hi,

6372 is now fixed and support r.mapcalc functions.

Thanks!


qgib commented 10 years ago

Author Name: Giovanni Manghi (@gioman)


I will reopen this feature request because r.mapcalculator is limited to 6 inputs maps, to it would be anyway better to have also mapcalc, that anyway would require a special implementation as its logic is slightly different from the other common GRASS modules.


qgib commented 10 years ago

Author Name: Pedro Venâncio (Pedro Venâncio)


Hi Giovanni, I hope someone can find a solution, because this module is important and the limitation of r.mapcalculator to 6 input raster, makes its use very limited.

qgib commented 10 years ago

Author Name: Paolo Cavallini (@pcav)


I stress the importance of having GRASS mapcalc, as it is very flexible, and may be the only (easiest) way of doing proximity calculations.

qgib commented 9 years ago

Author Name: Giovanni Manghi (@gioman)


qgib commented 9 years ago

Author Name: Giovanni Manghi (@gioman)


qgib commented 9 years ago

Author Name: Giovanni Manghi (@gioman)


Adding r.mapcalc becomes now paramount because in GRASS 7 there is no more r.mapcalculator

qgib commented 8 years ago

Author Name: Giovanni Manghi (@gioman)


there is hope see

https://trac.osgeo.org/grass/ticket/2592

qgib commented 8 years ago

Author Name: Giovanni Manghi (@gioman)


Giovanni Manghi wrote:

there is hope see

https://trac.osgeo.org/grass/ticket/2592

I'm not sure that this new flag in r.mapcalc can help us.

qgib commented 8 years ago

Author Name: Médéric RIBREUX (Médéric RIBREUX)


Hello,

there is a "PR for this":https://github.com/qgis/QGIS/pull/2865 ! I need some help for MS-Windows tests before the merge...

Feel free to report bugs on r.mapcalc.


qgib commented 8 years ago

Author Name: Pedro Venâncio (Pedro Venâncio)


Médéric RIBREUX wrote:

Hello,

there is a "PR for this":https://github.com/qgis/QGIS/pull/2865 ! I need some help for MS-Windows tests before the merge...

Feel free to report bugs on r.mapcalc.

Hi Médéric,

Thank you very much for this huge PR!! Thats impressive!!!

I can't test on Windows until Monday, but I've tested r.mapcalc on Linux wright now, and I've found something that seems a small bug (I don't know if this a more general bug, or exclusive of r.mapcalc, I've not tried other modules yet). To reproduce:

1) Load the raster_1.tif file (attached) to QGIS canvas;

2) Open r.mapcalc;

3) 3.1) Select "raster_1" on Multiple selection window; 3.2) Expression: raster_2 = raster_1 * 2 3.3) Select results directory

LOG:
Algorithm r.mapcalc - Raster map calculator. starting...
g.proj -c proj4="+proj=tmerc +lat_0=39.66825833333333 +lon_0=-8.133108333333334 +k=1 +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"
r.in.gdal input=/home/pedro/SIG/MDT_JAG/raster_1.tif output=raster_1 --overwrite -o
g.region -a n=137550.0 s=112250.0 e=100125.0 w=74200.0 res=25.0
r.mapcalc expression="raster_2 = raster_1 * 2" --overwrite
for r in $(g.list type=rast); do
r.out.gdal input=${r} output=/home/pedro/SIG/MDT_JAG/${r}.tif createopt="TFW=YES,COMPRESS=LZW" --overwrite
done
Starting GRASS GIS... 
Executing '/home/pedro/.qgis2//processing/grass7_batch_job.sh' ... 
Default region was updated to the new projection, but if you have multiple mapsets `g.region -d` should be run in each to update the region from the default 
Projection information updated 
ATENÇÃO: Over-riding projection check 
Proceeding with import of 1 raster bands... 
Importing raster map ... 
0..3..6..9..12..15..18..21..24..27..30..33..36..39..42..45..48..51..54..57..60..63..66..69..72..75..78..81..84..87..90..93..96..99..100 
Checking GDAL data type and nodata value... 
2..5..8..11..14..17..20..23..26..29..32..35..38..41..44..47..50..53..56..59..62..65..68..71..74..77..80..83..86..89..92..95..98..100 
Using GDAL data type 
Exporting raster data to GTiff format... 
2..5..8..11..14..17..20..23..26..29..32..35..38..41..44..47..50..53..56..59..62..65..68..71..74..77..80..83..86..89..92..95..98..100 
r.out.gdal completo. File created. 
Checking GDAL data type and nodata value... 
2..5..8..11..14..17..20..23..26..29..32..35..38..41..44..47..50..53..56..59..62..65..68..71..74..77..80..83..86..89..92..95..98..100 
Using GDAL data type 
Exporting raster data to GTiff format... 
2..5..8..11..14..17..20..23..26..29..32..35..38..41..44..47..50..53..56..59..62..65..68..71..74..77..80..83..86..89..92..95..98..100 
r.out.gdal completo. File created. 
Execution of '/home/pedro/.qgis2//processing/grass7_batch_job.sh' finished. 
Cleaning up temporary files... 
Converting outputs
Loading resulting layers
Algorithm r.mapcalc - Raster map calculator. finished

4) Load raster_2.tif to QGIS canvas, without closing r.mapcalc window;

5) Run r.mapcalc again, with expression: raster_3 = raster_1 * 3

LOG:
Algorithm r.mapcalc - Raster map calculator. starting...
g.proj -c proj4="+proj=tmerc +lat_0=39.66825833333333 +lon_0=-8.133108333333334 +k=1 +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"
r.in.gdal input=/home/pedro/SIG/MDT_JAG/raster_2.tif output=raster_2 --overwrite -o
g.region -a n=137550.0 s=112250.0 e=100125.0 w=74200.0 res=25.0
r.mapcalc expression="raster_3 = raster_1 * 3" --overwrite
for r in $(g.list type=rast); do
r.out.gdal input=${r} output=/home/pedro/SIG/MDT_JAG/${r}.tif createopt="TFW=YES,COMPRESS=LZW" --overwrite
done
Starting GRASS GIS... 
Executing '/home/pedro/.qgis2//processing/grass7_batch_job.sh' ... 
Default region was updated to the new projection, but if you have multiple mapsets `g.region -d` should be run in each to update the region from the default 
Projection information updated 
ATENÇÃO: Over-riding projection check 
Proceeding with import of 1 raster bands... 
Importing raster map ... 
0..3..6..9..12..15..18..21..24..27..30..33..36..39..42..45..48..51..54..57..60..63..66..69..72..75..78..81..84..87..90..93..96..99..100 
Invalid map 
Parse error 
ERRO:parse error 
Checking GDAL data type and nodata value... 
2..5..8..11..14..17..20..23..26..29..32..35..38..41..44..47..50..53..56..59..62..65..68..71..74..77..80..83..86..89..92..95..98..100 
Using GDAL data type 
Exporting raster data to GTiff format... 
2..5..8..11..14..17..20..23..26..29..32..35..38..41..44..47..50..53..56..59..62..65..68..71..74..77..80..83..86..89..92..95..98..100 
r.out.gdal completo. File created. 
Execution of '/home/pedro/.qgis2//processing/grass7_batch_job.sh' finished. 
Cleaning up temporary files... 
Converting outputs
Loading resulting layers
Algorithm r.mapcalc - Raster map calculator. finished

It does not create raster_3.tif because, if you see in the log, it imports raster_2 instead of raster_1:

r.in.gdal input=/home/pedro/SIG/MDT_JAG/raster_2.tif output=raster_2 --overwrite -o

So, you need to close r.mapcalc window anytime you run an expression, otherwise it imports the last raster layer loaded in QGIS canvas.

Anyway, this is a really small problem.

Thank you very much for your work Médéric!!



qgib commented 8 years ago

Author Name: Pedro Venâncio (Pedro Venâncio)


Hi Médéric,

I've tested this in Windows (QGIS 2.14 OSGeo4W 64bits, with GRASS 7.0.3)

1) Load the raster_1.tif file (attached) to QGIS canvas;

2) Open r.mapcalc;

3) 3.1) Select "raster_1" on Multiple selection window; 3.2) Expression: raster_2 = raster_1 * 2 3.3) Select results directory

and I get

Algorithm r.mapcalc - Raster map calculator. starting...
g.proj -c proj4="+proj=tmerc +lat_0=39.66825833333333 +lon_0=-8.133108333333334 +k=1 +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"
r.in.gdal input=D:\\Testes\\sample_raster\
aster_1.tif output=raster_1 --overwrite -o
g.region -a n=137550.0 s=112250.0 e=100125.0 w=74200.0 res=25.0
r.mapcalc expression="raster_2=raster_1*2" --overwrite
for r in $(g.list type=rast); do
r.out.gdal input=${r} output=D:\\Testes\\sample_raster/${r}.tif createopt="TFW=YES,COMPRESS=LZW" --overwrite
done

C:\\OSGeo4W64\\bin>set HOME=C:\\Users\\pedro 

C:\\OSGeo4W64\\bin>set GISRC=C:\\Users\\pedro\\.qgis2\\\\processing\\processing.gisrc7 

C:\\OSGeo4W64\\bin>set GRASS_SH=C:\\OSGeo4W64\\apps\\msys\\bin\\sh.exe 

C:\\OSGeo4W64\\bin>set PATH=C:\\OSGeo4W64\\apps\\msys\\bin;C:\\OSGeo4W64\\apps\\msys\\lib;c:\\osgeo4~1\\apps\\python27\\lib\\site-packages\\shapely-1.2.18-py2.7-win-amd64.egg\\shapely\\DLLs;C:\\OSGEO4~1\\apps\\Python27\\DLLs;C:\\OSGEO4~1\\apps\\Python27\\lib\\site-packages\
umpy\\core;C:\\OSGEO4~1\\apps\\qgis-rel-dev\\bin;C:\\OSGEO4~1\\apps\\grass\\grass-7.0.3\\lib;C:\\OSGEO4~1\\apps\\grass\\grass-7.0.3\\bin;C:\\OSGEO4~1\\apps\\Python27\\Scripts;C:\\OSGEO4~1\\bin;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\WBem;C:\\OSGEO4~1\\apps\\msys\\bin 

C:\\OSGeo4W64\\bin>set WINGISBASE=C:\\OSGeo4W64\\apps\\grass\\grass-7.0.3 

C:\\OSGeo4W64\\bin>set GISBASE=C:\\OSGeo4W64\\apps\\grass\\grass-7.0.3 

C:\\OSGeo4W64\\bin>set GRASS_PROJSHARE=C:\\OSGeo4W64\\apps\\grass\\grass-7.0.3\\share\\proj 

C:\\OSGeo4W64\\bin>set GRASS_MESSAGE_FORMAT=plain 

C:\\OSGeo4W64\\bin>if "" == "" set PATH=C:\\OSGeo4W64\\apps\\grass\\grass-7.0.3\\bin;C:\\OSGeo4W64\\apps\\grass\\grass-7.0.3\\lib;C:\\OSGeo4W64\\apps\\msys\\bin;C:\\OSGeo4W64\\apps\\msys\\lib;c:\\osgeo4~1\\apps\\python27\\lib\\site-packages\\shapely-1.2.18-py2.7-win-amd64.egg\\shapely\\DLLs;C:\\OSGEO4~1\\apps\\Python27\\DLLs;C:\\OSGEO4~1\\apps\\Python27\\lib\\site-packages\
umpy\\core;C:\\OSGEO4~1\\apps\\qgis-rel-dev\\bin;C:\\OSGEO4~1\\apps\\grass\\grass-7.0.3\\lib;C:\\OSGEO4~1\\apps\\grass\\grass-7.0.3\\bin;C:\\OSGEO4~1\\apps\\Python27\\Scripts;C:\\OSGEO4~1\\bin;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\WBem;C:\\OSGEO4~1\\apps\\msys\\bin 

C:\\OSGeo4W64\\bin>if not "" == "" set PATH=C:\\OSGeo4W64\\apps\\grass\\grass-7.0.3\\bin;C:\\OSGeo4W64\\apps\\grass\\grass-7.0.3\\lib;;C:\\OSGeo4W64\\apps\\grass\\grass-7.0.3\\bin;C:\\OSGeo4W64\\apps\\grass\\grass-7.0.3\\lib;C:\\OSGeo4W64\\apps\\msys\\bin;C:\\OSGeo4W64\\apps\\msys\\lib;c:\\osgeo4~1\\apps\\python27\\lib\\site-packages\\shapely-1.2.18-py2.7-win-amd64.egg\\shapely\\DLLs;C:\\OSGEO4~1\\apps\\Python27\\DLLs;C:\\OSGEO4~1\\apps\\Python27\\lib\\site-packages\
umpy\\core;C:\\OSGEO4~1\\apps\\qgis-rel-dev\\bin;C:\\OSGEO4~1\\apps\\grass\\grass-7.0.3\\lib;C:\\OSGEO4~1\\apps\\grass\\grass-7.0.3\\bin;C:\\OSGEO4~1\\apps\\Python27\\Scripts;C:\\OSGEO4~1\\bin;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\WBem;C:\\OSGEO4~1\\apps\\msys\\bin 

C:\\OSGeo4W64\\bin>set GRASS_VERSION=7.0.0 

C:\\OSGeo4W64\\bin>if not "" == "" goto langset 

C:\\OSGeo4W64\\bin>FOR /F "usebackq delims==" %i IN (`"C:\\OSGeo4W64\\apps\\grass\\grass-7.0.3\\etc\\winlocale"`) DO @set LANG=%i 

C:\\OSGeo4W64\\bin>set PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY 

C:\\OSGeo4W64\\bin>set PYTHONPATH=C:\\OSGeo4W64\\apps\\grass\\grass-7.0.3\\etc\\python;C:\\OSGeo4W64\\apps\\grass\\grass-7.0.3\\etc\\wxpython\

C:\\OSGeo4W64\\bin>g.gisenv.exe set="MAPSET=PERMANENT" 

C:\\OSGeo4W64\\bin>g.gisenv.exe set="LOCATION=temp_location" 

C:\\OSGeo4W64\\bin>g.gisenv.exe set="LOCATION_NAME=temp_location" 

C:\\OSGeo4W64\\bin>g.gisenv.exe set="GISDBASE=C:\\Users\\pedro\\AppData\\Local\\Temp\\processinga01588b329db4c8ca1aaf4c7a1bce49a\\grassdata" 

C:\\OSGeo4W64\\bin>g.gisenv.exe set="GRASS_GUI=text" 

C:\\OSGeo4W64\\bin>g.proj -c proj4="+proj=tmerc +lat_0=39.66825833333333 +lon_0=-8.133108333333334 +k=1 +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs" 
Default region was updated to the new projection, but if you have multiple mapsets `g.region -d` should be run in each to update the region from the default 
Projection information updated 

C:\\OSGeo4W64\\bin>r.in.gdal input=D:\\Testes\\sample_raster\
aster_1.tif output=raster_1 --overwrite -o 
ATENÇÃO: Over-riding projection check 
Proceeding with import of 1 raster bands... 
Importing raster map ... 
0..3..6..9..12..15..18..21..24..27..30..33..36..39..42..45..48..51..54..57..60..63..66..69..72..75..78..81..84..87..90..93..96..99..100 

C:\\OSGeo4W64\\bin>g.region -a n=137550.0 s=112250.0 e=100125.0 w=74200.0 res=25.0 

C:\\OSGeo4W64\\bin>r.mapcalc expression="raster_2=raster_1*2" --overwrite 
r nÆo era esperado nesta altura. 

C:\\OSGeo4W64\\bin>for r in $(g.list type=rast); do 

C:\\OSGeo4W64\\bin>set HOME=C:\\Users\\pedro 

C:\\OSGeo4W64\\bin>set GISRC=C:\\Users\\pedro\\.qgis2\\\\processing\\processing.gisrc7 

C:\\OSGeo4W64\\bin>set GRASS_SH=C:\\OSGeo4W64\\apps\\msys\\bin\\sh.exe 

C:\\OSGeo4W64\\bin>set PATH=C:\\OSGeo4W64\\apps\\msys\\bin;C:\\OSGeo4W64\\apps\\msys\\lib;c:\\osgeo4~1\\apps\\python27\\lib\\site-packages\\shapely-1.2.18-py2.7-win-amd64.egg\\shapely\\DLLs;C:\\OSGEO4~1\\apps\\Python27\\DLLs;C:\\OSGEO4~1\\apps\\Python27\\lib\\site-packages\
umpy\\core;C:\\OSGEO4~1\\apps\\qgis-rel-dev\\bin;C:\\OSGEO4~1\\apps\\grass\\grass-7.0.3\\lib;C:\\OSGEO4~1\\apps\\grass\\grass-7.0.3\\bin;C:\\OSGEO4~1\\apps\\Python27\\Scripts;C:\\OSGEO4~1\\bin;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\WBem;C:\\OSGEO4~1\\apps\\msys\\bin 

C:\\OSGeo4W64\\bin>set WINGISBASE=C:\\OSGeo4W64\\apps\\grass\\grass-7.0.3 

C:\\OSGeo4W64\\bin>set GISBASE=C:\\OSGeo4W64\\apps\\grass\\grass-7.0.3 

C:\\OSGeo4W64\\bin>set GRASS_PROJSHARE=C:\\OSGeo4W64\\apps\\grass\\grass-7.0.3\\share\\proj 

C:\\OSGeo4W64\\bin>set GRASS_MESSAGE_FORMAT=plain 

C:\\OSGeo4W64\\bin>if "" == "" set PATH=C:\\OSGeo4W64\\apps\\grass\\grass-7.0.3\\bin;C:\\OSGeo4W64\\apps\\grass\\grass-7.0.3\\lib;C:\\OSGeo4W64\\apps\\msys\\bin;C:\\OSGeo4W64\\apps\\msys\\lib;c:\\osgeo4~1\\apps\\python27\\lib\\site-packages\\shapely-1.2.18-py2.7-win-amd64.egg\\shapely\\DLLs;C:\\OSGEO4~1\\apps\\Python27\\DLLs;C:\\OSGEO4~1\\apps\\Python27\\lib\\site-packages\
umpy\\core;C:\\OSGEO4~1\\apps\\qgis-rel-dev\\bin;C:\\OSGEO4~1\\apps\\grass\\grass-7.0.3\\lib;C:\\OSGEO4~1\\apps\\grass\\grass-7.0.3\\bin;C:\\OSGEO4~1\\apps\\Python27\\Scripts;C:\\OSGEO4~1\\bin;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\WBem;C:\\OSGEO4~1\\apps\\msys\\bin 

C:\\OSGeo4W64\\bin>if not "" == "" set PATH=C:\\OSGeo4W64\\apps\\grass\\grass-7.0.3\\bin;C:\\OSGeo4W64\\apps\\grass\\grass-7.0.3\\lib;;C:\\OSGeo4W64\\apps\\grass\\grass-7.0.3\\bin;C:\\OSGeo4W64\\apps\\grass\\grass-7.0.3\\lib;C:\\OSGeo4W64\\apps\\msys\\bin;C:\\OSGeo4W64\\apps\\msys\\lib;c:\\osgeo4~1\\apps\\python27\\lib\\site-packages\\shapely-1.2.18-py2.7-win-amd64.egg\\shapely\\DLLs;C:\\OSGEO4~1\\apps\\Python27\\DLLs;C:\\OSGEO4~1\\apps\\Python27\\lib\\site-packages\
umpy\\core;C:\\OSGEO4~1\\apps\\qgis-rel-dev\\bin;C:\\OSGEO4~1\\apps\\grass\\grass-7.0.3\\lib;C:\\OSGEO4~1\\apps\\grass\\grass-7.0.3\\bin;C:\\OSGEO4~1\\apps\\Python27\\Scripts;C:\\OSGEO4~1\\bin;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\WBem;C:\\OSGEO4~1\\apps\\msys\\bin 

C:\\OSGeo4W64\\bin>set GRASS_VERSION=7.0.0 

C:\\OSGeo4W64\\bin>if not "" == "" goto langset 

C:\\OSGeo4W64\\bin>FOR /F "usebackq delims==" %i IN (`"C:\\OSGeo4W64\\apps\\grass\\grass-7.0.3\\etc\\winlocale"`) DO @set LANG=%i 

C:\\OSGeo4W64\\bin>set PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY 

C:\\OSGeo4W64\\bin>set PYTHONPATH=C:\\OSGeo4W64\\apps\\grass\\grass-7.0.3\\etc\\python;C:\\OSGeo4W64\\apps\\grass\\grass-7.0.3\\etc\\wxpython\

C:\\OSGeo4W64\\bin>g.gisenv.exe set="MAPSET=PERMANENT" 

C:\\OSGeo4W64\\bin>g.gisenv.exe set="LOCATION=temp_location" 

C:\\OSGeo4W64\\bin>g.gisenv.exe set="LOCATION_NAME=temp_location" 

C:\\OSGeo4W64\\bin>g.gisenv.exe set="GISDBASE=C:\\Users\\pedro\\AppData\\Local\\Temp\\processinga01588b329db4c8ca1aaf4c7a1bce49a\\grassdata" 

C:\\OSGeo4W64\\bin>g.gisenv.exe set="GRASS_GUI=text" 
r nÆo era esperado nesta altura. 

C:\\OSGeo4W64\\bin>for r in $(g.list type=rast); do 
Converting outputs
Loading resulting layers
Algorithm r.mapcalc - Raster map calculator. finished

without results.

The problem appears to be in the loop:

C:\\OSGeo4W64\\bin>r.mapcalc expression="raster_2=raster_1*2" --overwrite 
r nÆo era esperado nesta altura. 

C:\\OSGeo4W64\\bin>for r in $(g.list type=rast); do 
C:\\OSGeo4W64\\bin>g.gisenv.exe set="GRASS_GUI=text" 
r nÆo era esperado nesta altura. 

C:\\OSGeo4W64\\bin>for r in $(g.list type=rast); do 

Thanks!

qgib commented 8 years ago

Author Name: Giovanni Manghi (@gioman)


Hi,

I?m also struggling to get nay result (on both Windows and Linux) out of this new implementation of r.mapcalc. Or maybe is not yet completely ready?

qgib commented 8 years ago

Author Name: Giovanni Manghi (@gioman)


Giovanni Manghi wrote:

Hi,

I?m also struggling to get nay result (on both Windows and Linux) out of this new implementation of r.mapcalc. Or maybe is not yet completely ready?

seems ok on linux after all (I didn't get immediately that the expression needs to be written in the form "output = ..."), but still not ok on Windows.

One question: is possible in expression to use letters instead of the input raster names?

qgib commented 7 years ago

Author Name: Paolo Cavallini (@pcav)


Currently the command is quite cumbersome:

Should I fill individual tickets for these issues?

qgib commented 7 years ago

Author Name: Paolo Cavallini (@pcav)


qgib commented 7 years ago

Author Name: Alexander Bruy (@alexbruy)


Closing this, as now Processing has front-end to QGIS native raster calculator and GRASS 6 was removed.


qgib commented 7 years ago

Author Name: Giovanni Manghi (@gioman)


Alexander Bruy wrote:

Closing this, as now Processing has front-end to QGIS native raster calculator and GRASS 6 was removed.

Hi Alexander and Victor. I think -if you agree- that we should open a new bug ticket about GRASS7 r.mapcalc.

(native) GRASS6 had both r.mapcalc (the real raster calculator tool) and r.mapcalculator, the latter a python wrapper for r.mapcalc that made the use of the raster calculator very convenient, allowing refer to input maps with letters and to use any of the r.mapcalc operators.

r.mapcalculator was present in Processing GRASS6 provider but as it wasn't ported GRASS7 we have also lost access to GRASS raster calculator in Processing/GRASS7.

That was until Médéric RIBREUX implemented r.mapcalc in Processing/GRASS7. Problem is that this implementation is partly working (see above comments) and it would be nice to have the issues sorted, if possible.

qgib commented 7 years ago

Author Name: Olivier ATHIMON (Olivier ATHIMON)


Hi all,

I have seen your message about r.mapcalc and r.mapcalculator... Indeed, even if i have discovered GRASS in year 1996, i must say: r.mapcalculator made the use of the raster calculator very convenient, allowing refer to input maps with letters and to use any of the r.mapcalc operators.

I miss r.mapcalculator with QGIS/GRASS7...

I think +i have found how to run "r.mapcalculator" inside Processing / GRASS 7 of QGIS 2.18.x under Windows 7 (64 bits)...+ I need some days to submit/transmit you my solution (my files).

I can study how to run again "r.mapcalc" if necessary, because i have the same error : C:\OSGeo4W64\bin>r.mapcalc expression="raster_2=raster_1*2" --overwrite r nÆo era esperado nesta altura.

C:\OSGeo4W64\bin>for r in $(g.list type=rast); do

where : "r nÆo era esperado nesta altura." give in my french language : "r tait inattendu..."

=============== For information, i can't load "Processing" with QGIS 2.99/Windows 7 (64 bits) <=> I have many errors... So, i will not be able to try r.mapcalc (and/or r.mapcalculor) with...

qgib commented 7 years ago

Author Name: Giovanni Manghi (@gioman)


I miss r.mapcalculator with QGIS/GRASS7...

r.mapcalculator was not ported from GRASS6 to 7 (not a QGIS issue) and this is were the problem started. In GRASS6 that module/script provided a very convinient way to use r.mapcalc.

qgib commented 7 years ago

Author Name: Pedro Venâncio (Pedro Venâncio)


Victor had created a new raster calculator using native QGIS classes, for QGIS 3:

https://github.com/qgis/QGIS/pull/3779

But in QGIS 2.x, r.mapcalc is still a must needed algorithm, and Vaclav Petras, in GRASS mailing list [0], pointed to the new -l flag introduced in GRASS72, to list inputs and outputs, which can solve the original problem of r.mapcalc:

https://grass.osgeo.org/grass72/manuals/r.mapcalc.html https://trac.osgeo.org/grass/ticket/2592 https://trac.osgeo.org/grass/changeset/67000

What do you think?

[0] http://osgeo-org.1560.x6.nabble.com/r-mapcalculator-and-r-mapcalc-td5308738.html

qgib commented 7 years ago

Author Name: Giovanni Manghi (@gioman)


qgib commented 5 years ago

Author Name: Markus Neteler (Markus Neteler)


FYI: The new r.mapcalculator has been developed by Vaclav Petras:

https://trac.osgeo.org/grass/ticket/3431#comment:7


I think it's very important to include GRASS r.mapcalc on Sextante. At this moment, is lacking on Sextante an advanced raster calculator, with the potential of r.mapcalc (with advanced operators and functions). http://grass.osgeo.org/grass64/manuals/r.mapcalc.html

Is there any limitation that prevents the inclusion of this tool? Right now it seems to me the biggest absence on Sextante.

Thanks! to Hi,

I think it's very important to include GRASS r.mapcalc on Sextante. At this moment, is lacking on Sextante an advanced raster calculator, with the potential of r.mapcalc (with advanced operators and functions). http://grass.osgeo.org/grass64/manuals/r.mapcalc.html

Is there any limitation that prevents the inclusion of this tool? Right now it seems to me the biggest absence on Sextante.

Thanks!

qgib commented 5 years ago

Author Name: Giovanni Manghi (@gioman)


Markus Neteler wrote:

FYI: The new r.mapcalculator has been developed by Vaclav Petras:

https://trac.osgeo.org/grass/ticket/3431#comment:7

I tested in QGIS/master/Processing and works ok! this is a very good news indeed!

qgib commented 5 years ago

Author Name: Pedro Venâncio (Pedro Venâncio)


I've tested also in QGIS 2.18.25, both on Windows and Linux, and it works really well!

Thank you very much Vaclav Petras!

qgib commented 5 years ago

Author Name: Giovanni Manghi (@gioman)


https://github.com/qgis/QGIS/pull/8444


qgib commented 5 years ago

Author Name: Markus Neteler (Markus Neteler)


FYI: r.mapcalculator moved as r.mapcalc.simple to GRASS GIS trunk (see https://trac.osgeo.org/grass/ticket/3431 with change https://trac.osgeo.org/grass/changeset/73791).

After some testing it will go to GRASS GIS 7.6.

qgib commented 5 years ago

Author Name: Pedro Venâncio (Pedro Venâncio)


Thank you very much Markus!

I've been testing it (still as r.mapcalculator plugin) in QGIS 2.18.26 and 3.4.2 and it works like a charm!

I've missed it so much for a long time!