[QGIS-Developer] Choose DEM layer as terrain in 3D view using PyQGIS

Stefanos Natsis uclaros at gmail.com
Tue Apr 30 14:25:58 PDT 2024


Hi Abdelghani,

You need to create a symbol, set its data defined properties, assign it to
a 3d renderer and then assign the 3d renderer to the layer:

```
s = QgsPolygon3DSymbol()
p = QgsProperty()
p.setField('field_containing_height')
c = QgsPropertyCollection()
c.setProperty(QgsPolygon3DSymbol.Property.ExtrusionHeight, p)
s.setDataDefinedProperties(c)
layer.setRenderer3D(QgsVectorLayer3DRenderer(s))
```

Best,
Stefanos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20240501/aa97af6d/attachment.htm>


More information about the QGIS-Developer mailing list