3

Is there a way to store metadata in a Geopackage along with the layer data?

I'm using QGIS 2.18.24. When you add or edit metadata via the "Metadata" pane of the layer's Properties, this is saved in the project file, not the geopackage.

There is an open issue that states the "metadata data panel is still a work in progress" which then links to an enhancement proposal on github. Perhaps this issue is already addressed in QGIS 3. Regardless, is there some kind of workaround? Maybe there's another program that can open the gpkg and add metadata in a format that QGIS will still read?

1 Answer 1

2

I do not know how QGIS deals with metadata but I think that the best way to do that with GeoPackages would be to follow the standard

Two tables in a GeoPackage provide a means of storing metadata in MIME [21] encodings that are defined in accordance with any authoritative metadata specifications, and relating it to the features, rasters, and tiles data in a GeoPackage. These tables are intended to provide the support necessary to implement the hierarchical metadata models as defined in ISO 19115 [28] and illustrated in Hierarchical Metadata Example One - ISO19115. and Raster or Tile Metadata Example. As GeoPackage data is captured and updated, the most local and specific detailed metadata changes associated with the new or modified data MAY be captured separately, and referenced to existing global and general metadata.

The gpkg_metadata table that contains metadata is described in clause Metadata Table, and the gpkg_metadata_reference table that relates gpkg_metadata to GeoPackage data is described in clause Metadata Reference Table. There is no GeoPackage requirement that such metadata be provided or that defined metadata be structured in a hierarchical fashion [K27]. This extension simply provides a mechanism for storing this information. If this extension is used, such metadata [K28] and data that relates it to GeoPackage contents should not be stored in other tables.

GDAL has limited support for metadata in GeoPackage https://www.gdal.org/drv_geopackage.html

(GDAL >=2.0) GDAL uses the standardized gpkg_metadata and gpkg_metadata_reference tables to read and write metadata, on the dataset and layer objects.

GDAL metadata, from the default metadata domain and possibly other metadata domains, is serialized in a single XML document, conformant with the format used in GDAL PAM (Persistent Auxiliary Metadata) .aux.xml files, and registered with md_scope=dataset and md_standard_uri=http://gdal.org in gpkg_metadata. For the dataset, this entry is referenced in gpkg_metadata_reference with a reference_scope=geopackage. For a layer, this entry is referenced in gpkg_metadata_reference with a reference_scope=table and table_name={name of the table}

Metadata not originating from GDAL can be read by the driver and will be exposed as metadata items with keys of the form GPKG_METADATA_ITEM_XXX and values the content of the metadata columns of the gpkg_metadata table. Update of such metadata is not currently supported through GDAL interfaces ( although it can be through direct SQL commands).

3
  • Gosh, that sure doesn't sound user friendly. I guess most people are waiting for a tool to simplify this. Standards referencing standards referencing standards... any chance you have a link to the "Hierarchical Metadata Example One - ISO19115" and "Raster Example"? Plus maybe a template gpkg?
    – jac
    Commented Oct 11, 2018 at 9:59
  • Metadata as a word means just "data about data" and it does not need to mean "metadata according to ISO19115". What do you mean with metadata? What sort of information would you like to store about your layer? Can you give an example? The Hierarchical Metadata example is from the standard itself geopackage.org/spec120/index.html#extension_metadata but it is probably all too heavy for your needs.
    – user30184
    Commented Oct 11, 2018 at 10:15
  • 1
    My metadata should include, pretty much what the FGDC standards state, as in: desktop.arcgis.com/en/arcmap/10.3/manage-data/metadata/… Things like description, citations, lineage, data quality, attribute definitions.
    – jac
    Commented Oct 11, 2018 at 22:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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