Hi,

in https://github.com/OSGeo/gdal/pull/8301, I've added the capability to select/filter using the FID column name (when it is not empty) with the SQLite dialect as well.

The behaviour of OGR SQL regarding FID use is documented at https://gdal.org/user/ogr_sql_dialect.html#fid , and for the SQLite dialect at https://gdal.org/user/sql_sqlite_dialect.html#feature-id

Even

Le 01/09/2023 à 10:28, Rahkonen Jukka a écrit :

Hi,

Feature IDs are confusing. Some formats require FID, some do not directly support FID at all (shapefile). Sometimes FID must be an integer, sometimes it is always a string (gml_id), and sometimes it is either or (GeoJSON). Ogr2ogr has 3 parameters for FIDs, and vector drivers add their own options. Primary key acts usually as a FID, but can a composite PK be a FID? FIDs are really meant for the machines and GDAL usually hides FIDs, but they may be meaningful also for humans as well and sometimes users would like to expose them as a normal attribute with tricks like SELECT *, fid_field as my_fid.

I agree that something like a dedicated wiki page about FIDs in GDAL would be nice to have. Maybe documenting how OBJECTID in FileGDB behaves with different SQL dialects is a rather small detail to be documented separately.

-Jukka Rahkonen-

*Lähettäjä:* andy <aborr...@gmail.com>
*Lähetetty:* perjantai 1. syyskuuta 2023 9.54
*Vastaanottaja:* Rahkonen Jukka <jukka.rahko...@maanmittauslaitos.fi>
*Kopio:* gdal dev <gdal-dev@lists.osgeo.org>
*Aihe:* Re: [gdal-dev] sqlite dialect: OpenFileGDB and FID Column selection

Hi Jukka,

On Fri, 1 Sept 2023 at 07:42, Rahkonen Jukka <jukka.rahko...@maanmittauslaitos.fi> wrote:

    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.

it works, thank you very much.

Maybe a little related note in the documentation would do. What do you think about it?

Thank you again


_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

--
http://www.spatialys.com
My software is free, but my time generally not.
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to