Thanks Tom!
for those who need, this is a working snippet for processing alghorithm:
layermap = iface.mapCanvas().layers()
layers = []
# add only visible layers
layTreeRoot = QgsProject.instance().layerTreeRoot()
for layer in layermap:
if layTreeRoot.findLayer(layer.id()).isVisible():
layers.append(layer)
Il 18/09/2018 15:42, Tom Chadwin ha scritto:
Hi Enrico
You can use the Layer Tree API. Something like:
project.layerTreeRoot().findLayer(layer.id()).isVisible()
Tom
-
Buy Pie Spy: Adventures in British pastry 2010-11 on Amazon
--
Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-f4099106.html
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer