Using Python for QGIS 2.14 Essen i try to clip a raster by a Polygon, as indicated here: http://docs.qgis.org/2.6/de/docs/user_manual/processing_algs/gdalogr/gdal_extraction/cliprasterbymasklayer.html
with this code:
processing.runalg('gdalogr:cliprasterbymasklayer', input, mask, no_data, alpha_band, keep_resolution, extra, output)
My code read as following:
processing.runalg('gdalogr:cliprasterbymasklayer', inputlayer, maskshape, "none", False, False, "", outputraster)
Exactly as derived from tutorials. However, this is the error message returned and I can't figure why: Error: Wrong number of parameters
I´ve adapted the code to the 16 parameters of the new version, although I´m not sure if correct
processing.runalg('gdalogr:cliprasterbymasklayer', inputlayer, maskshape, "", False, False, False, 0, 0, 0, 0, False, 0, False, "", "outputraster")
The error message says still the same.
Answer
I think the following parameters requires a minimum value of 1:
- JPEGCOMPRESSION
- ZLEVEL
- PREDICTOR
The others can be set to 0 so you could try running the following which works for me:
processing.runalg('gdalogr:cliprasterbymasklayer', inputlayer, maskshape, "", False, False, False, 0, 0, 1, 1, 1, False, 0, False, "", "outputraster")
No comments:
Post a Comment