[Qgis-user] [pyqgis] create new raster

Andrea Giudiceandrea andreaerdna at libero.it
Wed May 10 06:09:35 PDT 2023


> andrea antonello andrea.antonello at gmail.com
> Tue May 9 23:42:56 PDT 2023

> Yes, it does and sets the right type Float64. But I am not sure how to do
> that if I want the same datatype of the original raster layer.
> 
> Interestingly enough:
> 
> dataType = dtmLayer.dataProvider().dataType(1)
> print(int(dataType))
> 
> prints 7, which then results in an error:

The enumeration list of the OUTPUT_TYPE parameter values of the 
native:createconstantrasterlayer processing algorithm (like for other 
algorithms) is specified in the documentation of such algorithm at 
https://docs.qgis.org/3.28/en/docs/user_manual/processing_algs/qgis/rastercreation.html#advanced-parameters 
and it it not intended to be the same as the Qgis::DataType enum class.


Best regards.

Andrea


More information about the QGIS-User mailing list