Skip to main content

Providing Field (column) level Metadata via Geopackages & QGIS

The GeoPackage specification includes the Schema extension as "a means to describe the columns of tables in a GeoPackage with more detail than can be captured by the SQL table definition directly" - see schema extension guidance.

The specification defines a table, gpkg_data_columns to hold information about table (and view) columns. They provide the SQL code to create the table.

QGIS support for field-level metadata

QGIS supports the GeoPackage schema functionality. It allows users to read and write an Alias and Comment for each field in a spatial table. For spatial views, it allows read but not write.

This simple SQL table makes it easy to add metadata to our GeoPackages. For example, we can transform the RME metrics table to column descriptions and we can copy metadata from one layer to another during our processing.

Illustrations

QGIS interface to add a comment (description) to a field

QGIS set comment

Showing the alias and comments for a spatial view in the identify pane

alias and description for spatial view, in QGIS identify pane

Description of the HYP column shown in attribute table on hover

description of the HYP column shown in attribute table on hover

In the layer properties, under fields

in layer properties under fields

Although QGIS will display the comments for views, it won't let you set them

error message failed to set comment for view