A plugin to manage metadata
for your PostgreSQL data

Michaël Douchin

Foss4G - Firenze 2022

What is Metadata ?

Help people to understand your data

  • Identification: Title, abstract, categories, themes, keywords, data last update,
  • Spatial properties: spatial level, optimal scales,
  • Publication: date, frequency, license, confidentiality
  • Computed: feature count, geometry type, projection name & code, extent
  • Contact(s): owner, publisher, custodian, etc.
  • Link(s) to resources, web pages, documents
Foss4G - Firenze 2022

Pg 🐘 Metadata

Designed for people using PostgreSQL to store their vector (& raster) data.

  • Centralized: data & metadata in the same database
  • Accessible: a PostgreSQL connection to share the metadata
  • PostgreSQL rich features:
    • SQL powered: relations, constraints, views, functions, triggers
    • Rights & access control: readers VS editors
  • See & Edit with your preferred SQL client:
    • Libreoffice, PgAdmin, psql, DBeaver,
    • QGIS with its powerful forms !
  • Backup & restore metadata with your data
Foss4G - Firenze 2022

PgMetadata for the GIS administrator

Foss4G - Firenze 2022

Create the pgmetadata schema

The plugin is using a schema pgmetadata in PostgreSQL.

A QGIS processing algorithm allows to create it in your database and fill it with the needed tables, views and data (glossary and translations)

image fit

Foss4G - Firenze 2022

A QGIS admin project builder

A QGIS processing algorithm to create a full featured QGIS administration project with rich forms:

image contain

Foss4G - Firenze 2022

Prepare editing

Create the needed contextual data in the dedicated tables:

  • User-defined themes
  • Contacts: name, organisation, unit, email
  • The existing glossary can be changed
  • Translations can be added if missing
Foss4G - Firenze 2022

Edit your datasets with QGIS forms

Choose the schema and table, then edit:

  • the main fields: title, abstract, keywords, etc.
  • the contacts and their roles
  • the dataset related links
Foss4G - Firenze 2022

Admin helpers

Some data are calculated from the table content:

  • valid unique id for the dataset e0940d27-0059-4156-85e7-ef6b3cb57230
  • layer extent, feature count, geometry type, projection id & name.
  • creation and update timestamps, etc.

Some useful views:

  • Orphan PostgreSQL tables: no metadata exists in the dataset table for this tables
  • Orphan metadata: a line exists in your dataset table, but no table corresponds in your database
  • Flat representation of the datasets: lists the datasets with contacts and links aggregated
Foss4G - Firenze 2022

PgMetadata for the GIS user in

Foss4G - Firenze 2022

QGIS locator & Metadata panel

CTRL+K, type meta, find the table, add the layer & view metadata. See animated GIF


Foss4G - Firenze 2022


The user can export each dataset metadata to:

  • HTML
  • PDF
  • DCAT
        <dct:title>Trees (demo)</dct:title>
        <dct:description>Trees around the botanical garden in Montpellier.
    Source: OpenStreetMap</dct:description>
        <dct:license>Open Data Commons Open Database License</dct:license>
        <dct:created rdf:datatype="">2021-09-28T08:55:44.606067</dct:created>
        <dct:issued rdf:datatype="">2021-09-28T08:55:44.606067</dct:issued>
        <dct:modified rdf:datatype="">2021-09-28T08:55:44.606067</dct:modified>
            <vcard:fn>Jane Doe - ACME (SIG)</vcard:fn>
            <vcard:hasEmail rdf:resource="jane.doe@acme.corp">jane.doe@acme.corp</vcard:hasEmail>
Foss4G - Firenze 2022

PgMetadata advanced features

Foss4G - Firenze 2022

Advanced features

  • Easily change the templates for the HTML content (visible in the panel): they are stored inside the html_template table

  • Generate a dataset HTML card with SQL

    SELECT pgmetadata.get_dataset_item_html_content('demo', 'trees', 'fr');
  • Generate a DCAT representation with SQL for one or many tables

    SELECT *
    FROM pgmetadata.get_datasets_as_dcat_xml('fr')
    WHERE True
  • Deploy easily in you organisation with QGIS configuration file variables (hide admin tools, auto-activate plugin)

    connection_names=Connection 1;Connection 2;Connection 3
Foss4G - Firenze 2022


(web) Applications can use the SQL functions to show the localized metadata in HTML format or publish the full catalog in DCAT (and be harvested by Third party Metadata portals).

Example of Lizmap Web Client PgMetadata module:


Foss4G - Firenze 2022


  • For the administrator
  • For the end user
  • For the system administrator
  • Ressources: Changelogs, videos, road map, database structure, etc.


Foss4G - Firenze 2022


Foss4G - Firenze 2022

Why another metadata tool ?

Many open-source tools already exist to store and share metadata.
Why PgMetadata ?

  • See the previous slide about PostgreSQL 🐘
  • Keep the metadata as close as possible to the data
  • Not a new application, but a set of tools for QGIS and your existing PostgreSQL database:
    • the GIS administrator already uses PostgreSQL and can understand easily how PgMetadata works,
    • the GIS users do not need to learn to use a new application
  • GIS user oriented: as a user, search & get the metadata from QGIS VERSUS browse a web page and download the data
  • It is NOT designed to replace the existing metadata web portals, but to be used as a complementary tool !
Foss4G - Firenze 2022

Road map

We will release a new version in September, 2022 with:

  • License: GNU General Public License GPL v2.0
  • Raise the QGIS minimum version to 3.16
  • Raster support
  • Better handling of backslashes in links to Windows files
  • New fields: contact phone number, license attribution and number
  • Clickable email links

Other ideas:

  • Auto-fill the dataset table from a selection of PostgreSQL tables/views
  • Import/Export the QGIS native layer metadata properties
  • Import metadata from DCAT
Foss4G - Firenze 2022


Foss4G - Firenze 2022


image Thanks to the French Gard province for funding the first version of this extension !

Thanks to my colleague Etienne Trimaille @Gustry for helping and maintaining this plugin !

Many thanks to our external active contributors:

  • Florian Jenn @effjot for ideas, fixes & improvements
  • Our kind translators in Transifex for
    • Finnish (Santtu Majuri @BinkiBai, Santtu Pyykkönen @santtuvp),
    • German (Florian Jenn @effjot)
    • Spanish (Carlos López Quintanilla @carlos.psig)
Foss4G - Firenze 2022

Thank you for your attention

Questions ?
I would love to hear feedback from any PgMetadata user !


Foss4G - Firenze 2022