Skip to content

Instantly share code, notes, and snippets.

@signedav
Last active July 15, 2022 11:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save signedav/f863407fce3ea35b42e424c697ba2844 to your computer and use it in GitHub Desktop.
Save signedav/f863407fce3ea35b42e424c697ba2844 to your computer and use it in GitHub Desktop.
QGIS Model Baker - UsabILIty Hub Exporter

UsabIlity Hub Exporter

This is the original started concept, containing a lot of general thoughts. For the final concept see: https://gist.github.com/signedav/44b12b6667c707f646dc6177e026ac56

1. Create UsabILIty Meta Data

We will have a new wizard - and not to insert it into the existing workflow wizard, since it's kind of an operator functionality and the normal user should not be confronted to much with it - with an own button / menu entry.

image

In this example I removed the "old" buttons, to see how it will look in the future.

2. Select Target Folders

You can select a local folder. This can be an existing folder or a freshly created one (better create a new one). Untitled-2022-01-26-0751(10) https://excalidraw.com/#json=7B4H1rxmfMBCrSr89Psim,rXJ2tZ8B84loaJXdqjzFeg

In the target folder the ilidata.xml is created. All the exported topping files are stored in the project subfolder.

Means the relative path from the ilidata.xml go to the project subfolder. When there is no project subfolder defined, the topping subfolders are stored directly in the target folder.

Fix folder structure will be created

Example with project subfolder (best practice)

wildruhezonen/
├─ ilidata.xml
├─ freddys_wildruhezonen_projekt
   ├─ metaconfig/
   │  ├─ fred_wrz_config.ini
   ├─ qml/
   │  ├─ fred_wrz_routennetz.qml
   │  ├─ fred_wrz_teilgebiet.qml
   ├─ sql/
   │  ├─ thescript.sql

Maybe the user does not want to have the projects in the main directory. Another approach would be:

wildruhezonen/
├─ ilidata.xml
├─ usabilityhub_toppings
   ├─ freddys_wildruhezonen_projekt
      ├─ metaconfig/
      │  ├─ fred_wrz_config.ini
      ├─ qml/
      │  ├─ fred_wrz_routennetz.qml
      │  ├─ fred_wrz_teilgebiet.qml
      ├─ sql/
      │  ├─ thescript.sql

Example with no project subfolder

wildruhezonen/
├─ ilidata.xml
├─ metaconfig/
│  ├─ fred_wrz_config.ini
├─ qml/
│  ├─ fred_wrz_routennetz.qml
│  ├─ fred_wrz_teilgebiet.qml
├─ sql/
   ├─ thescript.sql


Additional info and thoughts

  • Update workflows of existing ilidata.xml / metaconfiguration files is very complex and should be set on hold for the moment
  • Technicalliy it's possible to have the ilidata.xml for each projet in a subfolder and connected with an ilisite.xml. But it's not that nice, since it leads to a lot of network requests.

3. Model Selection

Choose the models (detected by Model Baker in all the source schemas) you want to connect to your metaconfiguration. Untitled-2022-01-26-0751(3) https://excalidraw.com/#json=1BzrBLUgJ2WypYYBFJTdO,nWM0PA1l4sZExVeFdKNXMQ

4. Layer Tree

The Layer Tree is loaded from the project. Untitled-2022-01-26-0751(13) https://excalidraw.com/#json=nxZW7bU2G5Q3qaaqjY_Ed,EsnLGrNhzF-rnlnJ3IRCwA

Left part is static - lists all the available layers (and groups) - with markers (color or icon) what source it is (internal like PG, external like WMS or INTERLIS based).

Properties according to the setting on this page

  • Choose if the layer should be exported (if no, it's the same like it would not exist in the project)
  • QML and what parts of it
  • QLR (when activated then QML and Source turns off)
  • Source (maybe not)

Properties according to the settings of the current layer tree (in the QGIS project)

  • Visibility
  • Feature Count
  • Mutual Exclusive
  • Layer Order

Additional info and thoughts

  • Not having source as option
  • I decided against two pages (internal and INTERLIS stuff), to have everything together.
  • Maybe we can bring a warning that internal stuff is exported.
  • How can we use files from other repositories (like QMLs etc)? Well, we can't. Is it really used? Mnot really. Vor allem sind dann einzelne Metaconfig abhängig von anderen. Wobei evtl. use case da, wenn Bund zu allen seinen Layern QMLs bereitstellt. This is something for the sweet future.

5. Relations

  • List only relations concerning layers that are exported (concerning setting in 4. Layer Tree)
  • List only relations not created by the Model Baker (only if possible)

Untitled-2022-01-26-0751(11) https://excalidraw.com/#json=-vcoWZ2jdsFI0cAp-WA3d,zabwYO03M8mWNWWUbsc-jg

6. Reference Data

Add local data files

Being able to select a file (e.g. catalogue) somewhere local and add it to the export. This means it's copied to the "referenceData" folder and added to the ilidata.xml and the metaconfiguration file.

Untitled-2022-01-26-0751(8) https://excalidraw.com/#json=2diQNPzFeUgn1IoG0AA-J,aNj761_gxtOp7Jd40fLITA

Add catalogue (ilidata-ids of it) linked in the ilidata.xml directly

As well it scans the repositories for all linked models (more info about it here)

The catalogues linked in the ilidata.xml to the model directly (without a metaconfiguration) are possible to be chosen in the Model Baker Workflow Wizard after importing an INTERLIS model. Still the user is not "forced" to use it. On having it in the metaconfiguration file with UsabILIty Hub, it's automatically added. So it would make sence to choose here the files and link it in the metaconfiguration file.


Additional info and thoughts

  • Hinzufügen einer URL bzw. einer Online-Ressource, die dann "direkt" verlinkt wird. Nicht sicher ob dies dem Konzept entspricht. Müsste mal mit Claude angeschaut werden.

7. Metaconfiguration

If there is only one schema that the INTERLIS layers are based on, it takes all the settings from there and writes it to the metaconfiguration file. No settings can be made and this page will not appear. Untitled-2022-01-26-0751(14)

https://excalidraw.com/#json=82oB9V6eZKVi4CIQECAUr,fgw2LiLuembzB8t9itBr9g

If there are more than one schema that the INTERLIS layers are based on, there will be a dropdown list to choose from what schema the settings schould be taken from. Btw. when multiple models with different settings are imported, the settings of the first import persists in the database.

8. Generate everything

  • Toppings are generated
  • Internal Ids are created in the layer tree
  • Toppings are linked in the layer tree
  • Relations are set according to the ids and stored in the layer tree
  • The Metaconfig File is generated and the layer tree is referenced
  • The ilidata.xml is created with all the data and the models as the categories of the metaconfiguration

Additional info and thoughts

Idea for the future: There could be a functionality loading one ilidata.xml and another and merging them together. Maybe with ili2db - maybe with other functionality. But not scope of this implementation.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment