Skip to content
Permalink
Browse files
Merge pull request #438 from MatMatt/master
[sextante] added quotation marks to make passFileNames work.
  • Loading branch information
volaya committed Feb 25, 2013
2 parents 5ac7d03 + cfb56a2 commit f85d3ae71f5433325765b0d2e74c5859db366a01
Showing 1 changed file with 9 additions and 9 deletions.
@@ -242,7 +242,7 @@ def getExportCommands(self):
value = value + ".tif"
value = value.replace("\\", "/")
if self.useRraster:
commands.append("writeRaster(" + out.name + ",\"" + value + "\", datatype=dataType(" + out.name + "), overwrite=TRUE)")
commands.append("writeRaster(" + out.name + ",\"" + value + "\", overwrite=TRUE)")
else:
commands.append("writeGDAL(" + out.name + ",\"" + value + "\")")
if isinstance(out, OutputVector):
@@ -282,7 +282,7 @@ def getImportCommands(self):
value = param.value
value = value.replace("\\", "/")
if self.passFileNames:
commands.append(param.name + " = " + value)
commands.append(param.name + " = \"" + value + "\"")
elif self.useRasterPackage:
commands.append(param.name + " = " + "brick(\"" + value + "\")")
else:
@@ -294,15 +294,15 @@ def getImportCommands(self):
filename = filename[:-4]
folder = os.path.dirname(value)
if self.passFileNames:
commands.append(param.name + " = " + value)
commands.append(param.name + " = \"" + value + "\"")
else:
commands.append(param.name + " = readOGR(\"" + folder + "\",layer=\"" + filename + "\")")
if isinstance(param, ParameterTable):
value = param.value
if not value.lower().endswith("csv"):
raise GeoAlgorithmExecutionException("Unsupported input file format.\n" + value)
if self.passFileNames:
commands.append(param.name + " = " + value)
commands.append(param.name + " = \"" + value + "\"")
else:
commands.append(param.name + " <- read.csv(\"" + value + "\", head=TRUE, sep=\",\")")
elif isinstance(param, (ParameterTableField, ParameterString, ParameterFile)):
@@ -323,11 +323,11 @@ def getImportCommands(self):
#raise GeoAlgorithmExecutionException("Unsupported input file format.\n" + layer)
layer = layer.replace("\\", "/")
if self.passFileNames:
commands.append("tempvar" + str(iLayer)+ " = \"" + layer + "\"")
commands.append("tempvar" + str(iLayer)+ " <- \"" + layer + "\"")
elif self.useRasterPackage:
commands.append("tempvar" + str(iLayer)+ " = " + "brick(\"" + layer + "\")")
commands.append("tempvar" + str(iLayer)+ " <- " + "brick(\"" + layer + "\")")
else:
commands.append("tempvar" + str(iLayer)+ " = " + "readGDAL(\"" + layer + "\")")
commands.append("tempvar" + str(iLayer)+ " <- " + "readGDAL(\"" + layer + "\")")
iLayer+=1
else:
exported = param.getSafeExportedLayers()
@@ -339,9 +339,9 @@ def getImportCommands(self):
filename = os.path.basename(layer)
filename = filename[:-4]
if self.passFileNames:
commands.append("tempvar" + str(iLayer)+ " = \"" + layer + "\"")
commands.append("tempvar" + str(iLayer)+ " <- \"" + layer + "\"")
else:
commands.append("tempvar" + str(iLayer) + " = " + "readOGR(\"" + layer + "\",layer=\"" + filename + "\")")
commands.append("tempvar" + str(iLayer) + " <- " + "readOGR(\"" + layer + "\",layer=\"" + filename + "\")")
iLayer+=1
s = ""
s += param.name

0 comments on commit f85d3ae

Please sign in to comment.