Skip to content

Commit 78679ad

Browse files
author
gioman
committed
fixes SAGA import and export rasters
1 parent bad4b77 commit 78679ad

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

python/plugins/processing/saga/SagaAlgorithm.py

+18-10
Original file line numberDiff line numberDiff line change
@@ -359,16 +359,24 @@ def processAlgorithm(self, progress):
359359
if dontExport:
360360
continue
361361

362-
transform = ('' if saga208 else '-TRANSFORM')
363-
if isWindows() or isMac() or not saga208:
364-
commands.append('io_gdal 1 -GRIDS "' + filename2
365-
+ '" -FORMAT ' + str(formatIndex)
366-
+ ' -TYPE 0 -FILE "' + filename + '"'
367-
+ transform)
362+
if self.cmdname == 'RGB Composite':
363+
if isWindows() or isMac() or not saga208:
364+
commands.append('io_grid_image 0 -IS_RGB -GRID:"' + filename2
365+
+ '" -FILE:"' + filename
366+
+ '"')
367+
else:
368+
commands.append('libio_grid_image 0 -IS_RGB -GRID:"' + filename2
369+
+ '" -FILE:"' + filename
370+
+ '"')
368371
else:
369-
commands.append('libio_gdal 1 -GRIDS "' + filename2
370-
+ '" -FORMAT 1 -TYPE 0 -FILE "' + filename
371-
+ '"' + transform)
372+
if isWindows() or isMac() or not saga208:
373+
commands.append('io_gdal 1 -GRIDS "' + filename2
374+
+ '" -FORMAT ' + str(formatIndex)
375+
+ ' -TYPE 0 -FILE "' + filename + '"')
376+
else:
377+
commands.append('libio_gdal 1 -GRIDS "' + filename2
378+
+ '" -FORMAT 1 -TYPE 0 -FILE "' + filename
379+
+ '"')
372380

373381
# 4: Run SAGA
374382
commands = self.editCommands(commands)
@@ -463,7 +471,7 @@ def exportRasterLayer(self, source):
463471
sessionExportedLayers[source] = destFilename
464472
saga208 = ProcessingConfig.getSetting(SagaUtils.SAGA_208)
465473
if isWindows() or isMac() or not saga208:
466-
return 'io_gdal 0 -GRIDS "' + destFilename + '" -FILES "' + source \
474+
return 'io_gdal 0 -TRANSFORM -INTERPOL 0 -GRIDS "' + destFilename + '" -FILES "' + source \
467475
+ '"'
468476
else:
469477
return 'libio_gdal 0 -GRIDS "' + destFilename + '" -FILES "' \

0 commit comments

Comments
 (0)