Closed brownag closed 9 months ago
Also, add support for this!
Starting with GDAL 3.7.1, it is possible to define a geometry column as the result of a Spatialite spatial function. Note however that this is an extension likely to be non-interoperable with other software that does not activate Spatialite for the SQLite3 database connection. Such geometry column should be registered into the gpkg_extensions using the gdal_spatialite_computed_geom_column extension name (cf GeoPackage Spatialite computed geometry column extension), like below:
CREATE VIEW my_view AS SELECT foo.fid AS OGC_FID, AsGBP(ST_Multi(foo.geom)) FROM foo; INSERT INTO gpkg_contents (table_name, identifier, data_type, srs_id) VALUES ('my_view', 'my_view', 'features', 4326); INSERT INTO gpkg_geometry_columns (table_name, column_name, geometry_type_name, srs_id, z, m) VALUES ('my_view', 'my_geom', 'MULTIPOLYGON', 4326, 0, 0); INSERT INTO gpkg_extensions (table_name, column_name, extension_name, definition, scope) VALUES ('my_view', 'my_geom', 'gdal_spatialite_computed_geom_column', 'https://gdal.org/drivers/vector/gpkg_spatialite_computed_geom_column.html', 'read-write');
Closed by #12
Add a convenience method for the creation of spatial views: https://gdal.org/drivers/vector/gpkg.html#spatial-views
For example: