How can I duplicate a layer in QGIS?
There are two feature requests regarding this (#5899 and #1483). This is certainly a doable feature, and could likely be included in version 2.0, if a developer were interested in adding it; or, a Python plugin developer gave it some consideration.
The #5899 issue also includes some Python code for duplicating a layer (submitted by developer Giuseppe Sucameli):
In the meantime, select the vector layer then open the QGis python console and run:
iface = qgis.utils.iface; vl = iface.activeLayer(); iface.addVectorLayer(vl.source(), vl.name() + "_clone", vl.providerType())
The previous code adds to the map the same sublayer.
It's difficult to do it using a one-line python script like the previous one, but if you know the sublayer name you can just replace
vl.source()
withvl.source().split("|")[0] + "|layername=my_sublayer_name"
where my_sublayer_name is the name of your sublayer.
It appears after running the duplication code, you will have to copy/paste the original layer's style.
The recent versions of QGIS now have a "Duplicate Layer" option. Right-click the layer you want to duplicate, and it'll insert a new copy just below.
Side note: It seems you need to hit View --> Refresh
for changes made in the one layer to propagate to the next.