Skip to content
Permalink
Browse files

[processing] get layers list using map layer registry

fixes #16919
  • Loading branch information
volaya committed Jul 24, 2017
1 parent a3bb3f1 commit 3ee5d184512f29746e55fbc531a31ee9f6912ff4
Showing with 3 additions and 3 deletions.
  1. +3 −3 python/plugins/processing/tools/dataobjects.py
@@ -74,7 +74,7 @@ def getSupportedOutputTableExtensions():


def getRasterLayers(sorting=True):
layers = QgsProject.instance().layerTreeRoot().findLayers()
layers = QgsMapLayerRegistry.instance().mapLayers().values()
raster = [lay.layer() for lay in layers if lay.layer() is not None and canUseRasterLayer(lay.layer())]
if sorting:
return sorted(raster, key=lambda layer: layer.name().lower())
@@ -83,7 +83,7 @@ def getRasterLayers(sorting=True):


def getVectorLayers(shapetype=[-1], sorting=True):
layers = QgsProject.instance().layerTreeRoot().findLayers()
layers = QgsMapLayerRegistry.instance().mapLayers().values()
vector = [lay.layer() for lay in layers if canUseVectorLayer(lay.layer(), shapetype)]
if sorting:
return sorted(vector, key=lambda layer: layer.name().lower())
@@ -115,7 +115,7 @@ def getAllLayers():


def getTables(sorting=True):
layers = QgsProject.instance().layerTreeRoot().findLayers()
layers = QgsMapLayerRegistry.instance().mapLayers().values()
tables = []
for layer in layers:
mapLayer = layer.layer()

0 comments on commit 3ee5d18

Please sign in to comment.
You can’t perform that action at this time.