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

Stefanos Natsis uclaros at gmail.com
Tue Apr 30 02:11:51 PDT 2024


Hi Abdelghani,

You should be able to achieve that by setting the project's terrain:
```
p=QgsRasterDemTerrainProvider()
p.setLayer(dem_layer)
QgsProject.instance().elevationProperties().setTerrainProvider(p)
```
This should get your dem_layer as a terrain for any new 3d views.
I don't think the API to change the 3d views' terrain is exposed to python
yet.

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


More information about the QGIS-Developer mailing list