[gdal-dev] sqlite dialect: OpenFileGDB and FID Column selection

Rahkonen Jukka jukka.rahkonen at maanmittauslaitos.fi
Thu Aug 31 22:42:36 PDT 2023


Hi,

When the SQLite dialect is used, a temporary SQLite database is created. OBJECTID is a feature identifier (FID) and I guess that the FID gets converted into a primary key with the SQLite defaults. So maybe you can find the OBJECTID from ROWID.
I made a simple test and at least this command did find the right feature. Remember that it was just a quick experiment and I did not say that it is reliable.

ogrinfo poly_sdk.gdb -sql "select rowid, shape from poly where rowid=10" -dialect sqlite

-Jukka Rahkonen-


Lähettäjä: gdal-dev <gdal-dev-bounces at lists.osgeo.org> Puolesta andy
Lähetetty: perjantai 1. syyskuuta 2023 0.36
Vastaanottaja: gdal dev <gdal-dev at lists.osgeo.org>
Aihe: [gdal-dev] sqlite dialect: OpenFileGDB and FID Column selection

Hi,
if I run

ogr2ogr -f CSV /vsistdout/ data.gdb  -sql "
SELECT OBJECTID from table_EDF_IS limit 1"
I have

OBJECTID,
"1"

Instead, if I run

ogr2ogr -f CSV /vsistdout/ data.gdb  -dialect sqlite  -sql "
SELECT OBJECTID from  table_EDF_IS   limit 1"

I have this error

ERROR 1: In ExecuteSQL(): sqlite3_prepare_v2(SELECT OBJECTID from  table_EDF_IS   limit 1): no such column: OBJECTID

What's the way to use sqlite dialect and select OBJECTID/FID field?
If I use ogrinfo I have "FID Column = OBJECTID"

I'm using GDAL 3.8.0dev-c95490018a, released 2023/07/21

Thank you,

Andrea

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20230901/18f9e908/attachment.htm>


More information about the gdal-dev mailing list