Create QGIS projects from database schemas or Interlis models
Using modelbaker library 1.3.4
Using modelbaker library 1.3.3
Using modelbaker library 1.3.2
dataSource
. Avoids trouble with invalid layers on UsabILIty Hub Topping Exporter. Fixes #726Using modelbaker library 1.3.1
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.
A new wizard provides the functionality to export the current project to UsabILIty Hub topping.
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.
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).
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.
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.
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).
This settings cannot be changed (maybe in future). But you can append a local Extra Model Information Files (TOML/INI) and SQL-scripts.
A local ilidata.xml is created indexing all the files.
The backend of the exporter is part of the modelbaker backend library in the sub-package ilitoppingmaker
.
This is a small example how to interact with it:
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
that can be used for non-INTERLIS purposes as well.
This feature has been financed by a friendly collaboration of the cantons Schaffhausen, Appenzell Innerhoden and Schwyz
The Data Validator received some additional functionality.
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
.
With a validation config file (INI) you can pass some other parameters to ili2db like e.g.:
multiplicity="off"
target="off"
type="off"
constraintValidation="off"
See full documentation here https://github.com/claeis/ilivalidator/blob/master/docs/ilivalidator.rst#konfiguration
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.
This feature has been financed by Metron Raumentwicklung AG
Using ili2db version 4.9.0
Using modelbaker library 1.3.0
#722
Using modelbaker library 1.2.5
Using modelbaker library 1.2.4
--exportTid
in data validationUsing modelbaker library 1.2.0
Using modelbaker library 1.1.2