Skip to content
Permalink
Browse files

Reset outputpixeltype parameter options

  • Loading branch information
rkanavath authored and nyalldawson committed Jan 21, 2019
1 parent 8afb80e commit 9a6a70a0c0527635ee8bbc539c38dad0ff8a0dd7
Showing with 8 additions and 2 deletions.
  1. +8 −2 python/plugins/processing/algs/otb/OtbAlgorithm.py
@@ -68,7 +68,8 @@ def __init__(self, group, name, descriptionfile, display_name='', groupId=''):
if not groupId:
self._groupId = ''.join(c for c in self._group if c in validChars)

self.pixelTypes = ['uint8', 'int', 'float', 'double']
self.pixelTypes = ['uint8', 'uint16', 'int16', 'uint32', 'int32',
'float', 'double', 'cint16', 'cint32', 'cfloat', 'cdouble']
self._descriptionfile = descriptionfile
self.defineCharacteristicsFromFile()

@@ -160,6 +161,11 @@ def defineCharacteristicsFromFile(self):
if name in ["elev.dem.geoid", "elev.geoid"]:
param.setDefaultValue(OtbUtils.geoidFile())

# outputpixeltype is a special parameter associated with raster output
# reset list of options to 'self.pixelTypes'.
if name == 'outputpixeltype':
param.setOptions(self.pixelTypes)

self.addParameter(param)
#parameter is added now and we must move to next line
line = lines.readline().strip('\n').strip()
@@ -248,7 +254,7 @@ def processAlgorithm(self, parameters, context, feedback):
filePath = self.parameterAsOutputLayer(parameters, out.name(), context)
output_files[out.name()] = filePath
if outputPixelType is not None:
command += ' -{} "{}" {}'.format(out.name(), filePath, outputPixelType)
command += ' -{} "{}" "{}"'.format(out.name(), filePath, outputPixelType)
else:
command += ' -{} "{}"'.format(out.name(), filePath)

0 comments on commit 9a6a70a

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