[QGIS-Developer] Lazy question about using views in GeoPackages

Bernd Vogelgesang bernd.vogelgesang at gmx.de
Sat May 27 05:12:22 PDT 2023


Hi,

no first-hand experiences myself, but a friend once tried to do those
views with Geopackage.
Coming from views with Spatialite, it felt like a pita for him, so he
reverted to Spatialite and can not recommend a Geopackage approach.
So, seems you will indeed have to reinvent the wheel.

Cheers,
Bernd

Am 26.05.23 um 12:52 schrieb Bo Victor Thomsen via QGIS-Developer:
> Hi list -
>
> Recently, I've begun experimenting with creating spatial view's of
> base-tables inside GeoPackages. A Geopackage is basically a SQLite file
> containing  spatial data- and meta-tables with specific structures of
> information about the spatial tables.
>
> So it's possible to create a permanent view of a table (or tables) in
> the GeoPackage by making a functioning SQL select statement and
> prefixing it with "CREATE VIEW /view_name/ AS .. /the select statement/
> .. (This is database 101 knowledge)
>
> However, if you want to expose those views as "read-only" tables/layers
> for "non-sql-using" QGIS users  you have to update several meta-tables
> in the GeoPackage: /gpkg_contents/, /gpkg_geometry_columns/ and maybe
> /gpkg_ogr_contents/.
>
> I'm brainstorming with myself about making some kind of automated
> updating of the meta-tables with information about the views created.
> Maybe some python code and maybe creating triggers for the base table to
> handle data changes regarding the extend of the data.
>
> And now (at last !!) my question: I haven't been able to find very much
> information about this subject using Google or StackExchange. So.. Is
> there some existing code / plugin / information so I don't have to
> "reinvent the wheel" ?
>
>
> --
> Med venlig hilsen / Best regards
>
> Bo Victor Thomsen
>
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


More information about the QGIS-Developer mailing list