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

Seán Lynch seanlynch at umail.ucc.ie
Thu Jul 7 09:57:30 PDT 2016


Hi again just to add some more information to the
'gdalogr:cliprasterbymasklayer' puzzle:

The ones I'm not sure about are marked in bold

ALGORITHM: Clip raster by mask layer
              INPUT <ParameterRaster> (1) .. input raster
              MASK <ParameterVector> (2) .. input shp to clip
              NO_DATA <ParameterString> (3) .. returning 'no_data' worked
last time but *I think this might be the issue here.*

              ALPHA_BAND <ParameterBoolean> (4)  - False: If this is a
transparency band I don't think need it
              CROP_TO_CUTLINE <ParameterBoolean> (5).. True means only the
ROI mask remains and gives a much smaller file size
              KEEP_RESOLUTION <ParameterBoolean> (6) .. True
              RTYPE <ParameterSelection> (7) .. 0 = byte
              COMPRESS <ParameterSelection> (8) .. 0 .. don't compress
              *JPEGCOMPRESSION* <ParameterNumber> (9) - *0 not working,
selected 1*
              *ZLEVEL* <ParameterNumber> (10) - *0 not working, selected 1*
              *PREDICTOR* <ParameterNumber> (11) - *0 not working, selected
1*
              TILED <ParameterBoolean> (12).. False, I don't want it tiled.
Do I? If true, 68kb. If false, 17kb.
              BIGTIFF <ParameterSelection> (13).. 2 = no
              *TFW* <ParameterBoolean> (14) If true it creates a new
file.twf. I'm not sure what this does
              EXTRA <ParameterString> (15) .. '' worked last time
              OUTPUT  <OutputRaster> (16) .. working.

https://docs.qgis.org/2.6/en/docs/user_manual/processing_algs/gdalogr/gdal_extraction/cliprasterbymasklayer.html

Thanks,
Seán



On 7 July 2016 at 15:34, Seán Lynch <seanlynch at umail.ucc.ie> wrote:

> 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)
>



-- 
M.Sc. Coastal & Marine Environments (NUIG, 2015)
M.Sc. GIS & Remote Sensing (UCC, 2014)
B.A. Geography & Economics (UCC, 2011)
ie.linkedin.com/in/seanlynchgis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20160707/7dce96e7/attachment.html>


More information about the Qgis-user mailing list