[Qgis-user] QGIS processing script: No raster output from gdalogr:translate and gdalogr:cliprasterbyextent
Sophie Crommelinck
sophie.crommelinck at gmail.com
Sun Oct 9 22:27:33 PDT 2016
Hi, when I import a processing script in the QGIS Python console (see parts
of it below), it does not give any error and even displays ("Executing
algorithm xy"). However, the output file is not generated, i.e., there is
no file in the output directory. Does anyone know why? Do I need to save
raster output files differently? I also tried by hardcoding the filepath
(resampled = "C:/result.tif").
# Define name of resampled raster
resampled = str(os.path.splitext(f)[0] + "_" + str(j) + "pixels.tif")
# Run resampling of raster
processing.runalg('gdalogr:translate',{"INPUT":rlayer, "OUTSIZE":j,
"OUTSIZE_PERC":False, "EXPAND":2, "PROJWIN":"%f,%f,%f,%f" % (xmin, xmax,
ymin, ymax), "OUTPUT":resampled})
# Define name of tiled raster
tiled = str(os.path.splitext(f)[0] + "_" + str(j) + "pixels" + "_tiling_x"
+ str(l+1) + "y" + str(k) + ".tif")
# Run tiling of raster
processing.runalg('gdalogr:cliprasterbyextent', {"INPUT":reslayer,
"PROJWIN":"%f,%f,%f,%f" % (t_xmin,t_xmax,t_ymin,t_ymax), "OUTPUT":tiled})
Thank you,
Sophie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20161010/a2098cdd/attachment.html>
More information about the Qgis-user
mailing list