|
55 | 55 | from processing.algs.otb.OtbChoiceWidget import OtbParameterChoice |
56 | 56 | from processing.algs.otb.OtbUtils import OtbUtils |
57 | 57 |
|
| 58 | + |
58 | 59 | class OtbAlgorithm(QgsProcessingAlgorithm): |
59 | 60 |
|
60 | 61 | def __init__(self, group, name, descriptionfile, display_name='', groupId=''): |
@@ -204,7 +205,7 @@ def processAlgorithm(self, parameters, context, feedback): |
204 | 205 | outputPixelType = None |
205 | 206 | for k, v in parameters.items(): |
206 | 207 | # if value is None for a parameter we don't have any businees with this key |
207 | | - if v is None: |
| 208 | + if not v or v is None: |
208 | 209 | continue |
209 | 210 | # for 'outputpixeltype' parameter we find the pixeltype string from self.pixelTypes |
210 | 211 | if k == 'outputpixeltype': |
@@ -257,11 +258,12 @@ def processAlgorithm(self, parameters, context, feedback): |
257 | 258 |
|
258 | 259 | for out in self.destinationParameterDefinitions(): |
259 | 260 | filePath = self.parameterAsOutputLayer(parameters, out.name(), context) |
260 | | - output_files[out.name()] = filePath |
261 | | - if outputPixelType is not None: |
262 | | - command += ' -{} "{}" "{}"'.format(out.name(), filePath, outputPixelType) |
263 | | - else: |
264 | | - command += ' -{} "{}"'.format(out.name(), filePath) |
| 261 | + if filePath: |
| 262 | + output_files[out.name()] = filePath |
| 263 | + if outputPixelType is not None: |
| 264 | + command += ' -{} "{}" "{}"'.format(out.name(), filePath, outputPixelType) |
| 265 | + else: |
| 266 | + command += ' -{} "{}"'.format(out.name(), filePath) |
265 | 267 |
|
266 | 268 | OtbUtils.executeOtb(command, feedback) |
267 | 269 |
|
|
0 commit comments