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)


_______________________________________________
QGIS-Developer mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to