test_dump.py
1 |
layers = iface.legendInterface().layers() |
---|---|
2 |
layer = None
|
3 |
for l in layers: |
4 |
if str(l.name())=='a_polygon': |
5 |
layer = l |
6 |
if layer:
|
7 |
crs = str(layer.crs().authid())
|
8 |
vl = QgsVectorLayer("Polygon?crs="+crs, 'new_polygon', "memory") |
9 |
pr = vl.dataProvider() |
10 |
origFields = layer.pendingFields() |
11 |
pr.addAttributes( origFields ) |