[GRASS-dev] [GRASS GIS] #3858: r.mapcalc - Add warning when the same map is used both as an input and an output

GRASS GIS trac at osgeo.org
Sat Jun 1 02:59:52 PDT 2019


#3858: r.mapcalc  - Add warning when the same map is used both as an input and an
output
-------------------------+-------------------------
 Reporter:  Hygsson      |      Owner:  grass-dev@…
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  7.6.2
Component:  Raster       |    Version:  unspecified
 Keywords:  r.mapcalc    |        CPU:  x86-64
 Platform:  MSWindows 7  |
-------------------------+-------------------------
 A map cannot be used both as an input and as an output as in this invalid
 expression `oldmap = oldmap + 1`, instead a subsequent rename using
 `g.rename` is needed when the same name is desired:

 {{{
 r.mapcalc "newmap = oldmap + 1"
 g.rename raster=newmap,oldmap
 }}}

 While `(oldmap = oldmap + 1)` may work on Linux, it will result in error
 on Windows.

 As Wenzeslaus suggested in ticket:3857#comment:1, the solution might be to
 check inputs and outputs beforehand and add a warning for Linux and an
 error message for MS Windows.

-- 
Ticket URL: <https://trac.osgeo.org/grass/ticket/3858>
GRASS GIS <https://grass.osgeo.org>



More information about the grass-dev mailing list