diff --git a/python/plugins/processing/algs/gdal/rasterize.py b/python/plugins/processing/algs/gdal/rasterize.py index 51fe153c6442..651ff4589b98 100644 --- a/python/plugins/processing/algs/gdal/rasterize.py +++ b/python/plugins/processing/algs/gdal/rasterize.py @@ -249,10 +249,12 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True): units = self.parameterAsEnum(parameters, self.UNITS, context) if units == 0: arguments.append("-ts") + arguments.append(self.parameterAsInt(parameters, self.WIDTH, context)) + arguments.append(self.parameterAsInt(parameters, self.HEIGHT, context)) else: arguments.append("-tr") - arguments.append(self.parameterAsDouble(parameters, self.WIDTH, context)) - arguments.append(self.parameterAsDouble(parameters, self.HEIGHT, context)) + arguments.append(self.parameterAsDouble(parameters, self.WIDTH, context)) + arguments.append(self.parameterAsDouble(parameters, self.HEIGHT, context)) if self.INIT in parameters and parameters[self.INIT] is not None: initValue = self.parameterAsDouble(parameters, self.INIT, context) diff --git a/python/plugins/processing/tests/GdalAlgorithmsRasterTest.py b/python/plugins/processing/tests/GdalAlgorithmsRasterTest.py index 240a2c028fa7..de974c5c89e9 100644 --- a/python/plugins/processing/tests/GdalAlgorithmsRasterTest.py +++ b/python/plugins/processing/tests/GdalAlgorithmsRasterTest.py @@ -3332,7 +3332,7 @@ def testRasterize(self): ), [ "gdal_rasterize", - "-l polys2 -a id -ts 0.0 0.0 -ot Float32 -of JPEG " + "-l polys2 -a id -ts 0 0 -ot Float32 -of JPEG " + source + " " + outdir @@ -3353,7 +3353,7 @@ def testRasterize(self): ), [ "gdal_rasterize", - "-l polys2 -a id -ts 0.0 0.0 -a_nodata 9999.0 -ot Float32 -of JPEG " + "-l polys2 -a id -ts 0 0 -a_nodata 9999.0 -ot Float32 -of JPEG " + source + " " + outdir @@ -3374,7 +3374,7 @@ def testRasterize(self): ), [ "gdal_rasterize", - "-l polys2 -a id -ts 0.0 0.0 -init 0.0 -ot Float32 -of JPEG " + "-l polys2 -a id -ts 0 0 -init 0.0 -ot Float32 -of JPEG " + source + " " + outdir @@ -3395,7 +3395,7 @@ def testRasterize(self): ), [ "gdal_rasterize", - "-l polys2 -a id -ts 0.0 0.0 -a_nodata 0.0 -ot Float32 -of JPEG " + "-l polys2 -a id -ts 0 0 -a_nodata 0.0 -ot Float32 -of JPEG " + source + " " + outdir @@ -3416,7 +3416,7 @@ def testRasterize(self): ), [ "gdal_rasterize", - "-l polys2 -a id -ts 0.0 0.0 -ot Float32 -of JPEG -at -add " + "-l polys2 -a id -ts 0 0 -ot Float32 -of JPEG -at -add " + source + " " + outdir @@ -3433,7 +3433,7 @@ def testRasterize(self): ), [ "gdal_rasterize", - "-l pointsz -3d -ts 0.0 0.0 -ot Float32 -of JPEG " + "-l pointsz -3d -ts 0 0 -ot Float32 -of JPEG " + sourceZ + " " + outdir @@ -3455,7 +3455,7 @@ def testRasterize(self): ), [ "gdal_rasterize", - "-l pointsz -3d -ts 0.0 0.0 -ot Float32 -of JPEG " + "-l pointsz -3d -ts 0 0 -ot Float32 -of JPEG " + sourceZ + " " + outdir @@ -3477,7 +3477,7 @@ def testRasterize(self): ), [ "gdal_rasterize", - "-l polys2 -a id -ts 0.0 0.0 -te -1.0 -3.0 10.0 6.0 -ot Float32 -of JPEG " + "-l polys2 -a id -ts 0 0 -te -1.0 -3.0 10.0 6.0 -ot Float32 -of JPEG " + source + " " + outdir @@ -3498,7 +3498,7 @@ def testRasterize(self): ), [ "gdal_rasterize", - "-l polys2 -a id -ts 0.0 0.0 -te -1.000000001857055 -2.9999999963940835 10.000000000604246 5.999999999604708 -ot Float32 -of JPEG " + "-l polys2 -a id -ts 0 0 -te -1.000000001857055 -2.9999999963940835 10.000000000604246 5.999999999604708 -ot Float32 -of JPEG " + source + " " + outdir @@ -3520,7 +3520,7 @@ def testRasterize(self): ), [ "gdal_rasterize", - "-l polys2 -a id -ts 0.0 0.0 -ot Float32 -of JPEG -oo X_POSSIBLE_NAMES=geom_x -oo Y_POSSIBLE_NAMES=geom_y " + "-l polys2 -a id -ts 0 0 -ot Float32 -of JPEG -oo X_POSSIBLE_NAMES=geom_x -oo Y_POSSIBLE_NAMES=geom_y " + source + " " + outdir @@ -3540,7 +3540,7 @@ def testRasterize(self): ), [ "gdal_rasterize", - "-l polys2 -a id -ts 0.0 0.0 -ot Float32 -of JPEG --config X Y --config Z A " + "-l polys2 -a id -ts 0 0 -ot Float32 -of JPEG --config X Y --config Z A " + source + " " + outdir