KGA Schema Toolsផ្ទាំងអន្តរកម្ម

Domain & Schema Manager

បង្កើត កែសម្រួល និងប្រើឡើងវិញនូវ field domains — បញ្ជីតម្លៃដែលអនុញ្ញាតនៅកម្រិតមូលដ្ឋានទិន្នន័យ ដែលបញ្ជា value-map widget ក្នុងទម្រង់គុណលក្ខណៈ។

រកឃើញនៅឯណា
Processing ▸ Toolbox ▸ KGA Toolbox ▸ KGA Schema Tools ▸ Domain & Schema Manager
លេខសម្គាល់ algorithm
kga:domain_manager
ប្រភេទឧបករណ៍
Interactive dialog — modeless, needs the QGIS window

ទិដ្ឋភាពទូទៅ

QGIS can create a domain from the Browser panel, but not edit one afterwards, not attach one to many fields at once, and not move a set of domains between containers. This tool does all three, in three tabs: Domains (define them), Assignment (attach them), Library (move them).

The tool is promoted onto the KGA toolbar as its own button. Opening it while a GeoPackage-backed layer is active loads that GeoPackage straight away.

ប៉ារ៉ាម៉ែត្រ

The algorithm takes no Processing parameters — running it opens the window. The controls below are the window's.

Container (above the tabs)

Parameters for Domain & Schema Manager — Container (above the tabs)
ផ្ទាំងគ្រប់គ្រងប្រភេទតម្លៃលំនាំដើមការពិពណ៌នា
GeoPackage / GeodatabasePath box, drop targetthe active layer's .gpkg, if anyThe container being worked on. Type a path, use Browse…, or drag a .gpkg here from the Browser panel.
Browse… / ReloadButtonsReload re-reads the container from disk.
Copy container…Button (in the warning strip)Saves a copy of the whole GeoPackage — every layer and every domain together. Appears when it matters; see the notes.

Tab 1 — Domains

Parameters for Domain & Schema Manager — Tab 1 — Domains
ផ្ទាំងគ្រប់គ្រងប្រភេទតម្លៃលំនាំដើមការពិពណ៌នា
Domain listListEvery domain in the container.
New / Duplicate / DeleteButtonsDefine a new domain, copy the selected one under a new name, or remove it.
NameTextThe domain's name, as stored in the container.
DescriptionTextemptyFree text.
Domain typeCombo boxCoded valuesCoded values, Range, Glob pattern.
Field typeCombo boxThe attribute type the domain constrains.
Used byLabelA live count of the fields currently using this domain.
Coded values tableTable (Code, Label)With Add, Remove, Move up, Move down and Paste list… — the last one takes a list off the clipboard, which is how most domains actually get built.
Range boxSpin boxes and checkboxesboth bounds on, both inclusiveHas a minimum / Has a maximum with their values, and Minimum is included / Maximum is included.
Glob pattern boxTextemptyA wildcard pattern such as K-*.
Revert / Save domainButtonsDiscard the edits in the form, or write the domain to the container.

Tab 2 — Assignment

Parameters for Domain & Schema Manager — Tab 2 — Assignment
ផ្ទាំងគ្រប់គ្រងប្រភេទតម្លៃលំនាំដើមការពិពណ៌នា
FilterText boxemptyNarrows the grid by layer or field name.
Assignment gridTable (Layer, Field, Domain)current stateEvery layer and field in the container, with the domain each carries. Change the Domain cell to attach or detach one.
Apply to all matching field namesButtonGives every field with the same name as the selected row the same domain. The same column recurs across layers — status, owner, material — so this is usually what you want.
Revert / Apply assignmentsButtonsThrow away the pending changes, or write them.

Tab 3 — Library

Parameters for Domain & Schema Manager — Tab 3 — Library
ផ្ទាំងគ្រប់គ្រងប្រភេទតម្លៃលំនាំដើមការពិពណ៌នា
Include field assignmentsCheckboxtickedExport which fields use each domain, not just the domains.
Export library…ButtonWrites this container's domains to a JSON file you can version and reuse.
ModeCombo boxMerge — add and update, keep the restOr Replace — make this container match exactly.
Attach each domain to every field with a matching nameCheckboxtickedAs on the Assignment tab, applied during the import.
Preview a library…ButtonReports what an import would change, writing nothing.
Import a library…ButtonPerforms the import.
Result logRead-only textemptyWhere the outcome of a preview or an import appears.

របៀបប្រើ

  1. Click a layer stored in the GeoPackage you want to work on, then open KGA Schema Tools > Domain & Schema Manager (or press its toolbar button). That GeoPackage is loaded for you. Close the Processing window once the pane appears.
  2. If it opened on nothing, drag a .gpkg onto the path box from the Browser panel or use Browse…. A large container takes a moment to read.
  3. On Domains, press New and fill in the definition: name, domain type, field type, then the coded values, range or glob. Paste list… takes a list off the clipboard, which is the quickest way to build a coded domain. Press Save domain.
  4. On Assignment, find a field and set its Domain cell. Then press Apply to all matching field names to give every same-named field across the container the same domain. Press Apply assignments to write them.
  5. On Library, press Export library… to save the whole set as JSON you can version and reuse. To bring one in, choose the Mode, press Preview a library… first to see what would change, then Import a library….
  6. Run Validate Against Domains afterwards — the data already in the container was never checked against the new rules.

លទ្ធផល

Nothing is returned to Processing — the tool writes into the container:

  • Domains created, renamed, retyped or deleted in the GeoPackage.
  • Domain assignments written onto layer fields, so the attribute form shows the drop-down.
  • A JSON domain library file, when you export one. That file is what Apply Domain Library consumes.

កំណត់សម្គាល់ និងដែនកំណត់

  • Editing needs a GeoPackage. A File Geodatabase can be read and exported to a library, but not written to.
  • Domains belong to the whole GeoPackage, not to one layer. Exporting a single layer with Save Features As… can leave its domains behind. Use Copy container… to share or back up the data with the domains intact — this is what the yellow strip in the window is warning about.
  • Opening a container reads every layer's fields, so a large container takes a noticeable moment to load. The busy overlay reports progress.
  • The window stays open. Close the Processing dialog behind it and keep working. Running the tool again while it is open raises it; running it after you closed it starts clean, without the previous container loaded.
  • Changing a domain does not re-check data that is already there. Run Validate Against Domains afterwards to find values the new rule rejects.
  • For repeating this work — in a model, in batch, or from processing.run() — use Apply Domain Library instead. The dialog is for exploring; the algorithm is for repeating.
  • The tool cannot run headless — it needs the QGIS main window.

មើលផងដែរ

ត្រឡប់ទៅឯកសារណែនាំ