This release brings some improvements on the data validator like passing additional parameters like the config-file. As well this version introduces the **UsabILIty Hub Topping Exporter** what makes finally the UsabILIty Hub usable for any user without big technical skills.
UsabILIty Hub Topping Exporter
A new wizard provides the functionality to export the current project to UsabILIty Hub topping.
![image](https://user-images.githubusercontent.com/28384354/189109063-f74d6d00-adc4-4139-89d0-4dc44cd1b0f8.png)
Folder Structure and Metainfo
You can add the information like owner, dates etc. (needed in the ilidata.xtf) on the first page of the wizard.
As well the folder structure can be defined.
![image](https://user-images.githubusercontent.com/28384354/189111991-49857e25-356d-417c-881d-5159dd21dc51.png)
Model Selection
Even when having multiple INTERLIS models imported in the same database schema, you can select the ones of interest (and this will be the one that is entered in ilidata.xml to find the topping for it).
![image](https://user-images.githubusercontent.com/28384354/189112427-0a939dba-fa1f-4570-afc4-3709528116fc.png)
Layer Export Settings
The layer tree structure (with the info if the layer/group is expanded and feature count etc.) is taken from the current project setting.
The information if QML style should be provided (and with it what categories) or a QLR definition or just the source of a layer can be chosen on this page.
![image](https://user-images.githubusercontent.com/28384354/189112535-9410e819-2e44-414f-9fd5-594ad685d9c4.png)
Reference Data
The reference data to be linked (like catalogue data files) can be chosen over the file browser from the local machine or over the online repositories to add just the link to a public file.
![image](https://user-images.githubusercontent.com/28384354/189113008-61cd1f25-f218-4802-87d2-e2584cdc8470.png)
ili2db Settings
You can choose from what database schema the ili2db settings should be parsed. Only the parameters used by the Model Baker are currently parsed, since all others cannot be used anyway yet (because ili2db does not yet support the passing of the metaconfiguration file).
![image](https://user-images.githubusercontent.com/28384354/189113293-71148b30-4f81-4576-a74a-4e2e0db5f2fe.png)
This settings cannot be changed (maybe in future). But you can append a local Extra Model Information Files (TOML/INI) and SQL-scripts.
Generation of ilidata.xml
A local ilidata.xml is created indexing all the files.
Library Backend
The backend of the exporter is part of the [modelbaker](https://github.com/opengisch/QgisModelBakerLibrary) backend library in the sub-package `ilitoppingmaker`.
This is a small example how to interact with it:
python
import os
import tempfile
from qgis.core import QgsProject
import modelbaker.utils.db_utils as db_utils
from modelbaker.ilitoppingmaker import (
ExportSettings,
IliData,
IliProjectTopping,
IliTarget,
MetaConfig,
)
from modelbaker.iliwrapper.globals import DbIliMode
from modelbaker.iliwrapper.ili2dbconfig import Ili2DbCommandConfiguration
prepare target
basetestpath = tempfile.mkdtemp()
testdatapath = "/home/freddy/tests/testdata"
maindir = os.path.join(basetestpath, "freddys_repository")
subdir = "freddys_projects/this_specific_project"
target = IliTarget(
"freddys",
maindir,
subdir,
None,
"mailto:freddy",
"27-09-2022",
"27-09-2022",
)
prepare metaconfig
metaconfig = MetaConfig()
configuration = Ili2DbCommandConfiguration()
configuration.dbfile = "/home/freddy/tests/testdata/data.gpkg"
configuration.tool = DbIliMode.ili2gpkg
db_connector = db_utils.get_db_connector(configuration)
if db_connector:
metaconfig.ili2db_settings.parse_parameters_from_db(db_connector)
metaconfig.ili2db_settings.metaattr_path = os.path.join(testdatapath, "toml/KbS_V1_5.toml")
metaconfig.ili2db_settings.prescript_path = ""
metaconfig.ili2db_settings.postscript_path = (
"ilidata:postscript_from_another_repo"
)
prepare exportsettings
export_settings = ExportSettings()
export_settings.set_setting_values(
ExportSettings.ToppingType.QMLSTYLE, None, "Layer One", True
)
export_settings.set_setting_values(
ExportSettings.ToppingType.DEFINITION, None, "Layer Three", True
)
export_settings.set_setting_values(
ExportSettings.ToppingType.SOURCE, None, "Belasteter_Standort", True
)
now do the automatic way
topping = IliProjectTopping(target, export_settings, metaconfig)
ilidata_path = topping.makeit(QgsProject.instance())
print(f"Exported ilidata to {ilidata_path}")
The `ilitoppingmaker` extends another public package called [`toppingmaker`](https://github.com/opengisch/toppingmaker) that can be used for non-INTERLIS purposes as well.
Sponsors
This feature has been financed by a friendly collaboration of the cantons Schaffhausen, Appenzell Innerhoden and Schwyz
Validator Improvements
The Data Validator received some additional functionality.
![image](https://user-images.githubusercontent.com/28384354/189115877-9fb2a7c5-604a-4b4b-ba0e-9d922775f0ee.png)
Exclude the GeometryCheck from validation
In case you want first fix all the other checks before you care about the geometry errors, you can simply turn it off. This implements the parameter `--skipGeometryErrors`.
Pass a validation config file to control other checks
With a validation config file (INI) you can pass some other parameters to ili2db like e.g.:
- deactivates mandatory constraints: `multiplicity="off"`
- deactivates reference constraint: `target="off"`
- deactivates type constraints: `type="off"`
- deactivates logical constraints: `constraintValidation="off"`
See full documentation here https://github.com/claeis/ilivalidator/blob/master/docs/ilivalidator.rst#konfiguration
Copy text for further use and nice features to zoom and pan
By right-click it's possible to get the error message for further use.
With the buttons on bottom right, you can use the "zoom" and "pan" functionality, like you are used to it from the QGIS Attribute Table.
![output](https://user-images.githubusercontent.com/28384354/189118231-ec0972d2-6203-40dc-b21a-5acd01a58eef.gif)
Sponsors
This feature has been financed by Metron Raumentwicklung AG
Fixes
- Beware order of fields from PostgreSQL https://github.com/opengisch/QgisModelBakerLibrary/pull/25 (sponsored by Kanton Schaffhausen)
- Only use linking relation editor on relations not targeting geometry layers https://github.com/opengisch/QgisModelBakerLibrary/pull/19
- Check if source is not none before checking if it's valid https://github.com/opengisch/QgisModelBaker/pull/716
ili2db