PgMetadata

PgMetadata


A plugin to manage metadata
for your PostgreSQL data


Michaël Douchin

Foss4G - Firenze 2022
PgMetadata

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
PgMetadata

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

PgMetadata for the GIS administrator

Foss4G - Firenze 2022
PgMetadata

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
PgMetadata

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
PgMetadata

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
PgMetadata

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
PgMetadata

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

PgMetadata for the GIS user in

Foss4G - Firenze 2022
PgMetadata

QGIS locator & Metadata panel

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

image

Foss4G - Firenze 2022
PgMetadata

Export

The user can export each dataset metadata to:

  • HTML
  • PDF
  • DCAT https://www.w3.org/TR/vocab-dcat-2/
    <dcat:dataset>
      <dcat:Dataset>
        <dct:identifier>e0940d27-0059-4156-85e7-ef6b3cb57230</dct:identifier>
        <dct:title>Trees (demo)</dct:title>
        <dct:description>Trees around the botanical garden in Montpellier.
    Source: OpenStreetMap</dct:description>
        <dct:language>en</dct:language>
        <dct:license>Open Data Commons Open Database License</dct:license>
        <dct:rights>Open</dct:rights>
        <dct:accrualPeriodicity>Yearly</dct:accrualPeriodicity>
        <dct:spatial>{&quot;type&quot;:&quot;Polygon&quot;,&quot;coordinates&quot;:[]]}</dct:spatial>
        <dct:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2021-09-28T08:55:44.606067</dct:created>
        <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2021-09-28T08:55:44.606067</dct:issued>
        <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2021-09-28T08:55:44.606067</dct:modified>
        <dcat:contactPoint>
          <vcard:Organization>
            <vcard:fn>Jane Doe - ACME (SIG)</vcard:fn>
            <vcard:hasEmail rdf:resource="jane.doe@acme.corp">jane.doe@acme.corp</vcard:hasEmail>
          </vcard:Organization>
        </dcat:contactPoint>
    
Foss4G - Firenze 2022
PgMetadata

PgMetadata advanced features

Foss4G - Firenze 2022
PgMetadata

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)

    [pgmetadata]
    auto_open_dock=true
    end_user_only=true
    connection_names=Connection 1;Connection 2;Connection 3
    
    [Plugins]
    pg_metadata=true
    
Foss4G - Firenze 2022
PgMetadata

Share

(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: https://github.com/3liz/lizmap-pgmetadata-module/

image

Foss4G - Firenze 2022
PgMetadata

Documentation

https://docs.3liz.org/qgis-pgmetadata-plugin/

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

image

Foss4G - Firenze 2022
PgMetadata

Conclusion

Foss4G - Firenze 2022
PgMetadata

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
PgMetadata

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
PgMetadata

Resources

Foss4G - Firenze 2022
PgMetadata

Thanks

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
PgMetadata

Thank you for your attention

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

image

Foss4G - Firenze 2022