How do I update the datasource of file project in QGIS, for example myexample.qgz from Python console?

What is the command needed, or scripts standalone?

For example:

layer = iface.activeLayer() 
newDatasource = "/home/usuario/EJES2020.shp" 
newProvider = "ogr"
?.setDataSource('EJES2018',newProvider, newDatasource, extent)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.