How can I use the QgsVectorFileWriter to include metadata description for Geopackage layers in a python script?
I can set the layer name using:
options.layerName = "roads_layer"
what I want is something like:
options.description = 'This are the roads covering such and such, Dec 2019".
In QGIS you can right click, export layer to Geopackage and you get the option to set a Description.
Then in QGIS, you get the description showing in the Abstract (baring in mind my examples don't actually match):
I can see that the GDAL Geopackage definition means you can do this, I just haven't been able to find or understand how to do it.
Can anyone help please?
layObj.setAbstract("Test metadata Dec 2019") # this line doesn't translate to the geopackage table options = QgsVectorFileWriter.SaveVectorOptions() options.actionOnExistingFile = QgsVectorFileWriter.CreateOrOverwriteLayer options.layerName = layname writer = QgsVectorFileWriter.writeAsVectorFormat(layObj, geopP, options)