I want to create a GeoPackage file using PyQGIS (for example database.gpkg) with one layer (named "myLayer") not having any QgsVectorLayer
at all.
I've tried this:
from qgis.core import QgsVectorFileWriter
writer = QgsVectorFileWriter(fileName, 'UTF-8', layerFields, QgsWkbTypes.Unknown, QgsProject.instance().crs(), 'GPKG', newLayer='myLayer')
but got an error:
('newLayer' is an unknown keyword argument)
I can't use writeAsVectorFormatV2
because I need to create a file first and then add it to QGIS.