[gdal-dev] SQLite: create layer with wkbNone

Martin Landa landa.martin at gmail.com
Wed Oct 30 04:46:10 PDT 2024


Hi all,

I have problem creating a new layer (no geometry) in SQLite data source:

"""
from osgeo import ogr

driver_name = "SQLite"
filename = "test.db"

driver = ogr.GetDriverByName(driver_name)

with driver.CreateDataSource(filename) as ds:
    layer = ds.CreateLayer("test", geom_type=ogr.wkbNone)
    field = ogr.FieldDefn("label", ogr.OFTString)
    layer.CreateField(field)

    layer_defn = layer.GetLayerDefn()
    feat = ogr.Feature(layer_defn)
    feat.SetField("label", "test")
    layer.CreateFeature(feat)
"""

Created datasource doesn't contain any layer, no errors reported.

When I switch to GPKG driver, everything works fine:

ogrinfo  test.gpkg test
...
OGRFeature(test):1
  label (String) = test

I have GDAL: 3.9.2, do you have any idea what is wrong?

Thanks in advance for your help, best regards, Martin

-- 
Martin Landa
https://geomatics.fsv.cvut.cz/en/employees/martin-landa/
http://gismentors.cz/mentors/landa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20241030/83bf44c6/attachment-0001.htm>


More information about the gdal-dev mailing list