Even was right. It had to do with SQL ingesting the input as a text string and not an identifier. Thanks for the input everyone.
From: Rahkonen Jukka <jukka.rahko...@maanmittauslaitos.fi> Date: Monday, September 30, 2024 at 4:03 PM To: Even Rouault <even.roua...@spatialys.com>, Meyer, Jesse R. (GSFC-618.0)[SCIENCE SYSTEMS AND APPLICATIONS INC] <jesse.r.me...@nasa.gov>, Meyer, Jesse R. (GSFC-618.0)[SCIENCE SYSTEMS AND APPLICATIONS INC] via gdal-dev <gdal-dev@lists.osgeo.org> Subject: VS: [gdal-dev] [EXTERNAL] Re: GPKG geometry column name expectations with sqlite dialect CAUTION: This email originated from outside of NASA. Please take care when clicking links or opening attachments. Use the "Report Message" button to report suspicious messages to the NASA SOC. This works for me: ogrinfo -sql "select count(st_area(geom)) from rakennus" mtkmaasto.gpkg OGRFeature(SELECT):0 count(st_area(geom)) (Integer) = 5517708 “select st_area(layer.geom)” feels like a blind shot, or have you seen that it works with some database? -Jukka Rahkonen- Lähettäjä: gdal-dev <gdal-dev-boun...@lists.osgeo.org> Puolesta Even Rouault via gdal-dev Lähetetty: maanantai 30. syyskuuta 2024 22.56 Vastaanottaja: Meyer, Jesse R. (GSFC-618.0)[SCIENCE SYSTEMS AND APPLICATIONS INC] <jesse.r.me...@nasa.gov>; Meyer, Jesse R. (GSFC-618.0)[SCIENCE SYSTEMS AND APPLICATIONS INC] via gdal-dev <gdal-dev@lists.osgeo.org> Aihe: Re: [gdal-dev] [EXTERNAL] Re: GPKG geometry column name expectations with sqlite dialect Le 30/09/2024 à 21:18, Meyer, Jesse R. (GSFC-618.0)[SCIENCE SYSTEMS AND APPLICATIONS INC] a écrit : Thanks Scott and Even, Maybe it’s an unexpected interaction with Spatialite, but explicitly providing the geometry column’s name results in bogus outputs. Is the SQL string wrong somehow? f"select count(ST_Area('{lyr_name + '.' + geom_column_name}'))". (same outcome if re-arranged as count(…) from lyr_name instead) ST_Area(some_text) will not work. It expects an identifier (possibly double quoted if that's needed), not a single-quoted string literal. -- http://www.spatialys.com<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