Re: [QGIS-Developer] Python QGIS 3 and the list of all visible layer in the map
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
Re: [QGIS-Developer] Python QGIS 3 and the list of all visible layer in the map
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] Python QGIS 3 and the list of all visible layer in the map
Hi list, I'm working on my plugin (IOGeopaparazzi) in order to make it available also for QGIS 3. I have troubles converting this function "iface.legendInterface().isLayerVisible(layer)" that checks the layer visibility in a loop of all loaded layers in the map. What I want to do is to make a list of only visible layers loaded in the map. legendInterface was completely deleted from the QGSI 3 API. How can I reproduce the same function in QGIS 3? Any suggestions? Thanks, enrico ___ 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