I have two lists of raster (digital elevation model - DEM) layers by name. The first list of layers should be symbolized as follows: symbology should be set to hillshade layer rendering, blend mode should be set to soft light
and transparency, global opacity should be set to 30%
The second list of layers should be symbolized as follows: symbology should be set to singleband pseudocolor mode should be set to equal interval and classes should be set to 5
I want to apply all of these settings with PyQGIS code because I need to set them manually every single time.
I have managed to partially solve the aforementioned set of problems. The code for the first list of rasters (sets all the parameters properly):
`for i in list_1 :
layer_1 = QgsProject.instance().mapLayersByName(i)[0]
r = QgsHillshadeRenderer(layer_1.dataProvider(), 1, 315, 45)
layer_1.setRenderer(r)
layer_1.setBlendMode(QPainter.CompositionMode_SoftLight)
layer_1.renderer().setOpacity(0.3)`
The code for the second list of rasters (only part of the solution):
`for i in list_2 :
layer_2 = QgsProject.instance().mapLayersByName(i)[0]
sbps = QgsSingleBandPseudoColorRenderer(layer_2.dataProvider(),1,)
layer_2.setRenderer(sbps)`
How do I set Mode to Equal Interval and Classes to 5?