<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#006600" bgcolor="#FFFFFF">
    <p>Thanks Tom!</p>
    <p>for those who need, this is a working snippet for processing
      alghorithm:</p>
    <p>        layermap = iface.mapCanvas().layers()<br>
              layers = []<br>
              # add only visible layers<br>
              layTreeRoot = QgsProject.instance().layerTreeRoot()<br>
              for layer in layermap:<br>
                  if layTreeRoot.findLayer(layer.id()).isVisible():<br>
                      layers.append(layer)<br>
    </p>
    <br>
    <div class="moz-cite-prefix">Il 18/09/2018 15:42, Tom Chadwin ha
      scritto:<br>
    </div>
    <blockquote type="cite"
      cite="mid:1537278148047-0.post@n6.nabble.com">
      <pre wrap="">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: <a class="moz-txt-link-freetext" href="http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-f4099106.html">http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-f4099106.html</a>
_______________________________________________
QGIS-Developer mailing list
<a class="moz-txt-link-abbreviated" href="mailto:QGIS-Developer@lists.osgeo.org">QGIS-Developer@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-developer">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-developer">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a></pre>
    </blockquote>
  </body>
</html>