I'm trying to uncheck a layer on the layer panel using PyQGIS such that it is not visible on the project without removing it (like with removeMapLayer).
Asked
Active
Viewed 1,413 times
3
1 Answers
4
Solution: See Joseph's reply. For QGIS 3 and up, see below:
There's also a similar question that I didn't find because I looked for different keywords, my bad.
QgsProject.instance().layerTreeRoot().findLayer(lyr.id()).setItemVisibilityChecked(False)
wyvernaizor
- 93
- 7
layer = iface.activeLayer();iface.legendInterface().setLayerVisible(layer, False)– Joseph Apr 10 '18 at 10:37