Store metadata in a PostgreSQL database and manage it from QGIS.
PgMetadata is released under GNU General Public License v2.0 or any later version.
Presentation, user guide, installation, Lizmap Web Client, everything is there.
QGIS Plugin to manage some metadata from PostgreSQL layer
License: GNU General Public License v2.0
Store metadata in a PostgreSQL database and manage it from QGIS.
PgMetadata is released under GNU General Public License v2.0 or any later version.
Presentation, user guide, installation, Lizmap Web Client, everything is there.
One PgMetadata database is not reachable, you will have a python exception everytime you are trying to add a layer from postgis (another DB):
Connection manager L28 is the issue:
if 'pgmetadata' not in connection.schemas():
At present, dataset.categories
refer to INSPIRE categories (which BTW should be updated...).
We need a way to let the administrator set a list of topics from a dedicated table, to let him choose. To do so:
pgmetadata.theme
with fields id serial, code text, label text, description text
: add a primary key, a unique constraint on fields code and label. Do not forget to add comments on table and fieldsdataset.themes
as a text[]
which will behave as the categories field, but with values coming from the new dataset.theme
tableyour model seems quite different then the metadata extension in geopackage, did you consider to adopt the geopackage model for metadata?
Do you have the ability to ingest or export to different ISO metadata standards? e.g. required by governments, etc.
Are there applications for publishing the metadata as CSW or OGCAPI endpoints
Is it correct that it is not possible to harvest the metadata directly? fo example from Geonetwork
Is it possible to store the metadata in another database or has to be for each database an own schema?
Can it ingest metadata from a remote CSW or OGC API source?
Is there any overlap with the 'Layer Metadata Search' plugin?
Does pgMetadata integrate with QGIS Layer Properties metadata? If so, how?
Do you plan a GeoNetwork Harvester ? xml exports(MEF)?
How to manage multilingual metadata?
cc @Gustry
This must be done for categories and other values in the glossary.
Hi,
it would be great if you could load the project to edit the metadata in on click.
For example, right-click on layer and edit metadata.
These fields must be calculated by a trigger BEFORE
ST_ConvexHull(geom)
QgsDataSourceUri can be based on a table like :
(SELECT * FROM foo) AS t
PgMetadata is failing loading the metadatasheet on these layers :
2022-03-29T12:36:50 CRITICAL Error when querying the database : Erreur SQL : SELECT pgmetadata.get_dataset_item_html_content('france', '(SELECT * FROM france.parcelles WHERE id_parcelles IN ('11203000AL0122','11203000AL0123','11203000AL0124'))', 'fr'); renvoyé 0 [ERROR: syntax error at or near "11203000"
LINE 1: ...T * FROM france.parcelles WHERE id_parcelles IN ('11203000AL...
For now, we are using a global connection variable to let the plugin knows where is the pgmetadata
schema.
This is needed for the locator for instance, to know in which database the query can be made.
For the OTF metadata display, we should check in the current database layer, and not using the variable. But people might wonder why the results is different between the locator?
The idea is to have 2 views allowing to control the orphas:
pgmetadata.dataset
which point to tables that do not existspgmetadata.dataset
Good morning,
I work with the last pgmetadata plugin : 1.1.
I'm not able to save edits. When i add a new feature into Dataset, there is an error message saying :
"WARNING Commit errors: Unable to commit changes for Dataset layer"
ERROR: 1 feature(s) not added.
Data provider error:
PostGIS error when adding feature: ERROR: Duplicate key value breaks unique constraint 'dataset_table_name_schema_name_key'
DETAIL: The key "(table_name, schema_name)=(CigeoZH_Po_20220228, andra_naturel)" already exists.
If anyone could help me? Thanks a lot.
Keywords are stored in an array of text.
I htink we talked with @mdouchin to switch to a single text field.
Hello,
Firstly, thank you very much for making a very useful and well designed QGIS plugin!
When using the plugin on QGIS 3.20.2 the "Created At" field in Metdata will not autopopulate and therefore not allow me save the edits.
In comparison, loading the exact same administrator project from the same database in QGIS 3.18.0 causes no issues.
Given it is the more recent version that is misbehaving, I thought I would let you know.
Thanks.
The locator shouldn't show orphan metadata
pgmetadata.v_valid_dataset
which gives a list of lines from pgmetadata.dataset
with corresponding (existing) tables. This view returns only table_name
and schema_name
, no need for a autogenerated id with row_number
locator.py
use it in the existing SQL query: add a INNER JOIN
to return only data for existing datasetsHi,
On Windows, it seems the path is not valid.
Indeed, it misses a trailing slash on lastFileNameWidgetDir
variable.
Next to the settings gear in the dock, we can have a save button, with a drop down menu :
It would take the content of the HTML panel and save it into a file, with the given format.
For one of my data, i filled some key words. For instance : "limite" (french).
But via the locator, when i tape "limite", the table is not proposed.
This SQL is not working about the template generation :
INSERT INTO pgmetadata.dataset (table_name,schema_name,title,abstract)
VALUES ('lines','test','Test title','Test abstract.') RETURNING id;
--> 7
INSERT INTO pgmetadata.link (name,type,url,description,size,fk_id_dataset)
VALUES ('test link','pdf','https://metadata.is.good','',0.5,7)
DELETE FROM pgmetadata.html_template WHERE section IN ('main', 'link');
INSERT INTO pgmetadata.html_template (section,content)
VALUES ('main','<p>[% "title" %]</p><b>[%"abstract"%]</b><p>[% meta_links %]<p>');
INSERT INTO pgmetadata.html_template (section,content)
VALUES ('link','<p>[% "name" %] [% "description" %]</p><p>[% "size" %]</p>');
SELECT pgmetadata.get_dataset_item_html_content('test','lines');
No need to have the underlying layer behind. This SQL must work.
<p>Test title</p><b>Test abstract.</b><p><p>
I should be able to see the link. Maybe I'm missing something obvious ?
Maybe between [% "name" %]
and [% name %]
?
Hi,
in order to support (geodata-/layer-)views you could use information_schema.tables
[1] instead of pg_tables
in
v_valid_dataset
,v_orphan_tables
andv_orphan_dataset_items
(like it is already in pgmetadata.v_table_list
).
It works on my side. Side effect: as v_valid_dataset
is used by the locator code, views will also be found.
Could make a PR, if you like.
[1] https://www.postgresql.org/docs/13/infoschema-tables.html
Great plugin!
Cheers
I’m not sure if I understood the goal of the Themes field correctly, but during my evaluation of the plugin, this use case came up:
I have created themes for topics and spatial divisions like
So when I need to get started with a map e.g. for the State of Brandenburg, I would like to add the themes “base information for Brandenburg“ and „hydrogeology Brandenburg“ to have the layers I usually need conventiently loaded all at once.
I have added a button to the dock, which offers me a list selection of database (if more than one DB is connected) and of the available themes. When I select a theme, all the layers in that theme get added as a layer group.
Is this a use case of general interest? If so, I can prepare a PR.
This would be a nice-to-have enhancement:
Add links to other metadata records (via their UUID) for relationships like
Qgis native layer metadata already has a “parent UUID” field, so there would be some compatability already.
glossary
: label_fr
and description_fr
Create metadata administration project
: this will add a new project variable with pgmetadata locale and set the corresponding value in the new configuration tableHello,
I noticed that when if I have more than one table connected to the "Dataset" table in the QGIS pgmetadata manager project I cannot edit attributes under the attributes tab using form view. As soon as I enter a text box and begin typing the form automatically switches to the first feature in the "Dataset". This is also true for any of the other widgets- again it automatically switches to the first feature. I am able to edit all the data fine in table view however.
I am not sure if this is a bug or if I am just not understanding something. Thanks!
Hello,
As a "GIS Administrator" using your plugin (thanks for making it), it would be useful to have an "update frequency" field. This would help keep track of datasets which require regular updating or identify those that have been produced as a one-off. On many occasions this differs from publication frequency, which is often determined by a 3rd party.
Perhaps it could go under the "Data last update" field?
Enhancment proposal: It would be great to have an additional field for license numbers, ODC-BY and German Data Licence attributions etc.
While inserting rows in the dataset
table, the function calculate_fields_from_data
doesn't like if the geometry has a Z or M dimension.
Geometry has Z dimension but column does not
calculate_fields_from_data line 51 execute
We need a test case with a layer having Z dimension
CC @drillinP @mdouchin
I’d like to help with a German translation on Transifex. However, I cannot add it: after clicking “Join team” I only get offered French, and the hint says I should request a language that’s not offered. But when I click “Request language”, I cannot request German, because it is already marked “Requested language”.
Could you have a look into why German isn’t available in either option? Thanks!
In the metadata.txt, it's currently 3.4.
I propose to update at least to QGIS 3.10 and we should also make it compatible with higher version of QGIS (3.16 will be LTR soon).
fetch_data_from_sql_query
with a simple switchSorry for flooding the Issues with enhancement ideas ;-)
I’ve realised that it is already possible to enter metadata for rasters. After that, the layer can be found and added with the locator search bar. However, the added layer is a vector layer with its datasource set to the raster dataset, so the warning triangle about a missing datasource is shown.
The other way round, when I add the raster layer, the corresponding metadata is not shown, probably because PgMetadata only looks for information for vector layers.
So several aspects of using raster data with PgMetadata already work. Would it be difficult to add full raster layer support? I can have a look at it.
Using QGIS 3.16.6-Hannover and postgresql12 on MacOSX 11.5.2 (Big Sur). Plugin loads, but when running "installation of the database structure" and "create metadata administration project", each fails. Managed to install by removing non-UTF8 characters from 90_glossary.sql and pg_metadata_administration.qgs. These characters seemed to be French language characters and once replaced with UTF-8-like characters, both scripts ran fine.
Hi,
Is there any reason for not storing the project in postgresql ? (Maybe for the support of old version)
I think it could be done with the install database structure
step, right ?
Plus, it would be nice to load the project in one click (right click on layer and edit metadata for example)
Anyway thanks for your amazing work !
The French Ministry of Ecological Transition is very interested about this plugin.
Bests regards,
test
folder from the packagei18n
folder in the packageSince the commit 71109de there is a new function pgmetadata.export_datasets_as_flat_table(_locale text)
which allows to get a flat version of the datasets. This could be used to add a "Export all" button which will create a new QGIS vector (table) layer by invoking SELECT * FROM pgmetadata.export_datasets_as_flat_table(LOCALE)
The user will be able to save this layers as LibreOffice Calc, or Microsoft Excel or CSV file via the "Save as" QGIS feature.
I think there are 2 places for this flat export:
We should use the following option to improve the user experience when editing contacts or links from the parent "dataset" form
cc @Gustry
This ticket is a nice-to-have.
I'm not talking about filling the dataset table from QGIS native metadata, but the reverse.
We could read the dataset table and fill QGIS native metadata.
It would be better because :
On a point layer with
ST_ConvexHull
will return a pointST_ConvexHull
will return a line stringST_ConvexHull
will return a line string as wellThe dataset table is expecting a polygon:
_core.QgsProviderConnectionException: SQL error: INSERT INTO pgmetadata.dataset (table_name,schema_name,title,abstract) VALUES ('test_geom_z','pgmetadata','Test title Z','Test abstract Z.') returned 0 [ERROR: Geometry type (Point) does not match column type (Polygon)
CONTEXT: PL/pgSQL function pgmetadata.calculate_fields_from_data() line 56 at EXECUTE
Low probability I know, but still a possible bug.
Does this metadata system provide a way to store attribute field descriptions? We currently have excel spreadsheets separate from the pgmetadata system in order to keep track of what each field represents, units, etc.
In the administration project, we should add schemas
and tables
which would be based on SQL queries 👍🏻
SELECT schema_name
FROM information_schema.schemata
WHERE schema_name NOT IN ('pg_toast', 'pg_temp_1', 'pg_toast_temp_1', 'pg_catalog', 'information_schema');
SELECT table_schema, table_name
FROM information_schema.tables
WHERE table_schema NOT IN ('pg_toast', 'pg_temp_1', 'pg_toast_temp_1', 'pg_catalog', 'information_schema');
And use these tables in the form for auto-completion.
Using #22, if the string is empty, the HTML must be generated on the Python side, using the default HTML templates
The tool allows to the administrator to set several key words for a table.
But as far as i tested, it is not possible for the user to make a search by entering several key words. (through the locator? throughThe data source manager?)...Or by entering for instance some key words or/and themes and or a category? Am I wrong?
Since 0612227, it's now possible to have DCAT export as XML file.
It would be nice if the XML is correctly indented with carriage return.
PS, I tried quickly with from xml.dom.minidom import parseString
but it failed. Maybe the special dcat format ? Not sure.
We should add the parsing step into the CI test to be sure that we have a valid XML output.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.