Skip to content

Instantly share code, notes, and snippets.

@signedav
Last active August 26, 2022 10:57
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/44b12b6667c707f646dc6177e026ac56 to your computer and use it in GitHub Desktop.
Save signedav/44b12b6667c707f646dc6177e026ac56 to your computer and use it in GitHub Desktop.
QGIS Model Baker - UsabILIty Hub Exporter Final Concept

UsabIlity Hub Exporter Final Concept

Final concept only containing things that will be implemented and addtional notes how the technical implementation could be.

1. Create UsabILIty Meta Data

New wizard with an own button / menu entry.

image

2. Select Target Folders

You can select a local folder. This can be an existing folder or a freshly created 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.

It needs a warning when the target folder already exists like "Target folder already exists. Be aware existing topping files and ilidata will be overwritten".

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.

There should be the possibility to add nested subfolders like usabilityhub_toppings/freddys_wildruhezonen_projekt. Be aware of / and \.

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


Result We do have in the exporter-config:

  • targetfolder
  • subfolder(s)

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


Result We do have in the exporter-config:

  • list of modelnames

4. Layer Tree

The Layer Tree is flat 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 that can be set per layer

  • 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

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

  • Visibility
  • Feature Count
  • Mutual Exclusive
  • Source type (Interlis, PG, WFS) for visualization

Properties of the whole project

  • Layer Order
  • (Project Variables not yet included)
  • (Print Layout not yet included)
  • (Map Themes not yet included)

Result All those settings are made in a layertree-model object.

We do have in the exporter-config:

  • a layertree object maybe - think about it Dave

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)


Result We do have in the exporter-config:

  • a list of referencedfiles (ids or local file paths)

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.


Result We do have in the exporter-config:

  • provider
  • uri

8. Generate everything

  • Topping files are generated
    • create folder structure
    • go through layer tree, export topping files, store path to layertree, and generate ids
  • Internal Ids are created in the layer tree
  • Toppings are linked 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
soll auf das QGIS Projekt verwiesen werden. die layer etc. oder der komplette tree zwischengespeichert werden? model baker legend reversed oder sowas? 

**LAYERTREE etc.**
1. Read all layers and properties
2. Config layers
3. Export layertree and apply layers

oder 

1. Read layertree to a layertree object
2. Scan it for layers and apply the config
3. Create YAML from layer tree

layers[
{
]
layertree:
    - "KbS_LV95_V1_4 Layers":
        group: true
        child-nodes:
            - "Belasteter_Standort (Geo_Lage_Punkt)":
                qmlstylefile: ../layerstyle/opengisch_KbS_LV95_V1_4_004_belasteterstandort_punkt.qml
            - "Parzellenidentifikation":
                qmlstylefile: ilidata:ch.opengis.topping.opengisch_KbS_LV95_V1_4_005
    - "Other Layers":
        group: true

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