qgserde - v0.3.1
    Preparing search index...

    Function serializeQgs

    • Write a model as QGS XML for a specified QGIS 3 or 4 version.

      The same model can be written for different versions without mutation. Known format differences are converted; unknown data and order are reconstructed from extensions. Features unavailable in the target QGIS are not substituted, and compatibility of the entire project is not checked.

      Parameters

      Returns string

      XML string. An XML declaration, when present, specifies UTF-8 encoding.

      QgsError INVALID_VERSION for an invalid target, or INVALID_EDIT for duplicate IDs, cycles, non-finite numbers, edits that would lose data, project property keys that QGIS 3 cannot store, or other invalid model data.

      const project = createProject({ title: "Regional map" });
      const qgis3 = serializeQgs(project, { version: "3.44" });
      const qgis4 = serializeQgs(project, { version: "4.2" });