Skip to content
Permalink
Browse files

[processing][gdal] More nodata handling fixes

Fixes #18748
  • Loading branch information
nyalldawson committed May 5, 2018
1 parent 739d4fa commit bddcb7dc42285c97a360cce3b505efca2339f1eb
@@ -189,8 +189,8 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
arguments.append('-s')
arguments.append(crs.authid())

nodata = self.parameterAsDouble(parameters, self.NODATA, context)
if nodata:
if self.NODATA in parameters and parameters[self.NODATA] is not None:
nodata = self.parameterAsDouble(parameters, self.NODATA, context)
arguments.append('-a')
arguments.append(str(nodata))

@@ -138,7 +138,10 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
inLayer = self.parameterAsRasterLayer(parameters, self.INPUT, context)
distance = self.parameterAsDouble(parameters, self.MAX_DISTANCE, context)
replaceValue = self.parameterAsDouble(parameters, self.REPLACE, context)
nodata = self.parameterAsDouble(parameters, self.NODATA, context)
if self.NODATA in parameters and parameters[self.NODATA] is not None:
nodata = self.parameterAsDouble(parameters, self.NODATA, context)
else:
nodata = None
options = self.parameterAsString(parameters, self.OPTIONS, context)
out = self.parameterAsOutputLayer(parameters, self.OUTPUT, context)

@@ -158,7 +161,7 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
arguments.append('-maxdist')
arguments.append(str(distance))

if nodata:
if nodata is not None:
arguments.append('-nodata')
arguments.append(str(nodata))

@@ -192,8 +192,8 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
if self.parameterAsBool(parameters, self.ALL_TOUCH, context):
arguments.append('-at')

nodata = self.parameterAsDouble(parameters, self.NODATA, context)
if nodata:
if self.NODATA in parameters and parameters[self.NODATA] is not None:
nodata = self.parameterAsDouble(parameters, self.NODATA, context)
arguments.append('-a_nodata')
arguments.append(nodata)

@@ -166,7 +166,10 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
out = self.parameterAsOutputLayer(parameters, self.OUTPUT, context)
sourceCrs = self.parameterAsCrs(parameters, self.SOURCE_CRS, context)
targetCrs = self.parameterAsCrs(parameters, self.TARGET_CRS, context)
nodata = self.parameterAsDouble(parameters, self.NODATA, context)
if self.NODATA in parameters and parameters[self.NODATA] is not None:
nodata = self.parameterAsDouble(parameters, self.NODATA, context)
else:
nodata = None
resolution = self.parameterAsDouble(parameters, self.TARGET_RESOLUTION, context)

arguments = []
@@ -178,7 +181,7 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
arguments.append('-t_srs')
arguments.append(targetCrs.authid())

if nodata:
if nodata is not None:
arguments.append('-dstnodata')
arguments.append(str(nodata))

0 comments on commit bddcb7d

Please sign in to comment.
You can’t perform that action at this time.