Skip to content

Commit

Permalink
[sextante]fix for calling SAGA under OSX
Browse files Browse the repository at this point in the history
  • Loading branch information
volaya committed Apr 6, 2013
1 parent eae1a97 commit 2bfffaa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
8 changes: 4 additions & 4 deletions python/plugins/sextante/saga/SagaAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def processAlgorithm(self, progress):
raise GeoAlgorithmExecutionException("Unsupported file format")

#2: set parameters and outputs
if SextanteUtils.isWindows():
if SextanteUtils.isWindows() or SextanteUtils.isMac():
command = self.undecoratedGroup + " \"" + self.cmdname + "\""
else:
command = "lib" + self.undecoratedGroup + " \"" + self.cmdname + "\""
Expand Down Expand Up @@ -300,7 +300,7 @@ def processAlgorithm(self, progress):
if isinstance(out, OutputRaster):
filename = out.getCompatibleFileName(self)
filename2 = SextanteUtils.tempFolder() + os.sep + os.path.basename(filename) + ".sgrd"
if SextanteUtils.isWindows():
if SextanteUtils.isWindows() or SextanteUtils.isMac():
commands.append("io_gdal 1 -GRIDS \"" + filename2 + "\" -FORMAT 1 -TYPE 0 -FILE \"" + filename + "\"");
else:
commands.append("libio_gdal 1 -GRIDS \"" + filename2 + "\" -FORMAT 1 -TYPE 0 -FILE \"" + filename + "\"");
Expand Down Expand Up @@ -335,7 +335,7 @@ def resampleRasterLayer(self,layer):
inputFilename = layer
destFilename = SextanteUtils.getTempFilename("sgrd")
self.exportedLayers[layer]= destFilename
if SextanteUtils.isWindows():
if SextanteUtils.isWindows() or SextanteUtils.isMac():
s = "grid_tools \"Resampling\" -INPUT \"" + inputFilename + "\" -TARGET 0 -SCALE_UP_METHOD 4 -SCALE_DOWN_METHOD 4 -USER_XMIN " +\
str(self.xmin) + " -USER_XMAX " + str(self.xmax) + " -USER_YMIN " + str(self.ymin) + " -USER_YMAX " + str(self.ymax) +\
" -USER_SIZE " + str(self.cellsize) + " -USER_GRID \"" + destFilename + "\""
Expand All @@ -349,7 +349,7 @@ def resampleRasterLayer(self,layer):
def exportRasterLayer(self, layer):
destFilename = SextanteUtils.getTempFilenameInTempFolder(os.path.basename(layer)[0:5] + ".sgrd")
self.exportedLayers[layer]= destFilename
if SextanteUtils.isWindows():
if SextanteUtils.isWindows() or SextanteUtils.isMac():
return "io_gdal 0 -GRIDS \"" + destFilename + "\" -FILES \"" + layer+"\""
else:
return "libio_gdal 0 -GRIDS \"" + destFilename + "\" -FILES \"" + layer + "\""
Expand Down
3 changes: 0 additions & 3 deletions python/plugins/sextante/saga/SagaUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@
from sextante.core.SextanteLog import SextanteLog
from qgis.core import *
from PyQt4.QtCore import *
from sextante.core.SextanteVectorWriter import SextanteVectorWriter
from sextante.core.QGisLayers import QGisLayers


class SagaUtils:

Expand Down

0 comments on commit 2bfffaa

Please sign in to comment.