How do you loop through raster layers in a folder with PyQGIS?

المشرف العام

Administrator
طاقم الإدارة
I'm looking to apply a mask to a number of rasters in PyQGIS.

import processing rstr = "/Users/rasterfilepath/" shp = "/Users/shapefile.shp" outputDir = "/Users/output/" for lyr in rstr: processing.runandload("gdalogr:cliprasterbymasklayer", rstr, shp, "none", False, False, outputDir + ".tif") lyr +=1 What am I doing wrong?



أكثر...
 
أعلى