Skip to content

Commit

Permalink
Merge pull request #438 from MatMatt/master
Browse files Browse the repository at this point in the history
[sextante] added quotation marks to make passFileNames work.
  • Loading branch information
volaya committed Feb 25, 2013
2 parents 5ac7d03 + cfb56a2 commit f85d3ae
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions python/plugins/sextante/r/RAlgorithm.py
Expand Up @@ -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):
Expand Down Expand Up @@ -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:
Expand All @@ -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)):
Expand All @@ -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()
Expand All @@ -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
Expand Down

0 comments on commit f85d3ae

Please sign in to comment.