[QGIS-Developer] Refreshing Elevation Profile View after Loading Data using .loadLayerDefinition

Drexel Peter Peter.Drexel at vorarlberg.at
Mon Aug 12 06:35:06 PDT 2024


Dear list,
I am using QgsLayerDefinition().loadLayerDefinition() to load a QGIS-Layer into QGIS 3.38.

Using "Log = QgsLayerDefinition().loadLayerDefinition("pathtofile/xxx.qlr", QgsProject.instance(),QgsProject.instance().layerTreeRoot())" in a Script or in the Python-Console works well to open some elevation data into the layer table and the main view.
But if I want to see the same Data in an Elevation-Profile-View the dataset does not show up in an already opened Elevation-Profile-View. I have to close and reopen the Elevation Profile View to see the loaded Dataset.

To reproduce:
*	Start QGIS
*	Load any Elevation Data and export a qlr-file for the Elevation-Dataset. Unload (Close) the Dataset again.
*	Load another Elevation Dataset
*	Open an Elevation-Profile-View  (View - Elevation-Profile) and draw a Line - you can see the profile plot for the loaded dataset.
*	Keep the Elevation-Profile-View opened and Run "Log = QgsLayerDefinition().loadLayerDefinition("pathtofile/xxx.qlr", QgsProject.instance(),QgsProject.instance().layerTreeRoot())" in the python console - adjust the path to your saved .qlr-File). The Elevation-Dataset is loaded to the Layer-List und to the Main Map-View but not loaded to the Elevation-Profile-View and not to the Layer-List of the Elevation-Profile.

Is there anything I can do to "refresh" the Elevation-Profile-View and the Layer List of the Elevation Profile?

Thanks
Best regards
Peter









More information about the QGIS-Developer mailing list