Skip to content

Commit

Permalink
Merge pull request #2389 from NaturalGIS/gdal_advanced
Browse files Browse the repository at this point in the history
Processing gdal translate and warp advanced parameters as such
  • Loading branch information
volaya committed Oct 24, 2015
2 parents fd26acd + 03333c8 commit 1dd8e79
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 18 deletions.
26 changes: 17 additions & 9 deletions python/plugins/processing/algs/gdal/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,27 +87,34 @@ def defineCharacteristics(self):
self.addParameter(ParameterBoolean(self.SDS,
self.tr('Copy all subdatasets of this file to individual output files'),
False))
self.addParameter(ParameterSelection(self.RTYPE,

params = []
params.append(ParameterSelection(self.RTYPE,
self.tr('Output raster type'), self.TYPE, 5))
self.addParameter(ParameterSelection(self.COMPRESS,
params.append(ParameterSelection(self.COMPRESS,
self.tr('GeoTIFF options. Compression type:'), self.COMPRESSTYPE, 4))
self.addParameter(ParameterNumber(self.JPEGCOMPRESSION,
params.append(ParameterNumber(self.JPEGCOMPRESSION,
self.tr('Set the JPEG compression level'),
1, 100, 75))
self.addParameter(ParameterNumber(self.ZLEVEL,
params.append(ParameterNumber(self.ZLEVEL,
self.tr('Set the DEFLATE compression level'),
1, 9, 6))
self.addParameter(ParameterNumber(self.PREDICTOR,
params.append(ParameterNumber(self.PREDICTOR,
self.tr('Set the predictor for LZW or DEFLATE compression'),
1, 3, 1))
self.addParameter(ParameterBoolean(self.TILED,
params.append(ParameterBoolean(self.TILED,
self.tr('Create tiled output (only used for the GTiff format)'), False))
self.addParameter(ParameterSelection(self.BIGTIFF,
params.append(ParameterSelection(self.BIGTIFF,
self.tr('Control whether the created file is a BigTIFF or a classic TIFF'), self.BIGTIFFTYPE, 0))
self.addParameter(ParameterBoolean(self.TFW,
params.append(ParameterBoolean(self.TFW,
self.tr('Force the generation of an associated ESRI world file (.tfw))'), False))
self.addParameter(ParameterString(self.EXTRA,
params.append(ParameterString(self.EXTRA,
self.tr('Additional creation parameters'), '', optional=True))

for param in params:
param.isAdvanced = True
self.addParameter(param)

self.addOutput(OutputRaster(self.OUTPUT, self.tr('Converted')))

def getConsoleCommands(self):
Expand Down Expand Up @@ -175,6 +182,7 @@ def getConsoleCommands(self):
arguments.append("-co TFW=YES")
if len(bigtiff) > 0:
arguments.append("-co BIGTIFF=" + bigtiff)

arguments.append(self.getParameterValue(self.INPUT))
arguments.append(out)

Expand Down
26 changes: 17 additions & 9 deletions python/plugins/processing/algs/gdal/warp.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,27 +75,34 @@ def defineCharacteristics(self):
0.0, None, 0.0))
self.addParameter(ParameterSelection(self.METHOD,
self.tr('Resampling method'), self.METHOD_OPTIONS))
self.addParameter(ParameterSelection(self.RTYPE,

params = []
params.append(ParameterSelection(self.RTYPE,
self.tr('Output raster type'), self.TYPE, 5))
self.addParameter(ParameterSelection(self.COMPRESS,
params.append(ParameterSelection(self.COMPRESS,
self.tr('GeoTIFF options. Compression type:'), self.COMPRESSTYPE, 4))
self.addParameter(ParameterNumber(self.JPEGCOMPRESSION,
params.append(ParameterNumber(self.JPEGCOMPRESSION,
self.tr('Set the JPEG compression level'),
1, 100, 75))
self.addParameter(ParameterNumber(self.ZLEVEL,
params.append(ParameterNumber(self.ZLEVEL,
self.tr('Set the DEFLATE compression level'),
1, 9, 6))
self.addParameter(ParameterNumber(self.PREDICTOR,
params.append(ParameterNumber(self.PREDICTOR,
self.tr('Set the predictor for LZW or DEFLATE compression'),
1, 3, 1))
self.addParameter(ParameterBoolean(self.TILED,
params.append(ParameterBoolean(self.TILED,
self.tr('Create tiled output (only used for the GTiff format)'), False))
self.addParameter(ParameterSelection(self.BIGTIFF,
params.append(ParameterSelection(self.BIGTIFF,
self.tr('Control whether the created file is a BigTIFF or a classic TIFF'), self.BIGTIFFTYPE, 0))
self.addParameter(ParameterBoolean(self.TFW,
params.append(ParameterBoolean(self.TFW,
self.tr('Force the generation of an associated ESRI world file (.tfw))'), False))
self.addParameter(ParameterString(self.EXTRA,
params.append(ParameterString(self.EXTRA,
self.tr('Additional creation parameters'), '', optional=True))

for param in params:
param.isAdvanced = True
self.addParameter(param)

self.addOutput(OutputRaster(self.OUTPUT, self.tr('Reprojected')))

def getConsoleCommands(self):
Expand Down Expand Up @@ -149,6 +156,7 @@ def getConsoleCommands(self):
arguments.append("-co TFW=YES")
if len(bigtiff) > 0:
arguments.append("-co BIGTIFF=" + bigtiff)

arguments.append(self.getParameterValue(self.INPUT))
arguments.append(out)

Expand Down

0 comments on commit 1dd8e79

Please sign in to comment.