[Qgis-user] 16 arguments for Batch PyQGIS processing with gdalogr:cliprasterbymasklayer ?

Seán Lynch seanlynch at umail.ucc.ie
Thu Jul 7 07:34:29 PDT 2016


Dear all,

It seems that with the latest release the
*processing.alghelp('gladogr:cliprasterbymasklayer')
*arguments have more than doubled from 7 to 16 arguments and the documents
<https://docs.qgis.org/2.6/en/docs/user_manual/processing_algs/gdalogr/gdal_extraction/cliprasterbymasklayer.html>
have not yet been updated to reflect this substantial increase in
parameters.

The previous version that I was comfortable with was :

ALGORITHM: Clip raster by mask layer

INPUT <ParameterRaster>

MASK <ParameterVector>

NO_DATA <ParameterString>

ALPHA_BAND <ParameterBoolean>

KEEP_RESOLUTION <ParameterBoolean>

EXTRA <ParameterString>

OUTPUT <OutputRaster>(7)

Which has now seemed to have increased to:
ALGORITHM: Clip raster by mask layer
              INPUT <ParameterRaster> (1)
              MASK <ParameterVector> (2)
              NO_DATA <ParameterString> (3)
              ALPHA_BAND <ParameterBoolean> (4)
              CROP_TO_CUTLINE <ParameterBoolean> (5)
              KEEP_RESOLUTION <ParameterBoolean> (6)
              RTYPE <ParameterSelection> (7)
              COMPRESS <ParameterSelection> (8)
              JPEGCOMPRESSION <ParameterNumber> (9)
              ZLEVEL <ParameterNumber> (10)
              PREDICTOR <ParameterNumber> (11)
              TILED <ParameterBoolean> (12)
              BIGTIFF <ParameterSelection> (13)
              TFW <ParameterBoolean> (14)
              EXTRA <ParameterString> (15)
              OUTPUT  <OutputRaster> (16)

Including:

RTYPE(Output raster type)
    0 - Byte
    1 - Int16
    2 - UInt16
    3 - UInt32
    4 - Int32
    5 - Float32
    6 - Float64
COMPRESS(GeoTIFF options. Compression type:)
    0 - NONE
    1 - JPEG
    2 - LZW
    3 - PACKBITS
    4 - DEFLATE
BIGTIFF(Control whether the created file is a BigTIFF or a classic TIFF)
    0 -
    1 - YES
    2 - NO
    3 - IF_NEEDED
    4 - IF_SAFER


If I run (without the [n]):

*>>> processing.runalg('gdalogr:cliprasterbymasklayer', *[1] *rstr, *[2]*
shp, *[3] *"", *[4]* False, *[5] *True, *[6] *True, *[7]* 1, *[8]* 1, *[9]*
1, *[10] *1, *[11] *1, *[12] *True, *[13] *0, *[14] *True, *[15] *"", *[16]

* rstrOutput+str(rstr))*
that's ('gdalogr:cliprasterbymasklayer', *(1)* rstr input, *(2) *shp to
clip, *(3)* no data = "", *(4) *alpha transparency band = false, *(5) *crop
to cutline = true, *(6) *keep resolution = true, *(7) *RTYPE (0 is not
allowed so I went with 1), *(8)* Compress =1 as 0 not allowed, *(9)*
Jpegcompression = 1, *(10)*, Z level = 1, *(11)* Predictor = 1, *(12) *Tiled
= True, *(13)* Bigtiff = 0, *(14) *'TFW' = True, *(15) *extra = "" and
*(16)* I specify my output path....)

I can get an output but I can only create a binary mask.

Could anyone please offer some insights on where I'm going wrong and how I
can take advantage of this powerful function once again please?

I would like to suggest too that 16 options seems like a bit much for
clipping a raster and it makes debugging very difficult. Is there a simpler
version that could be implemented? This is an incredibly useful function.
It would great to see the documents updated too.

Is there anyone out there who can share some information of these very
different options please?

Thank you,
Seán Lynch
-- 
M.Sc. Coastal & Marine Environments (NUIG, 2015)
M.Sc. GIS & Remote Sensing (UCC, 2014)
B.A. Geography & Economics (UCC, 2011)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20160707/e20e6d71/attachment.html>


More information about the Qgis-user mailing list