Hi,

I’m currently exploring how to use an LLM/AI to generate valid QGIS .qml
styles from natural-language prompts. One difficulty I’ve encountered is
that, as far as I know, there is no formal or exhaustive schema for the QML
format describing both the XML hierarchy and the semantics of all elements,
attributes, renderers, symbol layers, labeling settings, etc. I’m currently
investigating whether PyQGIS can be used to discover this information
programmatically. I can create QGIS objects, serialize them using QGIS
itself, and recursively inspect the resulting DOM. This provides
information about the actual XML hierarchy, attributes, default values, and
property definitions. Before going further, however, I wanted to ask the
QGIS developers whether there is a more canonical approach.

In particular:

   1. Is there an existing source of truth for the QML structure/schema
   that I may have missed?
   2. Is the QML format intentionally undocumented/non-schema-based, with
   the QGIS C++ serialization code effectively serving as the authoritative
   specification?
   3. Would using PyQGIS to instantiate the different renderers, symbol
   layers, labeling configurations, etc., and then inspecting their
   QDomDocument serialization be a reasonable way to generate a
   machine-readable schema?
   4. Are there particular QGIS APIs or parts of the source tree that you
   would recommend for this purpose?

I’d appreciate any advice on whether this is the right direction, or
whether there is a more appropriate way to obtain or generate such a schema
from QGIS itself.
_______________________________________________
QGIS-Developer mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to