3

You're specifying the function instead of calling it. I.e. layer1.extent should be: layer1.extent() Do this with width and height: calc = QgsRasterCalculator(exp, output, 'GTiff', layer1.extent(), QgsCoordinateReferenceSystem("EPSG:3003"), ...


1

The problem, as you observed, is that the Rasterize program sets the values outside of the polygons to NODATA (or dummy), and the raster calculator outputs a dummy wherever either raster has a dummy. In QGIS 3.6.3 I've solved this problem by specifying the output carefully in the Rasterize program to give everything outside of the polygons a value of zero. ...


Only top voted, non community-wiki answers of a minimum length are eligible