-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from Septima/MetadataDbLinker-2-to-3
Metadata db linker 2 to 3
- Loading branch information
Showing
65 changed files
with
3,257 additions
and
1,513 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,6 +62,9 @@ target/ | |
# | ||
.idea | ||
|
||
#.vscode | ||
.vscode | ||
|
||
# | ||
.DS_Store | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,36 @@ | ||
# qgis-metadatafunctionality | ||
The purpose of this QGIS plugin is to make it possible to enter metadatainformation (name, description, kle-journalnumber, date-of-creation-table) for a table in database through DB Manager. | ||
|
||
# Installation and setup | ||
The MetadataDBLinker plugin requires as minimum one table where metadata is stored, and an optional table describing the fields in the graphical user interface. The plugin can be installed using the install plugin from zip option in QGIS. ZIP files can be found and downloaded under `releases` for this Github Repository. | ||
|
||
![options](figures/installzip.PNG?raw=true "Installing the Plugin") | ||
|
||
## First time setup | ||
First time setting up the plugin the metadata table should be created and settings filled out accordingly. Navigate to the settings window in QGIS `Settings -> Options` and MetadataDBLinker will have its own tab. | ||
|
||
|
||
![settings](figures/options.PNG?raw=true "MetadataDbLinker Options") | ||
|
||
MetadataDBLinker allows a dedicated user to be used with the metadata table. Access rights to this user can be controlled in PostgreSQL. Click the `Metadata Table (SQL)` button for an SQL CREATE statement that will create the table. Create the table in your PostgreSQL Database, make sure your user has approriate access to it then fill out the settings. Finally test the connection by clicking the test button, if OK the plugin should be working. | ||
|
||
![options](figures/settings.PNG?raw=true "Settings") | ||
|
||
### Gui Table | ||
|
||
An extra table can optionally be configured to describe if certain GUI fields in the dialog should be required or enabled. The `Save metadata` button will be greyed out if required fields are not filled. Click the `Gui Table (SQL)` button in the settings for an SQL CREATE statement to set up this table. | ||
|
||
Rows in this table refers columns in the `metadata` table by the `metadata_col_name` column. The table contains three boolean columns: `required`, `editable` and `is_shown` which can be set for every entry in the `metadata` table. | ||
|
||
## Usage | ||
|
||
The plugin can be accessed in two ways. If the plugin is configured and active it can be reached from the toolbar. The plugin will also automatically start after importing layers into DB-manager. Click a layer in the browser within plugin to assign metadata, or if the dialog was started from DB-manager the layer is already selected. Fill out the metadata accordingly and hit `Save metadata` when done. The metadata fields will be enabled when a layer is selected in the browser. If a layer already has metadata assigned these fields will be filled and can be updated. | ||
|
||
|
||
![dblinker](figures/dblinker.PNG?raw=true "Metadata-DB-linker") | ||
|
||
## Locator | ||
|
||
As an added feature, layers with added metadata can be searched using the QGIS Locator by their metadata fields under the category "Metadata-DB-Linker". Clicking the entries will add to them to the current active project. | ||
|
||
![dblinker](figures/locator.PNG?raw=true "Metadata-DB-linker") |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
-- These statements create a table and some nescessary data | ||
-- 1: Replace ALL occurrences of [schema] to the schema | ||
-- 2: Replace [owner] to the owner of the metadatatabel | ||
-- 3: Execute these statements in the postgresdatabase | ||
|
||
-- Table: metadata.gui_table | ||
CREATE TABLE [schema].gui_table | ||
( | ||
id SERIAL, | ||
metadata_col_name character varying, | ||
type character varying, | ||
required boolean, | ||
editable boolean, | ||
is_shown boolean, | ||
CONSTRAINT gui_table_pkey PRIMARY KEY (metadata_col_name) | ||
) | ||
WITH ( | ||
OIDS = FALSE | ||
) | ||
TABLESPACE pg_default; | ||
|
||
ALTER TABLE [schema].gui_table OWNER to [owner]; | ||
|
||
-- Insert descriptive fields for the Metadata Model | ||
INSERT INTO [schema].gui_table(metadata_col_name, type, required, editable) VALUES ('name', 'text', true, true); | ||
INSERT INTO [schema].gui_table(metadata_col_name, type, required, editable) VALUES ('description', 'text', false, true); | ||
INSERT INTO [schema].gui_table(metadata_col_name, type, required, editable) VALUES ('geodatainfo_uuid', 'text', false, true); | ||
INSERT INTO [schema].gui_table(metadata_col_name, type, required, editable) VALUES ('kle_no', 'text', false, true); | ||
INSERT INTO [schema].gui_table(metadata_col_name, type, required, editable) VALUES ('responsible', 'text', false, true); | ||
INSERT INTO [schema].gui_table(metadata_col_name, type, required, editable) VALUES ('project', 'text', false, true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# -*- coding: utf-8 -*- | ||
from .options_factory import OptionsFactory | ||
from .settings import Settings | ||
from .settings_dialog import ConfigDialog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import os | ||
from qgis.gui import (QgsOptionsWidgetFactory) | ||
from qgis.core import QgsApplication | ||
from qgis.PyQt.QtGui import QIcon | ||
from .settings_dialog import ConfigOptionsPage | ||
|
||
|
||
class OptionsFactory(QgsOptionsWidgetFactory): | ||
|
||
def __init__(self, settings): | ||
super(QgsOptionsWidgetFactory, self).__init__() | ||
self.settings = settings | ||
|
||
def icon(self): | ||
icon_path = os.path.join(os.path.dirname(__file__), 'metadata.png') | ||
return QIcon (icon_path) | ||
|
||
def createWidget(self, parent): | ||
return ConfigOptionsPage(parent, self.settings) |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
from .setting_manager import SettingManager | ||
from .setting import Setting, Scope | ||
from .setting_dialog import SettingDialog, UpdateMode | ||
|
||
from .types import * | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.