Yea, I tried it in the consol and it worked, but does not work in my plugin
code.
From: Bo Victor Thomsen
Sent: Wednesday, November 27, 2024 6:09 AM
To: Catania, Luke A ERDC-RDE-GRL-VA CIV ;
qgis-developer@lists.osgeo.org
Subject: Re: [QGIS-Developer] Field Name limited to 10 characters for a
Hi Luke -
Running this code in the QGIS Python console:
*
vector_layer = iface.activeLayer() # Active layer _is_ from GeoPackage
field_name = 'Land Use Category' # "New_field" changed to "field_name"
new_field = QgsField(field_name, QVariant.String)
vector_layer.dataProvider().addAttributes(
I am using a geopackage as a data source and when I add a new field it is
limited to 10 characters. I thought that was only a limitation for ESRI
shapefiles.
New_field = "Land Use Category"
new_field = QgsField(field_name, QVariant.String)
vector_layer.dataProvider().addAttributes([new_field])