Skip to content

Commit 6919d98

Browse files
committed
Merge branch 'master' of https://github.com/scubbx/QGIS into processing-r.stat
Conflicts: python/plugins/processing/algs/grass7/Grass7Algorithm.py
2 parents c729a75 + a3454e7 commit 6919d98

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

python/plugins/processing/algs/grass7/Grass7Algorithm.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,11 +361,24 @@ def processAlgorithm(self, progress):
361361
commands.append('g.region raster=' + out.name + uniqueSufix)
362362
outputCommands.append('g.region raster=' + out.name
363363
+ uniqueSufix)
364-
if self.grass7Name == 'r.composite':
364+
if self.grassName == 'r.statistics':
365+
# r.statistics saves its results in a non-qgis compatible way.
366+
# Post-Process with r.mapcalc.
367+
calcExpression = 'correctedoutput' + uniqueSufix
368+
calcExpression += '=@' + out.name + uniqueSufix
369+
command = 'r.mapcalc expression="' + calcExpression + '"'
370+
commands.append(command)
371+
outputCommands.append(command)
372+
365373
command = 'r.out.gdal -c createopt="TFW=YES,COMPRESS=LZW"'
366374
command += ' input='
367375
command += out.name + uniqueSufix
368376
command += ' output="' + filename + '"'
377+
elif self.grassName == 'r.statistics':
378+
command = 'r.out.gdal -c createopt="TFW=YES,COMPRESS=LZW"'
379+
command += ' input='
380+
command += 'correctedoutput' + uniqueSufix
381+
command += ' output="' + filename + '"'
369382
else:
370383
command = 'r.out.gdal -c createopt="TFW=YES,COMPRESS=LZW"'
371384
command += ' input='
@@ -375,6 +388,9 @@ def processAlgorithm(self, progress):
375388
elif self.grass7Name == 'r.composite':
376389
commands.append(command)
377390
outputCommands.append(command)
391+
elif self.grassName == 'r.statistics':
392+
commands.append(command)
393+
outputCommands.append(command)
378394
else:
379395
command += out.name + uniqueSufix
380396
command += ' output="' + filename + '"'

0 commit comments

Comments
 (0)