Update CreateConstantRaster.py

Cast cols (and rows) to int to fix the error.
Fixes: #32827
This commit is contained in:
Håvard Tveite 2019-11-13 11:47:28 +01:00 committed by Nyall Dawson
parent f67369cc26
commit 59292b47c7

View File

@ -84,8 +84,8 @@ class CreateConstantRaster(QgisAlgorithm):
outputFile = self.parameterAsOutputLayer(parameters, self.OUTPUT, context) outputFile = self.parameterAsOutputLayer(parameters, self.OUTPUT, context)
outputFormat = QgsRasterFileWriter.driverForExtension(os.path.splitext(outputFile)[1]) outputFormat = QgsRasterFileWriter.driverForExtension(os.path.splitext(outputFile)[1])
rows = max([math.ceil(extent.height() / pixelSize), 1.0]) rows = int(max([math.ceil(extent.height() / pixelSize), 1.0]))
cols = max([math.ceil(extent.width() / pixelSize), 1.0]) cols = int(max([math.ceil(extent.width() / pixelSize), 1.0]))
writer = QgsRasterFileWriter(outputFile) writer = QgsRasterFileWriter(outputFile)
writer.setOutputProviderKey('gdal') writer.setOutputProviderKey('gdal')