2

Working with QGIS 3.4.9 and Geopackage. I created a View table. The command runs without errors, the view is created but does not appear in QGIS. What do I need to do?

3

The current version of GeoPackage (version 1.2.1) lacks a mechanism to register views into the metadata tables. The GitHub issue about that seems to be solved and closed https://github.com/opengeospatial/geopackage/issues/446 but changes will be included only in the version 1.3 of the standard.

For making your view to appear in QGIS you must materialize it with (create table my_materialized_view as select … from my_view). Some additional SQL may be needed for registering the new materialized view properly.

  • Materialized view is not for my purposes, I need dynamic views. I tried to inform Geopackage by giving an insert in the gpkg_contents and gpkg_geometry_columns tables, but it still did not work properly – Denilson Jul 9 '19 at 23:15
  • It seems to be possible to add data from the gpkg view into QGIS with "execute SQL" tool but it converts data for example into a temporary shapefile and is not dynamic. OpenJUMP does not care about metadata and it is perhaps more nice to use with SQL queries, is that software an option for you? – user30184 Jul 11 '19 at 8:20
  • In this moment no , i'm very happy with QGIS and I will trying find some ideias to put spatial views inside of Geopackage. – Denilson Jul 11 '19 at 16:30
  • How about using SpatiaLite instead of GeoPackage? It does already have a mechanism for registering the metadata of spatial views, with some limitations caused by the SQLite gis.stackexchange.com/questions/232479/…. – user30184 Jul 11 '19 at 19:05
  • I started testing SpatiaLite, but I thought my spatial features slowed down compared to Geopackage, so it takes longer to see in QGIS. As for Views, my case makes it necessary to create views between two tables. In Geopackage it is also necessary to register the views, but I'm having problems, I think DBmanager should include a way to make those records. At the moment I'm getting around the problem by creating virtual table / layer inside the QGIS project (qgs / qgz), which has given good results. – Denilson Jul 11 '19 at 20:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.