Skip to content

Commit cd7dfda

Browse files
committedMay 26, 2017
[processing] explisitly load outputs as raster or vector depending on
output type. Don't rely on extension or other indirect attributes
1 parent cea93fa commit cd7dfda

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed
 

‎python/plugins/processing/gui/Postprocessing.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,11 @@ def handleAlgorithmResults(alg, progress=None, showResults=True):
7070
name = os.path.basename(out.value)
7171
else:
7272
name = out.description
73+
74+
isRaster = True if isinstance(out, OutputRaster) else False
7375
dataobjects.load(out.value, name, alg.crs,
74-
RenderingStyles.getStyle(alg.commandLineName(),
75-
out.name))
76+
RenderingStyles.getStyle(alg.commandLineName(), out.name),
77+
isRaster)
7678
except Exception:
7779
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
7880
"Error loading result layer:\n" + traceback.format_exc())

‎python/plugins/processing/tools/dataobjects.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def loadList(layers):
156156
load(layer)
157157

158158

159-
def load(fileName, name=None, crs=None, style=None):
159+
def load(fileName, name=None, crs=None, style=None, isRaster=False):
160160
"""Loads a layer/table into the current project, given its file.
161161
"""
162162

@@ -170,8 +170,7 @@ def load(fileName, name=None, crs=None, style=None):
170170
if name is None:
171171
name = os.path.split(fileName)[1]
172172

173-
suffix = os.path.splitext(fileName)[1][1:]
174-
if suffix in getSupportedOutputRasterLayerExtensions():
173+
if isRaster:
175174
qgslayer = QgsRasterLayer(fileName, name)
176175
if qgslayer.isValid():
177176
if crs is not None and qgslayer.crs() is None:

0 commit comments

Comments
 (0)
Please sign in to comment.