Skip to content

Commit

Permalink
Merge pull request #1880 from gioman/processing_fix_gdal_a_nodata
Browse files Browse the repository at this point in the history
fix a_nodata parameter in gdal processing
  • Loading branch information
alexbruy committed Feb 4, 2015
2 parents 7e66e33 + 98fb59b commit 91c4e7a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
9 changes: 5 additions & 4 deletions python/plugins/processing/algs/gdal/ClipByExtent.py
Expand Up @@ -49,8 +49,8 @@ def defineCharacteristics(self):
self.addParameter(ParameterRaster(
self.INPUT, self.tr('Input layer'), False))
self.addParameter(ParameterString(self.NO_DATA,
self.tr("Nodata value, leave as 'none' to take the nodata value from input"),
'none'))
self.tr("Nodata value, leave blank to take the nodata value from input"),
''))
self.addParameter(ParameterExtent(self.PROJWIN, self.tr('Clipping extent')))
self.addParameter(ParameterString(self.EXTRA,
self.tr('Additional creation parameters'), '', optional=True))
Expand All @@ -65,8 +65,9 @@ def processAlgorithm(self, progress):
arguments = []
arguments.append('-of')
arguments.append(GdalUtils.getFormatShortNameFromFilename(out))
arguments.append('-a_nodata')
arguments.append(noData)
if len(noData) > 0:
arguments.append('-a_nodata')
arguments.append(noData)

regionCoords = projwin.split(',')
arguments.append('-projwin')
Expand Down
9 changes: 5 additions & 4 deletions python/plugins/processing/algs/gdal/translate.py
Expand Up @@ -68,8 +68,8 @@ def defineCharacteristics(self):
self.addParameter(ParameterBoolean(self.OUTSIZE_PERC,
self.tr('Output size is a percentage of input size'), True))
self.addParameter(ParameterString(self.NO_DATA,
self.tr("Nodata value, leave as 'none' to take the nodata value from input"),
'none'))
self.tr("Nodata value, leave blank to take the nodata value from input"),
''))
self.addParameter(ParameterSelection(self.EXPAND,
self.tr('Expand'), ['none', 'gray', 'rgb', 'rgba']))
self.addParameter(ParameterCrs(self.SRS,
Expand Down Expand Up @@ -111,8 +111,9 @@ def processAlgorithm(self, progress):
arguments.append('-outsize')
arguments.append(outsize)
arguments.append(outsize)
arguments.append('-a_nodata')
arguments.append(noData)
if len(noData) > 0:
arguments.append('-a_nodata')
arguments.append(noData)
if expand != 'none':
arguments.append('-expand')
arguments.append(expand)
Expand Down

0 comments on commit 91c4e7a

Please sign in to comment.