Skip to content

Commit

Permalink
processing add option for additional parameters for gdal rasterize
Browse files Browse the repository at this point in the history
  • Loading branch information
Giovanni Manghi committed Oct 22, 2015
1 parent f7f8d7e commit c0919e0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions python/plugins/processing/algs/gdal/rasterize.py
Expand Up @@ -45,6 +45,7 @@ class rasterize(OgrAlgorithm):
DIMENSIONS = 'DIMENSIONS'
WIDTH = 'WIDTH'
HEIGHT = 'HEIGHT'
EXTRA = 'EXTRA'
RTYPE = 'RTYPE'
OUTPUT = 'OUTPUT'
TYPE = ['Byte', 'Int16', 'UInt16', 'UInt32', 'Int32', 'Float32', 'Float64']
Expand Down Expand Up @@ -99,6 +100,8 @@ def defineCharacteristics(self):
self.tr('Control whether the created file is a BigTIFF or a classic TIFF'), self.BIGTIFFTYPE, 0))
self.addParameter(ParameterBoolean(self.TFW,
self.tr('Force the generation of an associated ESRI world file (.tfw)'), False))
params.append(ParameterString(self.EXTRA,
self.tr('Additional creation parameters'), '', optional=True))

for param in params:
param.isAdvanced = True
Expand All @@ -119,6 +122,7 @@ def getConsoleCommands(self):
bigtiff = self.BIGTIFFTYPE[self.getParameterValue(self.BIGTIFF)]
tfw = unicode(self.getParameterValue(self.TFW))
out = self.getOutputValue(self.OUTPUT)
extra = unicode(self.getParameterValue(self.EXTRA))

arguments = []
arguments.append('-a')
Expand Down Expand Up @@ -156,7 +160,10 @@ def getConsoleCommands(self):
arguments.append("-co TFW=YES")
if len(bigtiff) > 0:
arguments.append("-co BIGTIFF=" + bigtiff)
if len(extra) > 0:
arguments.append(extra)
arguments.append('-l')

arguments.append(self.ogrLayerName(inLayer))
arguments.append(ogrLayer)

Expand Down

0 comments on commit c0919e0

Please sign in to comment.