I am currently working on a model allowing me to extract and save the entities extracted from different sources. So far, with the graphical modeler, i managed to perform the extraction and the save into the correct folder. The last step would be to change the data source location of the existing layers with the layers generated by the extraction.
I prefer to keep existing layers to maintain map themes.
Is there a way to change the data location of existing layers with the path name of the generated layers ?
EDIT : I found a way to do it
Script below :
# Modifier la source de données des couches "X" et "Y" X_layer = QgsProject.instance().mapLayersByName('X') X_layer.setDataSource(expression_save, 'X', 'ogr') Y_layer = QgsProject.instance().mapLayersByName('Y') Y_layer.setDataSource(expression_group, 'Y', 'ogr')