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

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...