Skip to content

Commit 519d3dc

Browse files
committed
[processing] more robust CRS assignation for SAGA outputs
1 parent 368eaa2 commit 519d3dc

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

python/plugins/processing/algs/saga/SagaAlgorithm212.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,13 @@ def processAlgorithm(self, progress):
242242
ProcessingLog.addToLog(ProcessingLog.LOG_INFO, loglines)
243243
SagaUtils.executeSaga(progress)
244244

245+
if self.crs is not None:
246+
for out in self.outputs:
247+
if isinstance(out, (OutputVector, OutputRaster)):
248+
prjFile = os.path.splitext(out.getCompatibleFileName(self))[0] + ".prj"
249+
with open(prjFile, "w") as f:
250+
f.write(self.crs.toWkt())
251+
245252

246253
def preProcessInputs(self):
247254
name = self.commandLineName().replace('.', '_')[len('saga:'):]

python/plugins/processing/algs/saga/SagaAlgorithm213.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,4 +194,11 @@ def processAlgorithm(self, progress):
194194
ProcessingLog.addToLog(ProcessingLog.LOG_INFO, loglines)
195195
SagaUtils.executeSaga(progress)
196196

197+
if self.crs is not None:
198+
for out in self.outputs:
199+
if isinstance(out, (OutputVector, OutputRaster)):
200+
prjFile = os.path.splitext(out.getCompatibleFileName(self))[0] + ".prj"
201+
with open(prjFile, "w") as f:
202+
f.write(self.crs.toWkt())
203+
197204

0 commit comments

Comments
 (0)