Skip to content

Commit

Permalink
Merge pull request #949 from gioman/sagarasterimportexport
Browse files Browse the repository at this point in the history
[processing] fixes SAGA import and export rasters
  • Loading branch information
volaya committed Oct 20, 2013
2 parents f0c9efb + 84b682d commit 16ac256
Showing 1 changed file with 26 additions and 14 deletions.
40 changes: 26 additions & 14 deletions python/plugins/processing/saga/SagaAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,16 +359,24 @@ def processAlgorithm(self, progress):
if dontExport:
continue

transform = ('' if saga208 else '-TRANSFORM')
if isWindows() or isMac() or not saga208:
commands.append('io_gdal 1 -GRIDS "' + filename2
+ '" -FORMAT ' + str(formatIndex)
+ ' -TYPE 0 -FILE "' + filename + '"'
+ transform)
if self.cmdname == 'RGB Composite':
if isWindows() or isMac() or not saga208:
commands.append('io_grid_image 0 -IS_RGB -GRID:"' + filename2
+ '" -FILE:"' + filename
+ '"')
else:
commands.append('libio_grid_image 0 -IS_RGB -GRID:"' + filename2
+ '" -FILE:"' + filename
+ '"')
else:
commands.append('libio_gdal 1 -GRIDS "' + filename2
+ '" -FORMAT 1 -TYPE 0 -FILE "' + filename
+ '"' + transform)
if isWindows() or isMac() or not saga208:
commands.append('io_gdal 1 -GRIDS "' + filename2
+ '" -FORMAT ' + str(formatIndex)
+ ' -TYPE 0 -FILE "' + filename + '"')
else:
commands.append('libio_gdal 1 -GRIDS "' + filename2
+ '" -FORMAT 1 -TYPE 0 -FILE "' + filename
+ '"')

# 4: Run SAGA
commands = self.editCommands(commands)
Expand Down Expand Up @@ -462,12 +470,16 @@ def exportRasterLayer(self, source):
self.exportedLayers[source] = destFilename
sessionExportedLayers[source] = destFilename
saga208 = ProcessingConfig.getSetting(SagaUtils.SAGA_208)
if isWindows() or isMac() or not saga208:
return 'io_gdal 0 -GRIDS "' + destFilename + '" -FILES "' + source \
+ '"'
if saga208:
if isWindows() or isMac():
return 'io_gdal 0 -GRIDS "' + destFilename + '" -FILES "' + source \
+ '"'
else:
return 'libio_gdal 0 -GRIDS "' + destFilename + '" -FILES "' \
+ source + '"'
else:
return 'libio_gdal 0 -GRIDS "' + destFilename + '" -FILES "' \
+ source + '"'
return 'io_gdal 0 -TRANSFORM -INTERPOL 0 -GRIDS "' + destFilename + '" -FILES "' + source \
+ '"'

def checkBeforeOpeningParametersDialog(self):
msg = SagaUtils.checkSagaIsInstalled()
Expand Down

0 comments on commit 16ac256

Please sign in to comment.