[QGIS-Developer] Python QGIS 3 and the list of all visible layer in the map
enrico chiaradia
enrico.chiaradia at yahoo.it
Tue Sep 18 11:43:53 PDT 2018
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 at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20180918/b0761a82/attachment.html>
More information about the QGIS-Developer
mailing list