SHARE
TWEET

Untitled

a guest Jul 19th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. lyr = QgsRasterLayer(os.getcwd() + '/data/rasters/dof/dof.vrt', 'Ortophoto')
  2. QgsMapLayerRegistry.instance().addMapLayer(lyr, False)
  3. ml = QgsMapCanvasLayer(lyr)
  4. ml.setVisible(False)
  5.  
  6. lyr2 = QgsRasterLayer(os.getcwd() + '/data/rasters/chm/chm.vrt', 'Chm')        
  7. QgsMapLayerRegistry.instance().addMapLayer(lyr2, False)
  8. ml2 = QgsMapCanvasLayer(lyr2)
  9. ml2.setVisible(True)
  10.      
  11. ml.setVisible(True)
  12. ml2.setVisible(False)
  13.      
  14. canvas.setLayerSet([ml2, ml])
  15.      
  16. ml.setVisible(True)
  17.  ml2.setVisible(False)
  18.  
  19.  qgis.utils.iface.mapCanvas().refresh()
  20.      
  21. qgis.utils.iface.legendInterface().setLayerVisible(m1, False)
  22.  qgis.utils.iface.legendInterface().setLayerVisible(m12, True)
  23.      
  24. QgsProject.instance().layerTreeRoot().findLayer(layer.id()).setItemVisibilityChecked(False)
  25.      
  26. node = QgsProject.instance().layerTreeRoot().findLayer(layer.id())
  27. if node:
  28.   node.setItemVisibilityChecked(False)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top