[processing] more robust CRS assignation for SAGA outputs

This commit is contained in:
volaya 2015-07-10 12:41:14 +02:00
parent 368eaa258b
commit 519d3dc3b7
2 changed files with 14 additions and 0 deletions

View File

@ -242,6 +242,13 @@ class SagaAlgorithm212(GeoAlgorithm):
ProcessingLog.addToLog(ProcessingLog.LOG_INFO, loglines)
SagaUtils.executeSaga(progress)
if self.crs is not None:
for out in self.outputs:
if isinstance(out, (OutputVector, OutputRaster)):
prjFile = os.path.splitext(out.getCompatibleFileName(self))[0] + ".prj"
with open(prjFile, "w") as f:
f.write(self.crs.toWkt())
def preProcessInputs(self):
name = self.commandLineName().replace('.', '_')[len('saga:'):]

View File

@ -194,4 +194,11 @@ class SagaAlgorithm213(SagaAlgorithm212):
ProcessingLog.addToLog(ProcessingLog.LOG_INFO, loglines)
SagaUtils.executeSaga(progress)
if self.crs is not None:
for out in self.outputs:
if isinstance(out, (OutputVector, OutputRaster)):
prjFile = os.path.splitext(out.getCompatibleFileName(self))[0] + ".prj"
with open(prjFile, "w") as f:
f.write(self.crs.toWkt())