@@ -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