Opened 7 years ago
Closed 6 years ago
#3431 closed enhancement (fixed)
r.mapcalculator script for QGIS processing
Reported by: | neteler | Owned by: | wenzeslaus |
---|---|---|---|
Priority: | normal | Milestone: | 7.6.0 |
Component: | Python | Version: | svn-trunk |
Keywords: | r.mapcalc.simple, r.mapcalculator, r.mapcalc, r3.mapcalculator, r3.mapcalc, QGIS | Cc: | |
CPU: | Unspecified | Platform: | Unspecified |
Description
A wish received via personal email:
On Mon, Oct 23, 2017 at 10:06 AM, a QGIS developer wrote:
it would be great to have the GRASS raster calculator back in Processing. Since GRASS7 r.mapcalculator been "lost" in Processing (because it also has not been ported from GRASS64 to 7, correct?) and the attempt to make r.mapcalc work was not completely successful (see: https://issues.qgis.org/issues/6894) If you could help with that it would be *much* appreciated!
The old parameters were:
https://grass.osgeo.org/grass64/manuals/r.mapcalculator.html
Apparently the interest in the QGIS community is high to get a wrapper back as it used to exist in G6.
Attachments (1)
Change History (29)
comment:1 by , 7 years ago
Milestone: | 7.2.3 → 7.4.0 |
---|
comment:2 by , 7 years ago
Milestone: | 7.4.0 → 7.4.1 |
---|
comment:3 by , 6 years ago
Milestone: | 7.4.1 → 7.4.2 |
---|
comment:4 by , 6 years ago
Milestone: | 7.4.2 → 7.6.0 |
---|
All enhancement tickets should be assigned to 7.6 milestone.
follow-up: 9 comment:6 by , 6 years ago
Keywords: | r3.mapcalculator r3.mapcalc QGIS added |
---|---|
Owner: | changed from | to
1) Here things I plan to use to get started implementing a simple solution, i.e. what was in 6.4. Please, let me know if you know about more.
- source:grass/branches/releasebranch_6_4/scripts/r.mapcalculator/r.mapcalculator
- source:grass/branches/releasebranch_6_4/scripts/r3.mapcalculator/r3.mapcalculator
- r67000 list maps flag (#2592)
2) Also, QGIS issue 6894, note 25 says:
Victor had created a new raster calculator using native QGIS classes...But in QGIS 2.x, r.mapcalc is still a must needed algorithm
So will this be even used? This being useful for other programs would be a good reason to have this.
3) Related to the generalization. What about other algebra modules, e.g. t.rast.mapcalc? Do we need a wrapper for each of those?
4) Since the simple solution is keeping the functionality in a separate module, I suggest to rethink the name of the module. r.mapcalc versus r.mapcalculator might be little confusing.
comment:7 by , 6 years ago
See sandbox for source code (Subversion history preserved, but it is a complete rewrite anyway):
source:sandbox/wenzeslaus/r.mapcalculator (r73642)
Usage: r.mapcalculator [-sqc] expression=string [a=name] [b=name] [c=name] [d=name] [e=name] [f=name] output=value [seed=value] [--help] [--verbose] [--quiet] [--ui] Flags: -s Generate random seed (result is non-deterministic) -q Quote the map names -c Case sensitive variable names Parameters: expression Formula (e.g. A-B or A*C+B) a A b B c C d D e E f F output Name for output raster map seed Seed for rand() function
r.mapcalculator expression="0" output=zeros r.mapcalculator expression="1" output=ones r.mapcalculator expression="2" output=twos r.mapcalculator expression="(A * B) / 2 + 3 * C" a=zeros b=ones c=twos output=result2
If you don't have sandbox repo, you can install also using:
g.extension r.mapcalculator url=https://trac.osgeo.org/grass/browser/sandbox/wenzeslaus/r.mapcalculator
I tried to cover in the documentation what are the differences to 5/6 version and r.mapcalc. Let me know what you think!
comment:8 by , 6 years ago
Great work! Successfully tested by Giovanni Manghi in QGIS (reported to me via personal email).
follow-up: 10 comment:9 by , 6 years ago
Replying to wenzeslaus:
4) Since the simple solution is keeping the functionality in a separate module, I suggest to rethink the name of the module. r.mapcalc versus r.mapcalculator might be little confusing.
How about: r.mapcalc.simple ?
follow-ups: 11 15 comment:10 by , 6 years ago
Replying to neteler:
Replying to wenzeslaus:
4) Since the simple solution is keeping the functionality in a separate module, I suggest to rethink the name of the module. r.mapcalc versus r.mapcalculator might be little confusing.
How about: r.mapcalc.simple ?
This works for me. It is to certain extent applicable to other modules, it is similar to the names of pseudo-modules in QGIS, and we can call the raster algebra in this module a simple raster algebra or a simplified raster algebra.
5) We need test for moving this to the core.
6) Are we backporting it to 7.6?
follow-up: 12 comment:11 by , 6 years ago
Replying to wenzeslaus:
Replying to neteler:
How about: r.mapcalc.simple ?
This works for me. It is to certain extent applicable to other modules, it is similar to the names of pseudo-modules in QGIS, and we can call the raster algebra in this module a simple raster algebra or a simplified raster algebra.
Yes, fine.
5) We need test for moving this to the core.
Please do :)
6) Are we backporting it to 7.6?
Yes, please. It is requested frequently and will not break anything.
follow-up: 13 comment:12 by , 6 years ago
Replying to neteler:
6) Are we backporting it to 7.6?
Yes, please. It is requested frequently and will not break anything.
Hi all,
Can it be backported to 7.4 also? It would be good to use with QGIS 2.18.
Thanks!
follow-up: 14 comment:13 by , 6 years ago
Replying to PedroNGV:
Replying to neteler:
6) Are we backporting it to 7.6?
Yes, please. It is requested frequently and will not break anything.
Hi all,
Can it be backported to 7.4 also? It would be good to use with QGIS 2.18.
Thanks!
what is the reason not to use QGIS 3.x? it's pretty stable now.
the focus of GRASS will be in the next step of releases, See
https://lists.osgeo.org/pipermail/grass-dev/2018-November/090600.html
comment:14 by , 6 years ago
Replying to hellik:
Replying to PedroNGV:
Replying to neteler:
6) Are we backporting it to 7.6?
Yes, please. It is requested frequently and will not break anything.
Hi all,
Can it be backported to 7.4 also? It would be good to use with QGIS 2.18.
Thanks!
what is the reason not to use QGIS 3.x? it's pretty stable now.
the focus of GRASS will be in the next step of releases, See
https://lists.osgeo.org/pipermail/grass-dev/2018-November/090600.html
QGIS 2.18 will be the LTR version until 22-02-2019. Besides that, as much of QGIS plugins were not yet updated to Python 3 and so, to QGIS 3, it is expected that QGIS 2.18 keeps being used for quite some time.
But as GRASS roadmap is pointing 7.6 final release to the end of this year, that should be enough to introduce that version in QGIS 2.18!
Thanks for the info about the release roadmap!
comment:15 by , 6 years ago
follow-ups: 17 18 comment:16 by , 6 years ago
If there are no objections, I'll move the r.mapcalculator in the sandbox SVN to trunk, renaming it to r.mapcalc.simple
comment:17 by , 6 years ago
Replying to neteler:
If there are no objections, I'll move the r.mapcalculator in the sandbox SVN to trunk, renaming it to
r.mapcalc.simple
+1
follow-up: 21 comment:18 by , 6 years ago
Keywords: | r.mapcalc.simple added |
---|---|
Version: | 7.2.2 → svn-trunk |
comment:20 by , 6 years ago
Any idea where to put to the menu? Raster -> Simplified raster map calculator
?
follow-up: 24 comment:21 by , 6 years ago
by , 6 years ago
Attachment: | mapcalc-menu-entry.png added |
---|
follow-up: 26 comment:23 by , 6 years ago
Is it r73829 acceptable for backporting into g76 release branch?
follow-ups: 25 27 comment:24 by , 6 years ago
comment:25 by , 6 years ago
Replying to martinl:
Replying to neteler:
I would include
r.mapcalc.simple
as a new module to GRASS 7.6.0. Why there is also backport to 7.4 release branch than? When 7.6.0 will be out than it will be integrated into QGIS.
Right. An indeed the really important point is to have Python3 support, means: get trunk out as stable version.
comment:26 by , 6 years ago
comment:27 by , 6 years ago
Replying to martinl:
Replying to neteler:
I would include
r.mapcalc.simple
as a new module to GRASS 7.6.0. Why there is also backport to 7.4 release branch than? When 7.6.0 will be out than it will be integrated into QGIS.
well, depends what we want. If r.mapcalc.simple
is planned to be included in last QGIS 2.18 release, there is last chance:
PR/FF 3.4.4 2.18.28 3.5 2019-01-18 3 5
In this case backport to 7.4 branch make sense. Then we could release 7.4.4 before 2019-01-18. Please note that also processing toolbox would need to be modified to include new GRASS module.
Ticket retargeted after milestone closed