I want to create and elevation hillshade but I found the script for QGIS 2.18. What should I use instead of processing.runandload? Here is my script on QGIS 2.99 python console:
import processing
rasterLyr = QgsRasterLayer("C:/Users/Mustafa Uçar/Desktop/Tutorial/qgis_data/dem/dem.asc", "hillshade")
rasterLyr.isValid()
processing.runandload("gdalogr:hillshade", rasterLyr, 1, False, False,1.0, 1.0, 315.0, 45.0, "C:/Users/Mustafa Uçar/Desktop/Tutorial/qgis_data/dem/hillshade.tif")
#to verify the output image
processing.runandload()
Best Answer
I think with the new QGIS 3.0, it is much easier to incorporate the input parameters of an algorithm into a dictionary which can then be called using:
which is the equivalent to the QGIS <= 2.18 version:
So your code could look like:
Note that
gdalogr:hillshade
is now currentlygdal:hillshade
.