Is there a straight way to clone or "deepcopy" a QgsVectorLayer Object with python? Unfortunately the python module "copy" is not successfull with that.
Thanks in advance!
The QgsVectorLayer class is just a view into the underlying data source so you can just do this to make a new layer:
newlayer = QgsVectorLayer(layer.source(), layer.name(), layer.providerType())
where layer is a instance of another QgsVectorLayer
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
3 years ago