I am trying to make a script that reads the content of a .dbf-file and exports it as a shapefile. Equal to the manual pattern "Save as.." when rightclicking the imported layer in the Qgis Desktop.
I've read the Cookbook for developing in pyqgis and tried to troubleshoot with the documentation of QgsVectorFileWriter() but it seems to be written for C++ implementation and not for Python.
_VctLay = QgsVectorLayer("path-to-file\file_imp.dbf", "Import_Area", "delimitedtext")
QgsVectorFileWriter.writeAsVectorFormat(_VctLay ,"path-to-file\file_exp","CP1252",None,"ESRI Shapefile")
I'd like it to be a Shapefile but it is only the .dbf-file i have to use. Moreover I want the CRS to be "EPSG:4095" but it makes an error if i type it in like that. I've tried to have the "bool onlySelected = True" and False" - but none is adding content to the exported table.
I am getting an output. The whole package of files that follows with a shapefile. But they are about all empty. It only creates the files themselves.
Is there some flag, some process i am missing out on this? I wonder if i could have the first step. _VctLay = QgsVectorLayer("path-to-file\file_imp.dbf", "Import_Area", "delimitedtext")
to be followed by an print-commands that clarifies the content of the imported .dbf. But exactly how, i don't know yet.