sqlite_scanner icon indicating copy to clipboard operation
sqlite_scanner copied to clipboard

GeoPackage geometry type detection

Open rouault opened this issue 1 year ago • 0 comments

GeoPackage is a specification for geospatial files based on a SQLite3 database: https://www.geopackage.org/spec/ Geometries are encoded in as blobs in a column, but the column type name used is not BLOB, but one of GEOMETRY, POINT, LINESTRING, POLYGON, MULTIPOINT, MULTILINESTRING, MULTIPOLYGON, GEOMETRYCOLLECTION, CIRCULARSTRING, COMPOUNDCURVE, CURVEPOLYGON, MULTICURVE, MULTISURFACE, CURVE, SURFACE (cf tables 30 and 31 of the above link). Currently the SQLite scanner wrongly detects them as VARCHAR, given the rules it uses for type deduction. Would it be possible to modify the scanner for that special case to recognize geometry columns as binary ? The easiest way to identify GeoPackage files is to test for the "gpkg" file extension, which is mandated by the specification. It is also possible to check the SQLite3 application_id header field to be 0x47504B47 ("GPKG" in ASCII) (cf requirement 2 of the spec)

rouault avatar Sep 04 '24 16:09 rouault