[Qgis-user] QGIS problem with GeoPackage database views

Marcus Blake marcusthemapmaker at gmail.com
Sun Jun 26 00:37:19 PDT 2016


Background (a bit of the business case for non his users..ignore if required ;-)

Statistical Agencies traditionally publish statistical data related to statistical areas separately from the statistical boundaries that defines these areas. This creates a significant barrier to the use of these data in general mapping applications and more specialised spatial analysis systems. 

To remove this barrier the Australian Bureau of Statistics (ABS) is evaluating the use of GeoPackage as an output format for facilitating the publication of both geospatial and statistical data. GeoPackage has a number of advantages one of the most significant is the ability to define database views. A database view is SQL statement that results in the creation of a “virtual” table that can be  The use of database views within the GeoPackage database container provides a efficient mechanism to maintain the relationship (the relational join) between the statistical boundaries (“geometries”) and the statistical (“attribute") data.

By maintaining this relationship in a single published product this reduces the barrier to their use in mapping applications, reduces the probability of introduced error, increases the ease of use of statistical data in the community.

The Problem...

QGIS is not seem to fully support database views in GeoPackage. In some respects QGIS works as expected, but spatial and attribute selections and the display of the attribute table produce incorrect results.

Example GeoPackage File:

SA1_BCP_B01_05.gpkg (134 MB)
 <https://drive.google.com/open?id=0Bz44nz9iptC5NkF5WlpEZjBoSVk>https://drive.google.com/open?id=0Bz44nz9iptC5NkF5WlpEZjBoSVk <https://drive.google.com/open?id=0Bz44nz9iptC5NkF5WlpEZjBoSVk>

Australian Bureau of Statistics 2011 Census Data
Product: Basic Community Profile. Statistical Tables B01 to B05

Images illustrating the issues
 <https://drive.google.com/open?id=0Bz44nz9iptC5YjlrLV9vRFhmVE0>https://drive.google.com/open?id=0Bz44nz9iptC5YjlrLV9vRFhmVE0 <https://drive.google.com/open?id=0Bz44nz9iptC5YjlrLV9vRFhmVE0>

Things that work...

1. Views are identified as layers and can be loaded into the Layers Panel
2. Polygons are drawn as expected.
3. The Identify Feature tool can be used to highlight and individual polygon and display the correct associated attribute data.
4. Styling and classification algorithms can be applied to compose correct choropleth maps.

Things that do not work...

1. QGIS is not displaying the Attribute Table of a GeoPackage view correctly. Attribute values are repeated for a single row.
2. Any Select operation that is applied either to the attributes or the geometries results in the whole layer being selected.

In summary it looks like whilst the geometries of a GeoPackage view are being interpreted correctly the link to the underlying attributes in a view is not. Incidentally, neither the latest version of ArcGIS or MapInfo Profession can interpret views in GeoPackage either and this has been identified as a bug by both organisations.

Any help from some one who knows their way around how GeoPackage is interpreting views would be gratefully received.

Marcus.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20160626/3095b4db/attachment.html>


More information about the Qgis-user mailing list