Feature request #6894
GRASS r.mapcalc cumbersome to use, issues on Windows
Status: | In Progress | ||
---|---|---|---|
Priority: | High | ||
Assignee: | Victor Olaya | ||
Category: | Processing/GRASS | ||
Pull Request or Patch supplied: | Yes | Resolution: | fixed/implemented |
Easy fix?: | No | Copied to github as #: | 16019 |
Description
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!
History
#1 Updated by Victor Olaya almost 12 years ago
- Status changed from Open to Feedback
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...
#2 Updated by Pedro Venâncio almost 12 years ago
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.
#3 Updated by Pedro Venâncio almost 12 years ago
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
- Addition (+)
- Subtraction ( - )
- Multiplication (*)
- Division (/)
- Power (^)
- ln(x): returns natural logarithm of x. (but ln(e) will not return 1 !!!)
- sin(x): returns the sine of x. x must be in radians
- cos(x): returns the cosine of x. x must be in radians
- cos(x): returns the tangente of x. x must be in radians
- asin(x): returns the arcsine of x, in radians
- acos(x): returns the arccosine of x, in radians
- atan(x): returns the arctangent of x, in radians
- atan2(x,y): returns the arctangent y/x, in radians
- abs(x): return the absolute value of x. abs( - 5 )=5
- int(x): returns the integer part of x. int(5.4)=5
- mod(x,y): returns the modulus of x/y. mod(7,4)=3
- gt(x,y): true if x is greater than y
- lt(x,y): true if x is lower than y
- eq(x,y): true if x equals y. When using this function SAGA evaluates it in a per–cell basis. Therefore, eq(a,b) will not return 1 if grid a equals grid b. It will return 1 for those cells that have the same value in both grids, and zero otherwise.
- ifelse(condition, x, y) returns x if condition evaluates to true (condition=1) or y if it
evaluates to false
It's a fairly comprehensive list, and from those functions that I regularly use, I'm just noting the lack of a round funtion:
- round(x): round x to nearest integer
Is there any other way to achieve the round function? We can always use: int((x+0.5))
Thanks!
#4 Updated by Markus Neteler over 11 years ago
See also Feature #6372 - r.mapcalculator
#5 Updated by Pedro Venâncio almost 11 years ago
- Status changed from Feedback to Closed
Hi,
#6372 is now fixed and support r.mapcalc functions.
Thanks!
#6 Updated by Giovanni Manghi almost 11 years ago
- Status changed from Closed to Open
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.
#7 Updated by Pedro Venâncio almost 11 years ago
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.
#8 Updated by Paolo Cavallini over 10 years ago
I stress the importance of having GRASS mapcalc, as it is very flexible, and may be the only (easiest) way of doing proximity calculations.
#9 Updated by Giovanni Manghi about 10 years ago
- Project changed from 78 to QGIS Application
- Category deleted (
59)
#10 Updated by Giovanni Manghi about 10 years ago
- Category set to Processing/GRASS
#11 Updated by Giovanni Manghi over 9 years ago
Adding r.mapcalc becomes now paramount because in GRASS 7 there is no more r.mapcalculator
#12 Updated by Giovanni Manghi almost 9 years ago
there is hope see
#13 Updated by Giovanni Manghi almost 9 years ago
Giovanni Manghi wrote:
there is hope see
I'm not sure that this new flag in r.mapcalc can help us.
#14 Updated by Médéric RIBREUX over 8 years ago
- Status changed from Open to In Progress
Hello,
there is a PR for this !
I need some help for MS-Windows tests before the merge...
Feel free to report bugs on r.mapcalc.
#15 Updated by Pedro Venâncio over 8 years ago
- File sample_raster.tar.gz added
Médéric RIBREUX wrote:
Hello,
there is a PR for this !
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!!
#16 Updated by Pedro Venâncio over 8 years ago
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!
#17 Updated by Giovanni Manghi over 8 years ago
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?
#18 Updated by Giovanni Manghi about 8 years ago
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?
#19 Updated by Paolo Cavallini almost 8 years ago
Currently the command is quite cumbersome:
- rasters have to be selected in the interface anyway (quite pointless from user perspective)
- raster names have to be entered by hand, with no clue (the names in the interface are the labels, not the real names)
- the output layer is not loaded automatically
Should I fill individual tickets for these issues?
#20 Updated by Paolo Cavallini almost 8 years ago
- Subject changed from GRASS r.mapcalc to GRASS r.mapcalc cumbersome to use, issues on Windows
#21 Updated by Alexander Bruy almost 8 years ago
- Resolution set to fixed/implemented
Closing this, as now Processing has front-end to QGIS native raster calculator and GRASS 6 was removed.
#22 Updated by Giovanni Manghi almost 8 years ago
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.
#23 Updated by Olivier ATHIMON over 7 years ago
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...
#24 Updated by Giovanni Manghi over 7 years ago
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.
#25 Updated by Pedro Venâncio over 7 years ago
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
#26 Updated by Giovanni Manghi over 7 years ago
- Easy fix? set to No
#27 Updated by Markus Neteler almost 6 years ago
- Description updated (diff)
FYI: The new r.mapcalculator has been developed by Vaclav Petras:
#28 Updated by Giovanni Manghi almost 6 years ago
Markus Neteler wrote:
FYI: The new r.mapcalculator has been developed by Vaclav Petras:
I tested in QGIS/master/Processing and works ok! this is a very good news indeed!
#29 Updated by Pedro Venâncio almost 6 years ago
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!
#30 Updated by Giovanni Manghi almost 6 years ago
- Pull Request or Patch supplied changed from No to Yes
#31 Updated by Markus Neteler almost 6 years ago
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.
#32 Updated by Pedro Venâncio almost 6 years ago
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!