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()
Answer
I followed @Joseph directions and it helps me to see another visions. I opened processing toolbox in QGIS and complete missing parameters. Here is the last version:
import processing
rasterLyr = QgsRasterLayer("C:/qgis_data/dem/dem.asc", "Hillshade")
rasterLyr.isValid()
parameters = {'INPUT': rasterLyr,
'BAND': 1,
'COMPUTE_EDGES': False,
'ZEVENBERGEN': False,
'Z_FACTOR': 1.0,
'SCALE': 1.0,
'AZIMUTH': 315,
'COMBINED': False,
'ALTITUDE': 45,
'MULTIDIRECTIONAL': False,
'OUTPUT': "C:/qgis_data/dem/hillshade.tif"}
processing.runAndLoadResults('gdal:hillshade',parameters)
No comments:
Post a Comment