Tuesday, 17 December 2019

qgis - How can I create a new layer from the current selection using PyQGIS?


Is it possible to create a duplicate layer, only displaying the selection from the layer you are duplicating in QuantumGIS? Similar to ArcGIS -> Create Layer from Selected Features.


I looked at "How to duplicate a layer"



iface = qgis.utils.iface
vl = iface.activeLayer()
iface.addVectorLayer( vl.source(), vl.name(), vl.providerType() )

but can't see how to duplicate only the selected features?




No comments:

Post a Comment