Azad Rasul


8- Iterating over a layer

Azad Rasul's photo
Azad Rasul
·Jun 25, 2021·

1 min read

Subscribe to my newsletter and never miss my upcoming articles

Listen to this article

Load a raster layer:

uri = "D:/Python_QGIS/data/dem_subset.tif"
rlayer = iface.addRasterLayer(uri, "my_raster", "gdal")

Check if the raster layer is valid or not:

if rlayer.isValid():
    print("Great this is a valid raster layer!")
    print("This is invalid raster layer!")

If you like the content, please SUBSCRIBE to my channel for the future content

Share this