Skip to content

Commit 3c24615

Browse files
author
Giovanni Manghi
committed
Add option to allow choose raster type output to gdal_rasterize
1 parent d2f89c5 commit 3c24615

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

python/plugins/processing/algs/gdal/rasterize.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ class rasterize(GdalAlgorithm):
4242
DIMENSIONS = 'DIMENSIONS'
4343
WIDTH = 'WIDTH'
4444
HEIGHT = 'HEIGHT'
45+
RTYPE = 'RTYPE'
4546
OUTPUT = 'OUTPUT'
47+
48+
TYPE = ['Byte','Int16','UInt16','UInt32','Int32','Float32','Float64','CInt16','CInt32','CFloat32','CFloat64']
4649

4750
def commandLineName(self):
4851
return "gdalogr:rasterize"
@@ -60,13 +63,18 @@ def defineCharacteristics(self):
6063
99999999.999999, 100.0))
6164
self.addParameter(ParameterNumber(self.HEIGHT, 'Vertical', 0.0,
6265
99999999.999999, 100.0))
66+
self.addParameter(ParameterSelection(self.RTYPE, 'Raster type',
67+
self.TYPE, 0))
6368

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

6671
def processAlgorithm(self, progress):
6772
arguments = []
6873
arguments.append('-a')
6974
arguments.append(str(self.getParameterValue(self.FIELD)))
75+
76+
arguments.append('-ot')
77+
arguments.append(self.TYPE[self.getParameterValue(self.RTYPE)])
7078

7179
dimType = self.getParameterValue(self.DIMENSIONS)
7280
if dimType == 0:

0 commit comments

Comments
 (0)