mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-17 00:04:02 -04:00
[processing] explisitly load outputs as raster or vector depending
on the output type. Don't rely on extension or other indirect attributes
This commit is contained in:
parent
83613204fa
commit
dc5ba8ffe9
@ -71,9 +71,11 @@ def handleAlgorithmResults(alg, context, feedback=None, showResults=True):
|
||||
name = os.path.basename(out.value)
|
||||
else:
|
||||
name = out.description
|
||||
|
||||
isRaster = True if isinstance(out, OutputRaster) else False
|
||||
dataobjects.load(out.value, name, alg.crs,
|
||||
RenderingStyles.getStyle(alg.id(),
|
||||
out.name))
|
||||
RenderingStyles.getStyle(alg.id(), out.name),
|
||||
isRaster)
|
||||
except Exception:
|
||||
QgsMessageLog.logMessage("Error loading result layer:\n" + traceback.format_exc(), 'Processing', QgsMessageLog.CRITICAL)
|
||||
wrongLayers.append(out.description)
|
||||
|
@ -102,7 +102,7 @@ def getSupportedOutputRasterLayerExtensions():
|
||||
return allexts
|
||||
|
||||
|
||||
def load(fileName, name=None, crs=None, style=None):
|
||||
def load(fileName, name=None, crs=None, style=None, isRaster=False):
|
||||
"""Loads a layer/table into the current project, given its file.
|
||||
"""
|
||||
|
||||
@ -116,8 +116,7 @@ def load(fileName, name=None, crs=None, style=None):
|
||||
if name is None:
|
||||
name = os.path.split(fileName)[1]
|
||||
|
||||
suffix = os.path.splitext(fileName)[1][1:]
|
||||
if suffix in getSupportedOutputRasterLayerExtensions():
|
||||
if isRaster:
|
||||
qgslayer = QgsRasterLayer(fileName, name)
|
||||
if qgslayer.isValid():
|
||||
if crs is not None and qgslayer.crs() is None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user