I'm trying to create an empty copy of a certain layer, so no objects only tablestructure, crs etc.
from qgis.utils import *
layer = qgis.utils.iface.activeLayer()
print layer.name()
provider = layer.dataProvider()
print provider.fields()[0].name()
writer1 = QgsVectorFileWriter("d:/temp/qgis/test3.shp",
"CP1250",
provider.fields(),
provider.geometryType(),
provider.crs(),
"ESRI Shapefile")
When I open the created file (test3) there is no tablestructure, crs. etc.
Running the script the second time with test3 still open, it works.
Obviously I miss something .
An other good working solution I found later: http://gis.stackexchange.com/q/156096/67332/
it loads it into a memory layer.
