[QGIS-Developer] release file after processing.runalg (alternative workaround)
enrico chiaradia
enrico.chiaradia at yahoo.it
Sat May 6 05:20:13 PDT 2017
Finally, I realized that it is a bug already submitted to the bugtracker
https://issues.qgis.org/issues/12502.
In my experience, it is strongly correlated to some function in the
processing plugin under both win7 and win10 and qgis 2.14 and 2.18 (not
under linux).
At the moment, I cannot say exactly where the problem is but I found
that calling the runGdal function directly is a simple workaround.
Here a simple script as example, waiting for a final resolution of the
issue:
from processing.algs.gdal.GdalUtils import GdalUtils
import os
class MYProgress():
# Not necessary if you have the processing progress available in
your script
def setInfo(self,line):
print line
def setCommand(self,line):
print line
def setConsoleInfo(self,line):
print line
tempOutput = 'D:/test_alg/map_to_clip.tif'
maskFN = 'D:/test_alg/mask.shp'
output = 'D:/test_alg/clipped_map.tif'
cmds = ["gdalwarp",
"-dstnodata",
"-9999",
"-crop_to_cutline",
"-cutline",
maskFN,
tempOutput,
output]
progress = MYProgress()
GdalUtils.runGdal(cmds,progress)
# Delete the file
os.remove(tempOutput)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20170506/71fae36e/attachment.html>
More information about the QGIS-Developer
mailing list