Skip to content

Commit

Permalink
Merge pull request #1643 from gioman/gdal_rasterize_type
Browse files Browse the repository at this point in the history
Add option to allow choose raster type output to gdal_rasterize
  • Loading branch information
volaya committed Oct 20, 2014
2 parents 9bc7eca + 3c24615 commit f3e7a3e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions python/plugins/processing/algs/gdal/rasterize.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ class rasterize(GdalAlgorithm):
DIMENSIONS = 'DIMENSIONS'
WIDTH = 'WIDTH'
HEIGHT = 'HEIGHT'
RTYPE = 'RTYPE'
OUTPUT = 'OUTPUT'

TYPE = ['Byte','Int16','UInt16','UInt32','Int32','Float32','Float64','CInt16','CInt32','CFloat32','CFloat64']

def commandLineName(self):
return "gdalogr:rasterize"
Expand All @@ -60,13 +63,18 @@ def defineCharacteristics(self):
99999999.999999, 100.0))
self.addParameter(ParameterNumber(self.HEIGHT, 'Vertical', 0.0,
99999999.999999, 100.0))
self.addParameter(ParameterSelection(self.RTYPE, 'Raster type',
self.TYPE, 0))

self.addOutput(OutputRaster(self.OUTPUT, 'Output layer'))

def processAlgorithm(self, progress):
arguments = []
arguments.append('-a')
arguments.append(str(self.getParameterValue(self.FIELD)))

arguments.append('-ot')
arguments.append(self.TYPE[self.getParameterValue(self.RTYPE)])

dimType = self.getParameterValue(self.DIMENSIONS)
if dimType == 0:
Expand Down

0 comments on commit f3e7a3e

Please sign in to comment.