Azad Rasul
SmartRS

SmartRS

8- Iterating over a layer

Azad Rasul's photo
Azad Rasul

Published on Jun 25, 2021

1 min read

Subscribe to my newsletter and never miss my upcoming articles

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!")
else: 
    print("This is invalid raster layer!")
 
Share this
Proudly part of