diff --git a/python/plugins/processing/algs/gdal/ClipRasterByExtent.py b/python/plugins/processing/algs/gdal/ClipRasterByExtent.py index b8be2da999a..7eaac1629a5 100644 --- a/python/plugins/processing/algs/gdal/ClipRasterByExtent.py +++ b/python/plugins/processing/algs/gdal/ClipRasterByExtent.py @@ -132,8 +132,7 @@ class ClipRasterByExtent(GdalAlgorithm): arguments.append(QgsRasterFileWriter.driverForExtension(os.path.splitext(out)[1])) if options: - arguments.append('-co') - arguments.append(options) + arguments.extend(GdalUtils.parseCreationOptions(options)) arguments.append(inLayer.source()) arguments.append(out) diff --git a/python/plugins/processing/algs/gdal/ClipRasterByMask.py b/python/plugins/processing/algs/gdal/ClipRasterByMask.py index 723f1d53271..d599766c442 100644 --- a/python/plugins/processing/algs/gdal/ClipRasterByMask.py +++ b/python/plugins/processing/algs/gdal/ClipRasterByMask.py @@ -154,8 +154,7 @@ class ClipRasterByMask(GdalAlgorithm): arguments.append('-dstnodata {}'.format(nodata)) if options: - arguments.append('-co') - arguments.append(options) + arguments.extend(GdalUtils.parseCreationOptions(options)) arguments.append(inLayer.source()) arguments.append(out) diff --git a/python/plugins/processing/algs/gdal/GdalUtils.py b/python/plugins/processing/algs/gdal/GdalUtils.py index efd52dad768..8a3c925639b 100644 --- a/python/plugins/processing/algs/gdal/GdalUtils.py +++ b/python/plugins/processing/algs/gdal/GdalUtils.py @@ -389,3 +389,11 @@ class GdalUtils: name = ly.GetName() ds = None return name + + @staticmethod + def parseCreationOptions(value): + parts = value.split('|') + options = [] + for p in parts: + options.extend(['-co', p]) + return options diff --git a/python/plugins/processing/algs/gdal/GridAverage.py b/python/plugins/processing/algs/gdal/GridAverage.py index 32f9331e659..027d1209500 100644 --- a/python/plugins/processing/algs/gdal/GridAverage.py +++ b/python/plugins/processing/algs/gdal/GridAverage.py @@ -167,8 +167,7 @@ class GridAverage(GdalAlgorithm): options = self.parameterAsString(parameters, self.OPTIONS, context) if options: - arguments.append('-co') - arguments.append(options) + arguments.extend(GdalUtils.parseCreationOptions(options)) arguments.append(ogrLayer) arguments.append(out) diff --git a/python/plugins/processing/algs/gdal/GridDataMetrics.py b/python/plugins/processing/algs/gdal/GridDataMetrics.py index f881fa2543d..0a227dbc5ba 100644 --- a/python/plugins/processing/algs/gdal/GridDataMetrics.py +++ b/python/plugins/processing/algs/gdal/GridDataMetrics.py @@ -181,8 +181,7 @@ class GridDataMetrics(GdalAlgorithm): options = self.parameterAsString(parameters, self.OPTIONS, context) if options: - arguments.append('-co') - arguments.append(options) + arguments.extend(GdalUtils.parseCreationOptions(options)) arguments.append(ogrLayer) arguments.append(out) diff --git a/python/plugins/processing/algs/gdal/GridInverseDistance.py b/python/plugins/processing/algs/gdal/GridInverseDistance.py index 2f9634584ee..369169da1dc 100644 --- a/python/plugins/processing/algs/gdal/GridInverseDistance.py +++ b/python/plugins/processing/algs/gdal/GridInverseDistance.py @@ -190,8 +190,7 @@ class GridInverseDistance(GdalAlgorithm): options = self.parameterAsString(parameters, self.OPTIONS, context) if options: - arguments.append('-co') - arguments.append(options) + arguments.extend(GdalUtils.parseCreationOptions(options)) arguments.append(ogrLayer) arguments.append(out) diff --git a/python/plugins/processing/algs/gdal/GridInverseDistanceNearestNeighbor.py b/python/plugins/processing/algs/gdal/GridInverseDistanceNearestNeighbor.py index a1c860246c8..2bce974ce79 100644 --- a/python/plugins/processing/algs/gdal/GridInverseDistanceNearestNeighbor.py +++ b/python/plugins/processing/algs/gdal/GridInverseDistanceNearestNeighbor.py @@ -175,8 +175,7 @@ class GridInverseDistanceNearestNeighbor(GdalAlgorithm): options = self.parameterAsString(parameters, self.OPTIONS, context) if options: - arguments.append('-co') - arguments.append(options) + arguments.extend(GdalUtils.parseCreationOptions(options)) arguments.append(ogrLayer) arguments.append(out) diff --git a/python/plugins/processing/algs/gdal/GridLinear.py b/python/plugins/processing/algs/gdal/GridLinear.py index b32f9e8493f..36d9c453444 100644 --- a/python/plugins/processing/algs/gdal/GridLinear.py +++ b/python/plugins/processing/algs/gdal/GridLinear.py @@ -146,8 +146,7 @@ class GridLinear(GdalAlgorithm): options = self.parameterAsString(parameters, self.OPTIONS, context) if options: - arguments.append('-co') - arguments.append(options) + arguments.extend(GdalUtils.parseCreationOptions(options)) arguments.append(ogrLayer) arguments.append(out) diff --git a/python/plugins/processing/algs/gdal/GridNearestNeighbor.py b/python/plugins/processing/algs/gdal/GridNearestNeighbor.py index 41b27109f81..85da26920dd 100644 --- a/python/plugins/processing/algs/gdal/GridNearestNeighbor.py +++ b/python/plugins/processing/algs/gdal/GridNearestNeighbor.py @@ -161,8 +161,7 @@ class GridNearestNeighbor(GdalAlgorithm): options = self.parameterAsString(parameters, self.OPTIONS, context) if options: - arguments.append('-co') - arguments.append(options) + arguments.extend(GdalUtils.parseCreationOptions(options)) arguments.append(ogrLayer) arguments.append(out) diff --git a/python/plugins/processing/algs/gdal/aspect.py b/python/plugins/processing/algs/gdal/aspect.py index 9913b4c02b8..4fcf30fbe1a 100644 --- a/python/plugins/processing/algs/gdal/aspect.py +++ b/python/plugins/processing/algs/gdal/aspect.py @@ -125,7 +125,6 @@ class aspect(GdalAlgorithm): options = self.parameterAsString(parameters, self.OPTIONS, context) if options: - arguments.append('-co') - arguments.append(options) + arguments.extend(GdalUtils.parseCreationOptions(options)) return ['gdaldem', GdalUtils.escapeAndJoin(arguments)] diff --git a/python/plugins/processing/algs/gdal/hillshade.py b/python/plugins/processing/algs/gdal/hillshade.py index 3737dd23ce2..786d3044038 100644 --- a/python/plugins/processing/algs/gdal/hillshade.py +++ b/python/plugins/processing/algs/gdal/hillshade.py @@ -160,7 +160,6 @@ class hillshade(GdalAlgorithm): options = self.parameterAsString(parameters, self.OPTIONS, context) if options: - arguments.append('-co') - arguments.append(options) + arguments.extend(GdalUtils.parseCreationOptions(options)) return ['gdaldem', GdalUtils.escapeAndJoin(arguments)] diff --git a/python/plugins/processing/algs/gdal/merge.py b/python/plugins/processing/algs/gdal/merge.py index 5f9fe423d58..970b74f32fb 100644 --- a/python/plugins/processing/algs/gdal/merge.py +++ b/python/plugins/processing/algs/gdal/merge.py @@ -123,8 +123,7 @@ class merge(GdalAlgorithm): options = self.parameterAsString(parameters, self.OPTIONS, context) if options: - arguments.append('-co') - arguments.append(options) + arguments.extend(GdalUtils.parseCreationOptions(options)) arguments.append('-o') arguments.append(out) diff --git a/python/plugins/processing/algs/gdal/nearblack.py b/python/plugins/processing/algs/gdal/nearblack.py index 712ea6370d3..db48935876d 100644 --- a/python/plugins/processing/algs/gdal/nearblack.py +++ b/python/plugins/processing/algs/gdal/nearblack.py @@ -112,7 +112,6 @@ class nearblack(GdalAlgorithm): options = self.parameterAsString(parameters, self.OPTIONS, context) if options: - arguments.append('-co') - arguments.append(options) + arguments.extend(GdalUtils.parseCreationOptions(options)) return ['nearblack', GdalUtils.escapeAndJoin(arguments)] diff --git a/python/plugins/processing/algs/gdal/proximity.py b/python/plugins/processing/algs/gdal/proximity.py index eae4a7f36b0..3c606a2896f 100644 --- a/python/plugins/processing/algs/gdal/proximity.py +++ b/python/plugins/processing/algs/gdal/proximity.py @@ -170,8 +170,7 @@ class proximity(GdalAlgorithm): arguments.append(QgsRasterFileWriter.driverForExtension(os.path.splitext(out)[1])) if options: - arguments.append('-co') - arguments.append(options) + arguments.extend(GdalUtils.parseCreationOptions(options)) arguments.append(inLayer.source()) arguments.append(out) diff --git a/python/plugins/processing/algs/gdal/rasterize.py b/python/plugins/processing/algs/gdal/rasterize.py index c3d14966afa..1df9eb632af 100644 --- a/python/plugins/processing/algs/gdal/rasterize.py +++ b/python/plugins/processing/algs/gdal/rasterize.py @@ -214,8 +214,7 @@ class rasterize(GdalAlgorithm): options = self.parameterAsString(parameters, self.OPTIONS, context) if options: - arguments.append('-co') - arguments.append(options) + arguments.extend(GdalUtils.parseCreationOptions(options)) arguments.append(ogrLayer) arguments.append(out) diff --git a/python/plugins/processing/algs/gdal/retile.py b/python/plugins/processing/algs/gdal/retile.py index 97152b38c33..890170dd855 100644 --- a/python/plugins/processing/algs/gdal/retile.py +++ b/python/plugins/processing/algs/gdal/retile.py @@ -187,8 +187,7 @@ class retile(GdalAlgorithm): options = self.parameterAsString(parameters, self.OPTIONS, context) if options: - arguments.append('-co') - arguments.append(options) + arguments.extend(GdalUtils.parseCreationOptions(options)) if self.parameterAsBool(parameters, self.DIR_FOR_ROW, context): arguments.append('-pyramidOnly') diff --git a/python/plugins/processing/algs/gdal/slope.py b/python/plugins/processing/algs/gdal/slope.py index 2954f6dc11d..2c1dbd18079 100644 --- a/python/plugins/processing/algs/gdal/slope.py +++ b/python/plugins/processing/algs/gdal/slope.py @@ -129,7 +129,6 @@ class slope(GdalAlgorithm): options = self.parameterAsString(parameters, self.OPTIONS, context) if options: - arguments.append('-co') - arguments.append(options) + arguments.extend(GdalUtils.parseCreationOptions(options)) return ['gdaldem', GdalUtils.escapeAndJoin(arguments)] diff --git a/python/plugins/processing/algs/gdal/tpi.py b/python/plugins/processing/algs/gdal/tpi.py index 04de40a786e..82229ed4f60 100644 --- a/python/plugins/processing/algs/gdal/tpi.py +++ b/python/plugins/processing/algs/gdal/tpi.py @@ -99,7 +99,6 @@ class tpi(GdalAlgorithm): options = self.parameterAsString(parameters, self.OPTIONS, context) if options: - arguments.append('-co') - arguments.append(options) + arguments.extend(GdalUtils.parseCreationOptions(options)) return ['gdaldem', GdalUtils.escapeAndJoin(arguments)] diff --git a/python/plugins/processing/algs/gdal/translate.py b/python/plugins/processing/algs/gdal/translate.py index 82d62c4b154..f194226614d 100644 --- a/python/plugins/processing/algs/gdal/translate.py +++ b/python/plugins/processing/algs/gdal/translate.py @@ -137,8 +137,7 @@ class translate(GdalAlgorithm): options = self.parameterAsString(parameters, self.OPTIONS, context) if options: - arguments.append('-co') - arguments.append(options) + arguments.extend(GdalUtils.parseCreationOptions(options)) arguments.append(inLayer.source()) arguments.append(out) diff --git a/python/plugins/processing/algs/gdal/tri.py b/python/plugins/processing/algs/gdal/tri.py index cbe536f5484..a4fe2c0e6b6 100644 --- a/python/plugins/processing/algs/gdal/tri.py +++ b/python/plugins/processing/algs/gdal/tri.py @@ -98,7 +98,6 @@ class tri(GdalAlgorithm): options = self.parameterAsString(parameters, self.OPTIONS, context) if options: - arguments.append('-co') - arguments.append(options) + arguments.extend(GdalUtils.parseCreationOptions(options)) return ['gdaldem', GdalUtils.escapeAndJoin(arguments)] diff --git a/python/plugins/processing/algs/gdal/ui/RasterOptionsWidget.py b/python/plugins/processing/algs/gdal/ui/RasterOptionsWidget.py index ff240b81198..87ce4bc23a8 100644 --- a/python/plugins/processing/algs/gdal/ui/RasterOptionsWidget.py +++ b/python/plugins/processing/algs/gdal/ui/RasterOptionsWidget.py @@ -70,4 +70,4 @@ class RasterOptionsWidgetWrapper(WidgetWrapper): elif self.dialogType == DIALOG_BATCH: return self.widget.text() else: - return ' '.join(self.widget.options()) + return '|'.join(self.widget.options()) diff --git a/python/plugins/processing/algs/gdal/warp.py b/python/plugins/processing/algs/gdal/warp.py index bb9a797e724..3eced95436f 100644 --- a/python/plugins/processing/algs/gdal/warp.py +++ b/python/plugins/processing/algs/gdal/warp.py @@ -212,8 +212,7 @@ class warp(GdalAlgorithm): options = self.parameterAsString(parameters, self.OPTIONS, context) if options: - arguments.append('-co') - arguments.append(options) + arguments.extend(GdalUtils.parseCreationOptions(options)) arguments.append(inLayer.source()) arguments.append(out)