@vectoriahq/quac 0.22.0-next.1 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -87,6 +87,12 @@ export declare const QUAC_MUTUALLY_EXCLUSIVE_FIELD = "quac:mutually_exclusive";
87
87
  export declare const QUAC_ACTIVE_COLLECTION_FIELD = "quac:active_collection";
88
88
  /** The project's print layouts, on the top-level Catalog: each as its name and its QGIS layout template. */
89
89
  export declare const QUAC_PRINT_LAYOUTS_FIELD = "quac:print_layouts";
90
+ /** The colour the source names as its brand, on the top-level Catalog, as `#rrggbb`. */
91
+ export declare const QUAC_BRAND_COLOR_FIELD = "quac:brand_color";
92
+ /** The key a top-level Catalog lists the source's layers left out of it under, each with its id, title and reason. */
93
+ export declare const QUAC_LEFT_OUT_FIELD = "quac:left_out";
94
+ /** The key an `icon` link takes for the theme its image is for: `dark` for the logo shown in a dark theme. */
95
+ export declare const QUAC_THEME_FIELD = "quac:theme";
90
96
  /**
91
97
  * One relation a Collection declares in `quac:related_to`: the parent
92
98
  * Collection its records hang off, the field pair(s) joining them, and the name
@@ -155,6 +161,11 @@ export interface NormalizedLayer {
155
161
  bbox: NormalizedBbox | null;
156
162
  /** The geometry type as QGIS names it, written as `quac:geometry_type`. */
157
163
  geometryType: string | null;
164
+ /**
165
+ * Every geometry type, in order, for a Collection made from QGIS's per-shape
166
+ * layers, written as `quac:geometry_type` in place of `geometryType`.
167
+ */
168
+ geometryTypes?: readonly string[] | null;
158
169
  /**
159
170
  * The WKB type names the layer's features take, such as `MultiPolygon` or
160
171
  * `PointZ`: one for most layers, one per shape for a file the project splits
@@ -264,6 +275,8 @@ export interface NormalizedProject {
264
275
  activeCollectionId?: string | null;
265
276
  /** Vendor-namespaced fields copied straight onto the top-level Catalog. */
266
277
  vendorFields?: Record<string, unknown>;
278
+ /** Links the top-level Catalog carries after its own, such as its logo's `icon` links. */
279
+ links?: StacLink[];
267
280
  /**
268
281
  * Project-wide providers — the project's own author, say — merged onto
269
282
  * every Collection the tree produces, alongside whatever that layer
@@ -320,6 +333,36 @@ export declare function readCatalogueActiveCollection(catalog: StacCatalog): str
320
333
  * not a `<Layout>` element, is not read. Empty where the Catalog lists none.
321
334
  */
322
335
  export declare function readCataloguePrintLayouts(catalog: StacCatalog): PrintLayoutTemplate[];
336
+ /** The top-level Catalog's `quac:brand_color`, as `#rrggbb` in lower case, or null where it has none or it is not that form. */
337
+ export declare function readCatalogueBrandColor(catalog: StacCatalog): string | null;
338
+ /** A logo a top-level Catalog links: its address and, where the link gives it, its media type. */
339
+ export interface CatalogueLogo {
340
+ href: string;
341
+ type?: string;
342
+ }
343
+ /**
344
+ * The logos a top-level Catalog links with `rel: "icon"`: `light`, the first
345
+ * with no `quac:theme`, and `dark`, the first whose `quac:theme` is `dark`.
346
+ * Each is null where the Catalog links none.
347
+ */
348
+ export declare function readCatalogueLogos(catalog: StacCatalog): {
349
+ light: CatalogueLogo | null;
350
+ dark: CatalogueLogo | null;
351
+ };
352
+ /** Why a source's layer was left out of its catalogue, as `quac:left_out` gives it. */
353
+ export type LeftOutReason = 'outside_folder' | 'not_a_file' | 'holds_credentials' | 'not_opened' | 'not_copied' | 'copy_failed';
354
+ /** A layer `quac:left_out` names: the id its Collection would have had, its title, and why it was left out. */
355
+ export interface LeftOutLayer {
356
+ id: string;
357
+ title: string;
358
+ reason: LeftOutReason;
359
+ }
360
+ /**
361
+ * The layers a top-level Catalog lists in `quac:left_out`, in its order. An
362
+ * entry without a string id and title, or with a reason this package does
363
+ * not know, is not read. Empty where the Catalog lists none.
364
+ */
365
+ export declare function readCatalogueLeftOut(catalog: StacCatalog): LeftOutLayer[];
323
366
  export declare function readCatalogueInitialView(catalog: StacCatalog): NormalizedBbox | null;
324
367
  /**
325
368
  * Reads shared source declarations back off a Collection.
@@ -463,6 +506,12 @@ export declare function readCollectionIdentifiable(collection: StacCollection):
463
506
  export declare function readCollectionVisibility(collection: StacCollection | StacCatalog): boolean | null;
464
507
  /** The layer's geometry type as QGIS names it ("Point", "Line", "Polygon", "No geometry"); null when the source gives none. */
465
508
  export declare function readCollectionGeometryType(collection: StacCollection): string | null;
509
+ /**
510
+ * Every geometry type a Collection's summaries give, in order: one for a
511
+ * layer, and one per shape for a Collection made from QGIS's per-shape layers.
512
+ * Empty where it gives none.
513
+ */
514
+ export declare function readCollectionGeometryTypes(collection: StacCollection): string[];
466
515
  /** The scales the source draws the layer between; null when it sets no limit. */
467
516
  export declare function readCollectionScaleRange(collection: StacCollection): LayerScaleRange | null;
468
517
  /**
@@ -97,6 +97,12 @@ const INITIAL_VIEW_FIELD = 'quac:initial_view';
97
97
  export const QUAC_ACTIVE_COLLECTION_FIELD = 'quac:active_collection';
98
98
  /** The project's print layouts, on the top-level Catalog: each as its name and its QGIS layout template. */
99
99
  export const QUAC_PRINT_LAYOUTS_FIELD = 'quac:print_layouts';
100
+ /** The colour the source names as its brand, on the top-level Catalog, as `#rrggbb`. */
101
+ export const QUAC_BRAND_COLOR_FIELD = 'quac:brand_color';
102
+ /** The key a top-level Catalog lists the source's layers left out of it under, each with its id, title and reason. */
103
+ export const QUAC_LEFT_OUT_FIELD = 'quac:left_out';
104
+ /** The key an `icon` link takes for the theme its image is for: `dark` for the logo shown in a dark theme. */
105
+ export const QUAC_THEME_FIELD = 'quac:theme';
100
106
  /**
101
107
  * Records where a catalogue came from as the Catalog's `self` link, so the
102
108
  * document says it rather than a reader holding it alongside. Sources with no
@@ -129,7 +135,8 @@ export function generateStacFromNormalized(project) {
129
135
  links: [
130
136
  { rel: 'self', href: './catalog.json' },
131
137
  { rel: 'root', href: './catalog.json' },
132
- ...links
138
+ ...links,
139
+ ...(project.links ?? [])
133
140
  ]
134
141
  };
135
142
  if (project.bbox) {
@@ -218,8 +225,9 @@ function buildCollection(layer, defaultProviders, folder) {
218
225
  if (Object.values(layer.assets).some((asset) => typeof asset[PROJ_CODE] === 'string'))
219
226
  stacExtensions.push(PROJECTION_EXTENSION);
220
227
  const summaries = {};
221
- if (layer.geometryType)
222
- summaries['quac:geometry_type'] = [layer.geometryType];
228
+ const geometryTypes = layer.geometryTypes ?? (layer.geometryType ? [layer.geometryType] : []);
229
+ if (geometryTypes.length > 0)
230
+ summaries['quac:geometry_type'] = [...geometryTypes];
223
231
  const providers = [...defaultProviders, ...(layer.providers ?? [])];
224
232
  const collection = {
225
233
  type: 'Collection',
@@ -399,6 +407,43 @@ export function readCataloguePrintLayouts(catalog) {
399
407
  return typeof name === 'string' && typeof template === 'string' && /^<Layout[\s/>]/.test(template) ? [{ name, template }] : [];
400
408
  });
401
409
  }
410
+ /** The top-level Catalog's `quac:brand_color`, as `#rrggbb` in lower case, or null where it has none or it is not that form. */
411
+ export function readCatalogueBrandColor(catalog) {
412
+ const value = catalog[QUAC_BRAND_COLOR_FIELD];
413
+ return typeof value === 'string' && /^#[0-9a-f]{6}$/i.test(value) ? value.toLowerCase() : null;
414
+ }
415
+ /**
416
+ * The logos a top-level Catalog links with `rel: "icon"`: `light`, the first
417
+ * with no `quac:theme`, and `dark`, the first whose `quac:theme` is `dark`.
418
+ * Each is null where the Catalog links none.
419
+ */
420
+ export function readCatalogueLogos(catalog) {
421
+ const icons = (catalog.links ?? []).filter((link) => link.rel === 'icon' && typeof link.href === 'string' && link.href !== '');
422
+ const logo = (link) => link ? { href: link.href, ...(typeof link.type === 'string' ? { type: link.type } : {}) } : null;
423
+ return {
424
+ light: logo(icons.find((link) => link[QUAC_THEME_FIELD] === undefined)),
425
+ dark: logo(icons.find((link) => link[QUAC_THEME_FIELD] === 'dark'))
426
+ };
427
+ }
428
+ const LEFT_OUT_REASONS = new Set(['outside_folder', 'not_a_file', 'holds_credentials', 'not_opened', 'not_copied', 'copy_failed']);
429
+ /**
430
+ * The layers a top-level Catalog lists in `quac:left_out`, in its order. An
431
+ * entry without a string id and title, or with a reason this package does
432
+ * not know, is not read. Empty where the Catalog lists none.
433
+ */
434
+ export function readCatalogueLeftOut(catalog) {
435
+ const value = catalog[QUAC_LEFT_OUT_FIELD];
436
+ if (!Array.isArray(value))
437
+ return [];
438
+ return value.flatMap((entry) => {
439
+ if (!entry || typeof entry !== 'object')
440
+ return [];
441
+ const { id, title, reason } = entry;
442
+ return typeof id === 'string' && id !== '' && typeof title === 'string' && typeof reason === 'string' && LEFT_OUT_REASONS.has(reason)
443
+ ? [{ id, title, reason: reason }]
444
+ : [];
445
+ });
446
+ }
402
447
  export function readCatalogueInitialView(catalog) {
403
448
  const value = catalog[INITIAL_VIEW_FIELD];
404
449
  if (!Array.isArray(value) || value.length !== 4)
@@ -851,6 +896,15 @@ export function readCollectionGeometryType(collection) {
851
896
  const value = Array.isArray(summary) ? summary[0] : null;
852
897
  return typeof value === 'string' ? value : null;
853
898
  }
899
+ /**
900
+ * Every geometry type a Collection's summaries give, in order: one for a
901
+ * layer, and one per shape for a Collection made from QGIS's per-shape layers.
902
+ * Empty where it gives none.
903
+ */
904
+ export function readCollectionGeometryTypes(collection) {
905
+ const summary = collection.summaries?.['quac:geometry_type'];
906
+ return Array.isArray(summary) ? summary.filter((value) => typeof value === 'string') : [];
907
+ }
854
908
  /** The scales the source draws the layer between; null when it sets no limit. */
855
909
  export function readCollectionScaleRange(collection) {
856
910
  const minScale = readScaleDenominator(collection['quac:min_scale']);
@@ -23,7 +23,8 @@ import type { StacCatalog, StacCollection } from '../model/Stac.ts';
23
23
  * where the project publishes the layer for WFS, and a WMS link always, in
24
24
  * the CRS `chooseWmsCrs` picks from `serverWmsCrsList`. No
25
25
  * file path, style asset, `via` link or detail of the layer's own data source
26
- * is written, nor an Attachment widget's default folder.
26
+ * is written, nor an Attachment widget's default folder, nor the logo's
27
+ * `icon` links, which name files beside the project.
27
28
  * - A field the project hides from WMS or from WFS is left out of
28
29
  * `table:columns`, and every mention of it is dropped: from the form order,
29
30
  * the preset filters, the display field, a relation's join, and any
@@ -30,7 +30,8 @@ import { chooseWmsCrs, WEB_MAP_LINKS_EXTENSION, WMS_REQUEST_PARAMETERS } from ".
30
30
  * where the project publishes the layer for WFS, and a WMS link always, in
31
31
  * the CRS `chooseWmsCrs` picks from `serverWmsCrsList`. No
32
32
  * file path, style asset, `via` link or detail of the layer's own data source
33
- * is written, nor an Attachment widget's default folder.
33
+ * is written, nor an Attachment widget's default folder, nor the logo's
34
+ * `icon` links, which name files beside the project.
34
35
  * - A field the project hides from WMS or from WFS is left out of
35
36
  * `table:columns`, and every mention of it is dropped: from the form order,
36
37
  * the preset filters, the display field, a relation's join, and any
@@ -86,7 +87,7 @@ export function generateServerStacCatalogue(project, options) {
86
87
  const serveCatalog = (node) => {
87
88
  const collections = (node.collections ?? []).filter((collection) => servedIds.has(collection.id)).map((collection) => serveCollection(collection, context));
88
89
  const catalogs = (node.catalogs ?? []).map(serveCatalog);
89
- const served = { ...node, links: [...node.links.filter((link) => link.rel !== 'child'), ...childLinks(catalogueFolder(node) ?? './', collections, catalogs)] };
90
+ const served = { ...node, links: [...node.links.filter((link) => link.rel !== 'child' && link.rel !== 'icon'), ...childLinks(catalogueFolder(node) ?? './', collections, catalogs)] };
90
91
  delete served.collections;
91
92
  delete served.catalogs;
92
93
  delete served.stac_extensions;
@@ -52,3 +52,11 @@ export interface CatalogueDocument {
52
52
  * Throws where `rootFileName` or `childrenFolder` is not a safe relative path.
53
53
  */
54
54
  export declare function splitCatalogue(catalogue: StacCatalog, options?: SplitCatalogueOptions): CatalogueDocument[];
55
+ /**
56
+ * An id made a file or folder name that is safe on any system: each character
57
+ * a name may not hold, `/` among them, becomes `_`, as does each `.` or space
58
+ * at its end, which Windows drops; an empty name is `_`; and a name Windows
59
+ * keeps for a device, such as `con`, is given a leading `_`. So no name is
60
+ * empty, `.` or `..`.
61
+ */
62
+ export declare function safeName(id: string): string;
@@ -178,7 +178,7 @@ const RESERVED_NAME = /^(con|prn|aux|nul|com[0-9¹²³]|lpt[0-9¹²³])(\.|$)/i;
178
178
  * keeps for a device, such as `con`, is given a leading `_`. So no name is
179
179
  * empty, `.` or `..`.
180
180
  */
181
- function safeName(id) {
181
+ export function safeName(id) {
182
182
  let name = id.replace(UNSAFE_CHARACTERS, '_');
183
183
  // Counted from the end, not matched with /[. ]+$/, which takes time growing with the square of a run of spaces that does not end the id.
184
184
  let kept = name.length;
@@ -35,13 +35,44 @@ export interface StacCompanionData {
35
35
  * as if the project did not hold it, so a relation, Value Relation, filter or
36
36
  * initial active layer naming it is dropped too (`wmsExcludedLayerIds`).
37
37
  */
38
- export declare function generateStacCatalogue(project: QgsProject, companions?: StacCompanionData[], options?: {
38
+ export declare function generateStacCatalogue(project: QgsProject, companions?: StacCompanionData[], options?: StacCatalogueOptions): StacCatalog;
39
+ /** What `generateStacCatalogue` and `generateCatalogueFiles` take beyond the project. */
40
+ export interface StacCatalogueOptions {
39
41
  selfHref?: string;
40
42
  projectPath?: string;
41
43
  projectFileName?: string;
42
44
  initialView?: BoundingBox | null;
43
45
  layerWgs84Extents?: Map<string, BoundingBox>;
44
- }): StacCatalog;
46
+ }
47
+ /** A file a catalogue carries beside its documents, such as a layer's style. */
48
+ export interface CatalogueFile {
49
+ /**
50
+ * Where the file goes, relative to the top-level document's folder: names
51
+ * joined by `/`, not escaped, each safe as a file name on any system. The
52
+ * catalogue's href for it is this path, escaped, after `./`.
53
+ */
54
+ path: string;
55
+ mediaType: string;
56
+ text: string;
57
+ }
58
+ /**
59
+ * A QGIS project's catalogue with the files it carries: the twin of
60
+ * `generateStacCatalogue`, built by the same code, which gives each layer's
61
+ * styles as files of the catalogue's own rather than as addresses into the
62
+ * project file. Each style is a QGIS style document (`.qml`,
63
+ * `LayerStyle.styleDocument`) in `<filesFolder>/styles/<Collection>/`, named
64
+ * after the style, and for a Collection made from QGIS's per-shape layers,
65
+ * after the style and the shape. A folder name is made safe as
66
+ * `splitCatalogue` makes one. `filesFolder`, empty by default, is where a
67
+ * caller writing the catalogue as separate documents puts its other documents,
68
+ * `splitCatalogue`'s `childrenFolder`, so the files sit with them.
69
+ */
70
+ export declare function generateCatalogueFiles(project: QgsProject, companions?: StacCompanionData[], options?: StacCatalogueOptions & {
71
+ filesFolder?: string;
72
+ }): {
73
+ catalogue: StacCatalog;
74
+ files: CatalogueFile[];
75
+ };
45
76
  /**
46
77
  * The key a style asset takes for the field its renderer classifies by, when
47
78
  * that renderer is a categorised one. The project author's declaration.
@@ -66,6 +97,16 @@ export declare function readCollectionGeometryFilter(collection: StacCollection)
66
97
  export declare const QUAC_LAYER_NAME = "quac:layer_name";
67
98
  /** The table a Collection's data asset names, or null where it names none. */
68
99
  export declare function readCollectionLayerName(collection: StacCollection): string | null;
100
+ /** The project variables naming the map's logo, and the logo shown in a dark theme. */
101
+ export declare const LOGO_VARIABLE = "quac_logo";
102
+ export declare const LOGO_DARK_VARIABLE = "quac_logo_dark";
103
+ /**
104
+ * A path relative to the project and inside its folder, with `/` between its
105
+ * names and no `.` names, or null for anything else: an absolute path, a drive,
106
+ * a home folder or an address (`isProjectRelativeFolder`), or a path whose `..`
107
+ * leaves the folder.
108
+ */
109
+ export declare function projectRelativeFile(value: string): string | null;
69
110
  /**
70
111
  * The names QGIS Server would give the layer if it served the project
71
112
  * (`QgsWmsLayerInfos::buildWmsLayerInfos`, `src/server/services/wms/qgswmslayerinfos.cpp`,
@@ -1,5 +1,5 @@
1
1
  import { arcgisQueryAsset } from "./arcgisStacCatalogue.js";
2
- import { QUAC_MEASUREMENT_FIELD, QUAC_PRINT_LAYOUTS_FIELD, slugify, generateStacFromNormalized, unionBboxes, withSelfLink } from "./normalizedProject.js";
2
+ import { QUAC_BRAND_COLOR_FIELD, QUAC_THEME_FIELD, QUAC_MEASUREMENT_FIELD, QUAC_PRINT_LAYOUTS_FIELD, slugify, generateStacFromNormalized, unionBboxes, withSelfLink } from "./normalizedProject.js";
3
3
  import { wfsGetFeatureAsset } from "./wfsStacCatalogue.js";
4
4
  import { delimitedTextField, QUAC_DELIMITED_TEXT } from "../model/delimitedText.js";
5
5
  import { featureFilterField, QUAC_FEATURE_FILTER } from "../model/featureFilter.js";
@@ -10,6 +10,8 @@ import { DEFAULT_STYLE_ROLE, styleAssetKey } from "../model/stacStyles.js";
10
10
  import { buildWmsLink, WEB_MAP_LINKS_EXTENSION } from "../model/stacWms.js";
11
11
  import { buildWmtsLink } from "../model/stacWmts.js";
12
12
  import { buildXyzLink } from "../model/stacXyz.js";
13
+ import { brandColorOf } from "../parse/parseBrandColour.js";
14
+ import { safeName } from "./splitCatalogue.js";
13
15
  import { findGeometrySiblings, readSiblingShapes, siblingCollectionId } from "../parse/geometrySiblings.js";
14
16
  import { findValueRelationLookup, isFilterInProject, isRelationInProject } from "../parse/projectNotes.js";
15
17
  import { declaredMediaTypeForFile, isLayerFileOfFormat, PROJECT_DATA_ROLES, QML_STYLE_MEDIA_TYPE } from "../util/catalogueFileFormats.js";
@@ -38,6 +40,30 @@ import { nameRecord } from "../util/nameRecord.js";
38
40
  * initial active layer naming it is dropped too (`wmsExcludedLayerIds`).
39
41
  */
40
42
  export function generateStacCatalogue(project, companions = [], options = {}) {
43
+ return buildProjectCatalogue(project, companions, options, null);
44
+ }
45
+ /**
46
+ * A QGIS project's catalogue with the files it carries: the twin of
47
+ * `generateStacCatalogue`, built by the same code, which gives each layer's
48
+ * styles as files of the catalogue's own rather than as addresses into the
49
+ * project file. Each style is a QGIS style document (`.qml`,
50
+ * `LayerStyle.styleDocument`) in `<filesFolder>/styles/<Collection>/`, named
51
+ * after the style, and for a Collection made from QGIS's per-shape layers,
52
+ * after the style and the shape. A folder name is made safe as
53
+ * `splitCatalogue` makes one. `filesFolder`, empty by default, is where a
54
+ * caller writing the catalogue as separate documents puts its other documents,
55
+ * `splitCatalogue`'s `childrenFolder`, so the files sit with them.
56
+ */
57
+ export function generateCatalogueFiles(project, companions = [], options = {}) {
58
+ let folder = options.filesFolder ?? '';
59
+ while (folder.endsWith('/'))
60
+ folder = folder.slice(0, -1);
61
+ const styleFiles = { folder: folder ? `${folder}/` : '', files: [], taken: new Set() };
62
+ const catalogue = buildProjectCatalogue(project, companions, options, styleFiles);
63
+ return { catalogue, files: styleFiles.files };
64
+ }
65
+ /** `generateStacCatalogue`, writing each style as a file into `styleFiles` where it is given. */
66
+ function buildProjectCatalogue(project, companions, options, styleFiles) {
41
67
  // `selfHref` is the folder the project was published from, for a project
42
68
  // loaded out of cloud storage. A dragged-in project has no address to record.
43
69
  //
@@ -65,7 +91,7 @@ export function generateStacCatalogue(project, companions = [], options = {}) {
65
91
  // reproject the canvas. `resolveLayerWgs84Extents` in the same file builds
66
92
  // this map; a layer left out of it (or a caller that leaves the option off
67
93
  // entirely) has no box of its own.
68
- return withSelfLink(generateStacFromNormalized(qgsProjectToNormalized(withoutWmsExcludedLayers(project), companions, options.projectPath, options.projectPath ?? options.projectFileName, options.initialView ?? null, options.layerWgs84Extents)), options.selfHref);
94
+ return withSelfLink(generateStacFromNormalized(qgsProjectToNormalized(withoutWmsExcludedLayers(project), companions, options.projectPath, options.projectPath ?? options.projectFileName, options.initialView ?? null, options.layerWgs84Extents, styleFiles)), options.selfHref);
69
95
  }
70
96
  /**
71
97
  * The key a style asset takes for the field its renderer classifies by, when
@@ -100,7 +126,7 @@ export function readCollectionLayerName(collection) {
100
126
  return typeof value === 'string' && value.trim() !== '' ? value : null;
101
127
  }
102
128
  /** Projects a parsed QgsProject into the source-agnostic normalized model. */
103
- function qgsProjectToNormalized(project, companions, projectPath, projectFileName, initialView, layerWgs84Extents) {
129
+ function qgsProjectToNormalized(project, companions, projectPath, projectFileName, initialView, layerWgs84Extents, styleFiles) {
104
130
  const companionByLayerId = new Map();
105
131
  for (const c of companions) {
106
132
  if (c.geojson)
@@ -118,6 +144,7 @@ function qgsProjectToNormalized(project, companions, projectPath, projectFileNam
118
144
  projectPath,
119
145
  projectFileName,
120
146
  layerWgs84Extents,
147
+ styleFiles,
121
148
  relationsByChildLayerId: collectRelationsByChildLayerId(project.relations ?? [], layersById, collectionIdOf),
122
149
  valueRelationsByLayerId: collectValueRelationsByLayerId(project.layers, layersById, collectionIdOf),
123
150
  siblingsById,
@@ -163,12 +190,78 @@ function qgsProjectToNormalized(project, companions, projectPath, projectFileNam
163
190
  activeCollectionId: project.initialActiveLayerId && layersById.has(project.initialActiveLayerId)
164
191
  ? collectionIdOf(project.initialActiveLayerId)
165
192
  : null,
166
- vendorFields: project.printLayouts && project.printLayouts.length > 0
167
- ? { [QUAC_PRINT_LAYOUTS_FIELD]: project.printLayouts.map(({ name, template }) => ({ name, template })) }
168
- : undefined,
193
+ vendorFields: projectVendorFields(project),
194
+ links: projectLogoLinks(project.variables ?? {}),
169
195
  nodes
170
196
  };
171
197
  }
198
+ /** The top-level Catalog's fields the project sets: its print layouts and its Brand colour. */
199
+ function projectVendorFields(project) {
200
+ const fields = {};
201
+ if (project.printLayouts && project.printLayouts.length > 0) {
202
+ fields[QUAC_PRINT_LAYOUTS_FIELD] = project.printLayouts.map(({ name, template }) => ({ name, template }));
203
+ }
204
+ const brandColor = brandColorOf(project.brandColour);
205
+ if (brandColor)
206
+ fields[QUAC_BRAND_COLOR_FIELD] = brandColor;
207
+ return Object.keys(fields).length > 0 ? fields : undefined;
208
+ }
209
+ /** The project variables naming the map's logo, and the logo shown in a dark theme. */
210
+ export const LOGO_VARIABLE = 'quac_logo';
211
+ export const LOGO_DARK_VARIABLE = 'quac_logo_dark';
212
+ /** The logo files a catalogue links, by extension, with the media type of each. */
213
+ const LOGO_MEDIA_TYPES = {
214
+ svg: 'image/svg+xml',
215
+ png: 'image/png',
216
+ jpg: 'image/jpeg',
217
+ jpeg: 'image/jpeg',
218
+ webp: 'image/webp'
219
+ };
220
+ /**
221
+ * The top-level Catalog's `icon` links to the map's logo, from the project
222
+ * variables `quac_logo` and `quac_logo_dark`: the second link carries
223
+ * `quac:theme: "dark"`. Each names a file by its path relative to the
224
+ * project, which the link gives as a data asset's href gives its file. A
225
+ * value that is not such a path, such as an absolute path or an address,
226
+ * leaves the folder, or does not end in a logo's extension, writes nothing,
227
+ * and a dark logo is written only beside a logo.
228
+ */
229
+ function projectLogoLinks(variables) {
230
+ const light = logoLink(variables[LOGO_VARIABLE]);
231
+ if (!light)
232
+ return [];
233
+ const dark = logoLink(variables[LOGO_DARK_VARIABLE]);
234
+ return dark ? [light, { ...dark, title: 'Logo for a dark theme', [QUAC_THEME_FIELD]: 'dark' }] : [light];
235
+ }
236
+ function logoLink(value) {
237
+ const path = projectRelativeFile(value ?? '');
238
+ const mediaType = path ? LOGO_MEDIA_TYPES[path.slice(path.lastIndexOf('.') + 1).toLowerCase()] : undefined;
239
+ return path && mediaType ? { rel: 'icon', href: `./${encodeAssetPath(path)}`, type: mediaType, title: 'Logo' } : null;
240
+ }
241
+ /**
242
+ * A path relative to the project and inside its folder, with `/` between its
243
+ * names and no `.` names, or null for anything else: an absolute path, a drive,
244
+ * a home folder or an address (`isProjectRelativeFolder`), or a path whose `..`
245
+ * leaves the folder.
246
+ */
247
+ export function projectRelativeFile(value) {
248
+ const text = value.trim();
249
+ if (!text || !isProjectRelativeFolder(text))
250
+ return null;
251
+ const names = [];
252
+ for (const name of text.split(/[\\/]/)) {
253
+ if (name === '' || name === '.')
254
+ continue;
255
+ if (name === '..') {
256
+ if (names.length === 0)
257
+ return null;
258
+ names.pop();
259
+ }
260
+ else
261
+ names.push(name);
262
+ }
263
+ return names.length > 0 ? names.join('/') : null;
264
+ }
172
265
  /**
173
266
  * Sorts a project's filters by the Collection each goes onto: its layer's, the
174
267
  * first sibling's for a layer QGIS split by shape. A filter whose layer is not
@@ -311,8 +404,12 @@ function siblingsToNormalized(siblings, title, context) {
311
404
  const first = siblings[0];
312
405
  const shapes = readSiblingShapes(siblings);
313
406
  const wkbTypes = siblings.flatMap((layer) => layer.wkbType ? [layer.wkbType] : []);
407
+ const geometryTypes = siblings.flatMap((layer) => layer.geometryType ? [layer.geometryType] : []);
314
408
  return {
315
- ...qgsLayerToNormalized(first, context, shapes.length === 3 ? null : shapes),
409
+ ...qgsLayerToNormalized(first, context, shapes.length === 3 ? null : shapes, siblings.map((layer, index) => ({ layer, shape: shapes[index] ?? null }))),
410
+ // Each layer's own, so the Collection says every shape it holds, all three included.
411
+ // A layer that names none leaves the list to the first layer's alone.
412
+ ...(geometryTypes.length === siblings.length ? { geometryTypes } : {}),
316
413
  title,
317
414
  description: first.resourceMetadata.abstract ?? qgisPlaceholderDescription('layer', title),
318
415
  bbox: unionExtent([...siblings], context.layerWgs84Extents),
@@ -389,9 +486,9 @@ function geometryFilterOf(layer) {
389
486
  const shapes = readSiblingShapes([layer]);
390
487
  return shapes.length > 0 ? shapes : null;
391
488
  }
392
- function qgsLayerToNormalized(layer, context, geometryFilter = geometryFilterOf(layer)) {
489
+ function qgsLayerToNormalized(layer, context, geometryFilter = geometryFilterOf(layer), styleParts = [{ layer, shape: null }]) {
393
490
  const geojson = context.companionByLayerId.get(layer.id) ?? null;
394
- const { projectPath, layerWgs84Extents } = context;
491
+ const { layerWgs84Extents } = context;
395
492
  const relatedTo = context.relationsByChildLayerId.get(layer.id);
396
493
  const valueRelations = context.valueRelationsByLayerId.get(layer.id);
397
494
  const bbox = effectiveWgs84Bbox(layer, layerWgs84Extents);
@@ -410,7 +507,7 @@ function qgsLayerToNormalized(layer, context, geometryFilter = geometryFilterOf(
410
507
  qgisServerNames: qgisServerNamesOf(layer, context),
411
508
  tableColumns: deriveTableColumns(geojson, layer.fieldNames, layer.fieldAliases, layer.fieldValueMaps, layer.fieldAttachments, layer.fieldEditRules, valueRelations, layer.formLayout ?? null, layer.fieldIcons, layer.fieldControls, layer.fieldComments),
412
509
  formOrder: layer.formLayout?.fields.map((field) => field.name),
413
- assets: buildLayerAssets(layer, projectPath, geometryFilter),
510
+ assets: buildLayerAssets(layer, context, geometryFilter, styleParts),
414
511
  keywords: metadata.keywords.length > 0 ? metadata.keywords : undefined,
415
512
  license: metadata.license,
416
513
  providers: buildLayerProviders(layer),
@@ -548,9 +645,9 @@ function buildVendorFields(layer, measurement) {
548
645
  return fields;
549
646
  }
550
647
  /** The layer's data asset and its style set, in one namespace with no clashes. */
551
- function buildLayerAssets(layer, projectPath, geometryFilter) {
648
+ function buildLayerAssets(layer, context, geometryFilter, styleParts) {
552
649
  const dataAssets = buildAssets(layer, geometryFilter);
553
- return { ...dataAssets, ...buildStyleAssets(layer, projectPath, dataAssets) };
650
+ return { ...dataAssets, ...buildStyleAssets(styleParts, context, dataAssets) };
554
651
  }
555
652
  /**
556
653
  * The layer's coordinate system as QGIS holds it (`<srs><spatialrefsys><authid>`),
@@ -633,40 +730,76 @@ function buildAssets(layer, geometryFilter) {
633
730
  * A style QGIS defined but wrote no renderer for is skipped — there would be
634
731
  * nothing at the address to fetch.
635
732
  *
636
- * The address is a fragment into the project document, since that is where the
637
- * style is; there is no per-style file to point at. `projectPath` identifies that
638
- * document when the caller knows where it sits, and is omitted otherwise,
639
- * leaving a bare fragment — see the known gaps in the profile. The path and
640
- * both halves of the fragment are escaped, so a project or style whose name
641
- * holds a `#` still gives an address that can be taken back apart.
733
+ * For QGIS's per-shape layers over one file, the styles are the first layer's,
734
+ * by name, and each is one asset per layer, carrying the layer's shape as
735
+ * `quac:geometry_filter`: that layer's style of the same name, or else its
736
+ * active one. A style some layer has no renderer for is skipped, so no shape is
737
+ * left with nothing to draw it.
642
738
  *
643
739
  * `existing` is the assets already built for the layer, so a style named after
644
740
  * one of them takes a disambiguated key instead of replacing it.
645
741
  */
646
- function buildStyleAssets(layer, projectPath, existing) {
742
+ function buildStyleAssets(parts, context, existing) {
647
743
  const assets = nameRecord();
744
+ const [first] = parts;
745
+ if (!first)
746
+ return assets;
648
747
  // The first style with a renderer is the default — the active one, unless
649
748
  // QGIS wrote no renderer for it. Marked rather than left to its position,
650
749
  // because a style named `2024` takes an asset key JavaScript enumerates
651
750
  // ahead of every other, whenever it was written.
652
751
  let defaultMarked = false;
653
- for (const style of orderActiveStyleFirst(layer.styles, layer.activeStyleIndex)) {
654
- if (!style.rendererV2RawXml && !style.vectorTileRendererRawXml)
752
+ for (const style of orderActiveStyleFirst(first.layer.styles, first.layer.activeStyleIndex)) {
753
+ const chosen = parts.map((part) => part.layer === first.layer
754
+ ? style
755
+ : part.layer.styles.find((own) => own.name === style.name) ?? part.layer.styles[part.layer.activeStyleIndex]);
756
+ if (!chosen.every(hasRenderer))
655
757
  continue;
656
- const fragment = `${encodeURIComponent(layer.id)}/${encodeURIComponent(style.name)}`;
657
- assets[styleAssetKey({ ...existing, ...assets }, style.name)] = {
658
- href: `${projectPath ? `./${encodeAssetPath(projectPath)}` : ''}#${fragment}`,
659
- type: QML_STYLE_MEDIA_TYPE,
660
- title: style.name,
661
- roles: defaultMarked ? ['style'] : ['style', DEFAULT_STYLE_ROLE],
662
- // Written only for a categorised style, so a reader can tell which field
663
- // a style classifies by without fetching and converting the style itself.
664
- ...(style.categorisedField ? { [QUAC_CATEGORISED_FIELD]: style.categorisedField } : {})
665
- };
758
+ parts.forEach((part, index) => {
759
+ const own = chosen[index];
760
+ assets[styleAssetKey({ ...existing, ...assets }, part.shape ? `${style.name} (${part.shape})` : style.name)] = {
761
+ href: styleHref(part, own, first.layer.id, context),
762
+ type: QML_STYLE_MEDIA_TYPE,
763
+ title: style.name,
764
+ roles: defaultMarked ? ['style'] : ['style', DEFAULT_STYLE_ROLE],
765
+ ...(part.shape ? { [QUAC_GEOMETRY_FILTER]: [part.shape] } : {}),
766
+ // Written only for a categorised style, so a reader can tell which field
767
+ // a style classifies by without fetching and converting the style itself.
768
+ ...(own.categorisedField ? { [QUAC_CATEGORISED_FIELD]: own.categorisedField } : {})
769
+ };
770
+ });
666
771
  defaultMarked = true;
667
772
  }
668
773
  return assets;
669
774
  }
775
+ function hasRenderer(style) {
776
+ return Boolean(style && (style.rendererV2RawXml || style.vectorTileRendererRawXml));
777
+ }
778
+ /**
779
+ * A style asset's address. Written as a file (`context.styleFiles`), it is the
780
+ * style file's path, and the file is added to the catalogue's files. Otherwise
781
+ * it is a fragment into the project document, `./project.qgs#<layer-id>/<style>`,
782
+ * which the reference marks as going: `projectPath` names that document where
783
+ * the caller knows where it sits, and is omitted otherwise, leaving a bare
784
+ * fragment. The path and both halves of the fragment are escaped, so a project
785
+ * or style whose name holds a `#` still gives an address that can be taken back
786
+ * apart.
787
+ */
788
+ function styleHref(part, style, collectionId, context) {
789
+ const files = context.styleFiles;
790
+ if (files && style.styleDocument) {
791
+ const folder = `${files.folder}styles/${safeName(collectionId)}`;
792
+ const name = safeName(part.shape ? `${style.name}.${part.shape}` : style.name);
793
+ let path = `${folder}/${name}.qml`;
794
+ for (let count = 2; files.taken.has(path.toLowerCase()); count += 1)
795
+ path = `${folder}/${name}-${count}.qml`;
796
+ files.taken.add(path.toLowerCase());
797
+ files.files.push({ path, mediaType: QML_STYLE_MEDIA_TYPE, text: style.styleDocument });
798
+ return `./${encodeAssetPath(path)}`;
799
+ }
800
+ const fragment = `${encodeURIComponent(part.layer.id)}/${encodeURIComponent(style.name)}`;
801
+ return `${context.projectPath ? `./${encodeAssetPath(context.projectPath)}` : ''}#${fragment}`;
802
+ }
670
803
  /**
671
804
  * A QGIS style asset's address, taken back apart — the counterpart of the href
672
805
  * `buildStyleAssets` writes, kept beside it so the two cannot drift.
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ export type { StacCatalog, StacCollection, StacItem, StacAsset, StacExtent, Stac
7
7
  export { STAC_VERSION } from './model/Stac.ts';
8
8
  export { isIconLibraryAddress, resolveFieldIconAddress } from './model/fieldIconAddress.ts';
9
9
  export { collectCollectionStyles, getDefaultStyle, styleAssetKey, GL_STYLE_MEDIA_TYPE } from './model/stacStyles.ts';
10
- export type { StacStyle, StyleOverrideReference } from './model/stacStyles.ts';
10
+ export type { StacStyle, StacStylePart, StyleOverrideReference } from './model/stacStyles.ts';
11
11
  export { readCollectionColourAdjustment } from './model/colourAdjustment.ts';
12
12
  export type { ColourAdjustment } from './model/colourAdjustment.ts';
13
13
  export { parseQgsXml } from './parse/parseQgsXml.ts';
@@ -18,7 +18,8 @@ export { collectLayerVisibility } from './parse/collectLayerVisibility.ts';
18
18
  export { parseDataSource } from './parse/parseDataSource.ts';
19
19
  export { findGeometrySiblings, readGeometrySiblingShapes, readSiblingShapes, siblingCollectionId } from './parse/geometrySiblings.ts';
20
20
  export { qmlForLayer } from './generate/qmlForLayer.ts';
21
- export { generateStacCatalogue, parseQgisStyleAssetHref, isQgisPlaceholderDescription, QUAC_GEOMETRY_FILTER, QUAC_LAYER_NAME, readCollectionGeometryFilter, readCollectionLayerName } from './generate/stacCatalogue.ts';
21
+ export { generateStacCatalogue, generateCatalogueFiles, parseQgisStyleAssetHref, isQgisPlaceholderDescription, QUAC_GEOMETRY_FILTER, QUAC_LAYER_NAME, readCollectionGeometryFilter, readCollectionLayerName } from './generate/stacCatalogue.ts';
22
+ export type { CatalogueFile, StacCatalogueOptions } from './generate/stacCatalogue.ts';
22
23
  export { DEFAULT_DELIMITED_TEXT_OPTIONS, QUAC_DELIMITED_TEXT, readCollectionDelimitedText } from './model/delimitedText.ts';
23
24
  export { QUAC_FEATURE_FILTER, readCollectionFeatureFilter } from './model/featureFilter.ts';
24
25
  export { readSqlFeatureTest } from './parse/sqlFeatureFilter.ts';
@@ -36,8 +37,8 @@ export { FILE_EXTENSION, FILE_SIZE_FIELD, TABLE_ROW_COUNT_FIELD, readCollectionR
36
37
  export { PMTILES_MEDIA_TYPE, VISUAL_ROLE, readCollectionPmtiles } from './model/stacPmtiles.ts';
37
38
  export type { StacPmtilesSource } from './model/stacPmtiles.ts';
38
39
  export type { StacCompanionData } from './generate/stacCatalogue.ts';
39
- export { QUAC_ACTIVE_COLLECTION_FIELD, QUAC_FILTERS_FIELD, QUAC_FORM_ORDER_FIELD, QUAC_LOCKS_FIELD, QUAC_MUTUALLY_EXCLUSIVE_FIELD, QUAC_PRIVATE_FIELD, readCatalogueActiveCollection, readCatalogueInitialView, readCataloguePrintLayouts, readCollectionDisplayField, readCollectionEditable, readCollectionFieldAliases, readCollectionFieldComments, readCollectionFieldAttachments, readCollectionFieldEditRules, readCollectionFieldNames, readCollectionFieldTypes, readCollectionFieldValueRelations, readCollectionFieldValues, readCollectionFormLayout, readCollectionGeometryType, readCollectionIdentifiable, readCollectionMeasurement, readCollectionOpacity, readCollectionIcon, readCollectionAddedMessage, readCollectionMapTip, readCollectionLegendImage, readCollectionFilters, readCollectionLocks, readCollectionPrivate, readCollectionRelatedTo, readCollectionScaleRange, readCollectionVisibility, statedOpacity } from './generate/normalizedProject.ts';
40
- export type { CollectionFilter, CollectionFormLayout, CollectionRelation, CollectionRelationField } from './generate/normalizedProject.ts';
40
+ export { QUAC_ACTIVE_COLLECTION_FIELD, QUAC_FILTERS_FIELD, QUAC_FORM_ORDER_FIELD, QUAC_LOCKS_FIELD, QUAC_MUTUALLY_EXCLUSIVE_FIELD, QUAC_PRIVATE_FIELD, readCatalogueActiveCollection, readCatalogueInitialView, readCataloguePrintLayouts, readCatalogueBrandColor, readCatalogueLogos, readCatalogueLeftOut, readCollectionDisplayField, readCollectionEditable, readCollectionFieldAliases, readCollectionFieldComments, readCollectionFieldAttachments, readCollectionFieldEditRules, readCollectionFieldNames, readCollectionFieldTypes, readCollectionFieldValueRelations, readCollectionFieldValues, readCollectionFormLayout, readCollectionGeometryType, readCollectionGeometryTypes, readCollectionIdentifiable, readCollectionMeasurement, readCollectionOpacity, readCollectionIcon, readCollectionAddedMessage, readCollectionMapTip, readCollectionLegendImage, readCollectionFilters, readCollectionLocks, readCollectionPrivate, readCollectionRelatedTo, readCollectionScaleRange, readCollectionVisibility, statedOpacity } from './generate/normalizedProject.ts';
41
+ export type { CatalogueLogo, LeftOutLayer, LeftOutReason, CollectionFilter, CollectionFormLayout, CollectionRelation, CollectionRelationField } from './generate/normalizedProject.ts';
41
42
  export { generateStacCatalogueFromWfsCapabilities } from './generate/wfsStacCatalogue.ts';
42
43
  export type { WfsStacCatalogueOptions } from './generate/wfsStacCatalogue.ts';
43
44
  export { generateStacCatalogueFromFolder } from './generate/folderStacCatalogue.ts';
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ export { collectLayerVisibility } from "./parse/collectLayerVisibility.js";
13
13
  export { parseDataSource } from "./parse/parseDataSource.js";
14
14
  export { findGeometrySiblings, readGeometrySiblingShapes, readSiblingShapes, siblingCollectionId } from "./parse/geometrySiblings.js";
15
15
  export { qmlForLayer } from "./generate/qmlForLayer.js";
16
- export { generateStacCatalogue, parseQgisStyleAssetHref, isQgisPlaceholderDescription, QUAC_GEOMETRY_FILTER, QUAC_LAYER_NAME, readCollectionGeometryFilter, readCollectionLayerName } from "./generate/stacCatalogue.js";
16
+ export { generateStacCatalogue, generateCatalogueFiles, parseQgisStyleAssetHref, isQgisPlaceholderDescription, QUAC_GEOMETRY_FILTER, QUAC_LAYER_NAME, readCollectionGeometryFilter, readCollectionLayerName } from "./generate/stacCatalogue.js";
17
17
  export { DEFAULT_DELIMITED_TEXT_OPTIONS, QUAC_DELIMITED_TEXT, readCollectionDelimitedText } from "./model/delimitedText.js";
18
18
  export { QUAC_FEATURE_FILTER, readCollectionFeatureFilter } from "./model/featureFilter.js";
19
19
  export { readSqlFeatureTest } from "./parse/sqlFeatureFilter.js";
@@ -24,7 +24,7 @@ export { DATA_ROLE, findAssetByRole, readDataAsset } from "./model/stacAssetRole
24
24
  export { THUMBNAIL_ROLE, readCollectionAttribution, readCollectionDeprecation, readCollectionSelfHref, readCollectionThumbnail } from "./model/stacCollectionNotes.js";
25
25
  export { FILE_EXTENSION, FILE_SIZE_FIELD, TABLE_ROW_COUNT_FIELD, readCollectionRowCount, readDataAssetFileSize } from "./model/stacSizeAndCount.js";
26
26
  export { PMTILES_MEDIA_TYPE, VISUAL_ROLE, readCollectionPmtiles } from "./model/stacPmtiles.js";
27
- export { QUAC_ACTIVE_COLLECTION_FIELD, QUAC_FILTERS_FIELD, QUAC_FORM_ORDER_FIELD, QUAC_LOCKS_FIELD, QUAC_MUTUALLY_EXCLUSIVE_FIELD, QUAC_PRIVATE_FIELD, readCatalogueActiveCollection, readCatalogueInitialView, readCataloguePrintLayouts, readCollectionDisplayField, readCollectionEditable, readCollectionFieldAliases, readCollectionFieldComments, readCollectionFieldAttachments, readCollectionFieldEditRules, readCollectionFieldNames, readCollectionFieldTypes, readCollectionFieldValueRelations, readCollectionFieldValues, readCollectionFormLayout, readCollectionGeometryType, readCollectionIdentifiable, readCollectionMeasurement, readCollectionOpacity, readCollectionIcon, readCollectionAddedMessage, readCollectionMapTip, readCollectionLegendImage, readCollectionFilters, readCollectionLocks, readCollectionPrivate, readCollectionRelatedTo, readCollectionScaleRange, readCollectionVisibility, statedOpacity } from "./generate/normalizedProject.js";
27
+ export { QUAC_ACTIVE_COLLECTION_FIELD, QUAC_FILTERS_FIELD, QUAC_FORM_ORDER_FIELD, QUAC_LOCKS_FIELD, QUAC_MUTUALLY_EXCLUSIVE_FIELD, QUAC_PRIVATE_FIELD, readCatalogueActiveCollection, readCatalogueInitialView, readCataloguePrintLayouts, readCatalogueBrandColor, readCatalogueLogos, readCatalogueLeftOut, readCollectionDisplayField, readCollectionEditable, readCollectionFieldAliases, readCollectionFieldComments, readCollectionFieldAttachments, readCollectionFieldEditRules, readCollectionFieldNames, readCollectionFieldTypes, readCollectionFieldValueRelations, readCollectionFieldValues, readCollectionFormLayout, readCollectionGeometryType, readCollectionGeometryTypes, readCollectionIdentifiable, readCollectionMeasurement, readCollectionOpacity, readCollectionIcon, readCollectionAddedMessage, readCollectionMapTip, readCollectionLegendImage, readCollectionFilters, readCollectionLocks, readCollectionPrivate, readCollectionRelatedTo, readCollectionScaleRange, readCollectionVisibility, statedOpacity } from "./generate/normalizedProject.js";
28
28
  export { generateStacCatalogueFromWfsCapabilities } from "./generate/wfsStacCatalogue.js";
29
29
  export { generateStacCatalogueFromFolder } from "./generate/folderStacCatalogue.js";
30
30
  export { generateCollectionForDroppedFile, generateCollectionForLinkedFile } from "./generate/fileLayerCollection.js";
@@ -670,6 +670,12 @@ export interface LayerStyle {
670
670
  * whose file holds one: QGIS writes it in place of `<renderer-v2>`.
671
671
  */
672
672
  vectorTileRendererRawXml?: string;
673
+ /**
674
+ * The style as a QGIS style document (`.qml`), holding its symbology,
675
+ * labels, diagrams and rendering settings, which a catalogue's style file
676
+ * holds (`generateCatalogueFiles`). Absent for a style with no renderer.
677
+ */
678
+ styleDocument?: string;
673
679
  }
674
680
  export type DataSource = FileDataSource | WfsDataSource | WmsDataSource | XyzDataSource | WmtsDataSource | ArcgisFeatureServerDataSource | UnsupportedDataSource;
675
681
  export interface FileDataSource {
@@ -38,6 +38,21 @@ export interface StacStyle {
38
38
  * `QUAC_STYLE_OVERRIDES`. Absent means none: the style draws as published.
39
39
  */
40
40
  overrides?: StyleOverrideReference[];
41
+ /**
42
+ * For a Collection made from QGIS's per-shape layers over one file, the
43
+ * style's part for each shape, in the order the Collection lists them: the
44
+ * shapes it draws (`quac:geometry_filter` on its asset) and its own address.
45
+ * `href` and `type` are then the first part's. Absent for a style drawn
46
+ * whole.
47
+ */
48
+ parts?: StacStylePart[];
49
+ }
50
+ /** One shape's part of a style, as `StacStyle.parts` lists it. */
51
+ export interface StacStylePart {
52
+ shapes: Array<'Point' | 'LineString' | 'Polygon'>;
53
+ href: string;
54
+ type?: string;
55
+ categorisedField?: string;
41
56
  }
42
57
  /**
43
58
  * One style override: the address of a JSON document, or the document itself.
@@ -59,7 +74,9 @@ export declare const DEFAULT_STYLE_ROLE = "default";
59
74
  /** MapLibre/Mapbox GL style document — a vector basemap's style. */
60
75
  export declare const GL_STYLE_MEDIA_TYPE = "application/vnd.mapbox.style+json";
61
76
  /**
62
- * Every style a Collection declares.
77
+ * Every style a Collection declares. The assets of a per-shape style, each
78
+ * carrying the shapes it draws, are one style, listed where its first part is,
79
+ * with each part in `parts`.
63
80
  *
64
81
  * The style's name comes from the asset's `title`, falling back to its key. The
65
82
  * two are the same except where a source had to disambiguate the key — see
@@ -24,7 +24,9 @@ export const DEFAULT_STYLE_ROLE = 'default';
24
24
  /** MapLibre/Mapbox GL style document — a vector basemap's style. */
25
25
  export const GL_STYLE_MEDIA_TYPE = 'application/vnd.mapbox.style+json';
26
26
  /**
27
- * Every style a Collection declares.
27
+ * Every style a Collection declares. The assets of a per-shape style, each
28
+ * carrying the shapes it draws, are one style, listed where its first part is,
29
+ * with each part in `parts`.
28
30
  *
29
31
  * The style's name comes from the asset's `title`, falling back to its key. The
30
32
  * two are the same except where a source had to disambiguate the key — see
@@ -37,13 +39,16 @@ export const GL_STYLE_MEDIA_TYPE = 'application/vnd.mapbox.style+json';
37
39
  * "which one is the default".
38
40
  */
39
41
  export function collectCollectionStyles(collection) {
40
- return Object.entries(collection.assets ?? {})
41
- .filter(([, asset]) => asset.roles?.includes('style'))
42
- .map(([key, asset]) => {
43
- const style = { name: asset.title ?? key, href: asset.href };
42
+ const styles = [];
43
+ const shaped = new Map();
44
+ for (const [key, asset] of Object.entries(collection.assets ?? {})) {
45
+ if (!asset.roles?.includes('style'))
46
+ continue;
47
+ const name = asset.title ?? key;
48
+ const style = { name, href: asset.href };
44
49
  if (asset.type)
45
50
  style.type = asset.type;
46
- if (asset.roles?.includes(DEFAULT_STYLE_ROLE))
51
+ if (asset.roles.includes(DEFAULT_STYLE_ROLE))
47
52
  style.isDefault = true;
48
53
  const categorisedField = asset[QUAC_CATEGORISED_FIELD];
49
54
  if (typeof categorisedField === 'string' && categorisedField.trim()) {
@@ -52,8 +57,38 @@ export function collectCollectionStyles(collection) {
52
57
  const overrides = readStyleOverrides(asset[QUAC_STYLE_OVERRIDES]);
53
58
  if (overrides.length > 0)
54
59
  style.overrides = overrides;
55
- return style;
56
- });
60
+ // One shape's part of a per-shape style: gathered under the style's name.
61
+ const shapes = readShapes(asset[QUAC_GEOMETRY_FILTER_FIELD]);
62
+ if (!shapes) {
63
+ styles.push(style);
64
+ continue;
65
+ }
66
+ const part = { shapes, href: asset.href };
67
+ if (style.type)
68
+ part.type = style.type;
69
+ if (style.categorisedField)
70
+ part.categorisedField = style.categorisedField;
71
+ const gathered = shaped.get(name);
72
+ if (gathered) {
73
+ gathered.parts.push(part);
74
+ if (style.isDefault)
75
+ gathered.isDefault = true;
76
+ continue;
77
+ }
78
+ style.parts = [part];
79
+ shaped.set(name, style);
80
+ styles.push(style);
81
+ }
82
+ return styles;
83
+ }
84
+ /** The key an asset gives the shapes it holds, as `QUAC_GEOMETRY_FILTER` in `generate/stacCatalogue.ts` names it. */
85
+ const QUAC_GEOMETRY_FILTER_FIELD = 'quac:geometry_filter';
86
+ const SHAPES = new Set(['Point', 'LineString', 'Polygon']);
87
+ /** A non-empty list of shapes, each one a style part can draw; null for anything else. */
88
+ function readShapes(value) {
89
+ if (!Array.isArray(value) || value.length === 0)
90
+ return null;
91
+ return value.every((shape) => typeof shape === 'string' && SHAPES.has(shape)) ? value : null;
57
92
  }
58
93
  /**
59
94
  * A key for a style asset that does not displace one already in the set.
@@ -8,7 +8,24 @@ export declare const BRAND_COLOUR_LABEL = "Brand";
8
8
  * `src/core/project/qgsproject.cpp`), each colour in
9
9
  * `QgsColorUtils::colorToString` form, which starts `r,g,b,a,`
10
10
  * (`src/core/qgscolorutils.cpp`, `qgis/QGIS@master`, read 2026-10-25). The
11
- * first matching label wins. The reading application decodes the text: this
12
- * package reads no colours of its own.
11
+ * first matching label wins. `brandColorOf` turns the text into the
12
+ * catalogue's `#rrggbb`.
13
13
  */
14
14
  export declare function parseBrandColour(qgisRoot: Element): string | null;
15
+ /**
16
+ * A project colour's text as `#rrggbb`, read as QGIS reads a project colour
17
+ * (`QgsProjectColorScheme::fetchColors` reads each with
18
+ * `QgsColorUtils::colorFromString`, `src/core/qgscolorscheme.cpp` and
19
+ * `src/core/qgscolorutils.cpp`, `qgis/QGIS@master`, read 2026-11-30), or null
20
+ * where QGIS reads no colour. Its opacity is not kept.
21
+ *
22
+ * - `colorToString`'s form, `r,g,b,a,<model>:…`: its leading `r,g,b`, which
23
+ * QGIS writes from the colour's own 8-bit channels whatever its model. Where
24
+ * they are not whole numbers, an `rgb:` colour's fractions from 0 to 1, each
25
+ * times 255.
26
+ * - Three or more comma-separated parts: red, green and blue, each read as
27
+ * `QString::toInt` reads it, 0 where it is not a whole number.
28
+ * - Otherwise Qt's hex forms, `#rgb`, `#rrggbb`, `#aarrggbb`, `#rrrgggbbb` and
29
+ * `#rrrrggggbbbb`. A colour name, which QGIS never saves itself, gives null.
30
+ */
31
+ export declare function brandColorOf(text: string | null | undefined): string | null;
@@ -9,8 +9,8 @@ export const BRAND_COLOUR_LABEL = 'Brand';
9
9
  * `src/core/project/qgsproject.cpp`), each colour in
10
10
  * `QgsColorUtils::colorToString` form, which starts `r,g,b,a,`
11
11
  * (`src/core/qgscolorutils.cpp`, `qgis/QGIS@master`, read 2026-10-25). The
12
- * first matching label wins. The reading application decodes the text: this
13
- * package reads no colours of its own.
12
+ * first matching label wins. `brandColorOf` turns the text into the
13
+ * catalogue's `#rrggbb`.
14
14
  */
15
15
  export function parseBrandColour(qgisRoot) {
16
16
  const palette = readPropertyBlock(qgisRoot, 'Palette');
@@ -23,3 +23,93 @@ export function parseBrandColour(qgisRoot) {
23
23
  return null;
24
24
  return colours[index]?.trim() || null;
25
25
  }
26
+ /**
27
+ * `colorToString`'s form, `<r,g,b,a>,<model>:<v1>,<v2>,<v3>,<v4>[,<v5>]`, as
28
+ * `colorFromString` matches it, taken apart: the 8-bit `r,g,b,a` QGIS writes
29
+ * for older versions, the colour model, and its values. Null for any other
30
+ * text. Read without a regular expression over the whole text, which would
31
+ * backtrack.
32
+ */
33
+ function readModelledColour(text) {
34
+ const colon = text.lastIndexOf(':');
35
+ if (colon < 0)
36
+ return null;
37
+ const head = text.slice(0, colon);
38
+ const comma = head.lastIndexOf(',');
39
+ if (comma < 0)
40
+ return null;
41
+ const model = head.slice(comma + 1);
42
+ const values = text.slice(colon + 1).split(',');
43
+ const number = /^[\d.-]+$/;
44
+ const valid = /^[a-z]+$/.test(model)
45
+ && (values.length === 4 || (values.length === 5 && /^[\d.-]*$/.test(values[4])))
46
+ && values.slice(0, 4).every((value) => number.test(value));
47
+ return valid ? { leading: head.slice(0, comma), model, values } : null;
48
+ }
49
+ /**
50
+ * A project colour's text as `#rrggbb`, read as QGIS reads a project colour
51
+ * (`QgsProjectColorScheme::fetchColors` reads each with
52
+ * `QgsColorUtils::colorFromString`, `src/core/qgscolorscheme.cpp` and
53
+ * `src/core/qgscolorutils.cpp`, `qgis/QGIS@master`, read 2026-11-30), or null
54
+ * where QGIS reads no colour. Its opacity is not kept.
55
+ *
56
+ * - `colorToString`'s form, `r,g,b,a,<model>:…`: its leading `r,g,b`, which
57
+ * QGIS writes from the colour's own 8-bit channels whatever its model. Where
58
+ * they are not whole numbers, an `rgb:` colour's fractions from 0 to 1, each
59
+ * times 255.
60
+ * - Three or more comma-separated parts: red, green and blue, each read as
61
+ * `QString::toInt` reads it, 0 where it is not a whole number.
62
+ * - Otherwise Qt's hex forms, `#rgb`, `#rrggbb`, `#aarrggbb`, `#rrrgggbbb` and
63
+ * `#rrrrggggbbbb`. A colour name, which QGIS never saves itself, gives null.
64
+ */
65
+ export function brandColorOf(text) {
66
+ if (!text)
67
+ return null;
68
+ const modelled = readModelledColour(text);
69
+ if (modelled) {
70
+ const leading = channelsOf(modelled.leading.split(','), true);
71
+ if (leading)
72
+ return leading;
73
+ if (modelled.model !== 'rgb')
74
+ return null;
75
+ const fractions = modelled.values.slice(0, 3).map(Number);
76
+ return fractions.every((value) => Number.isFinite(value) && value >= 0 && value <= 1)
77
+ ? hex(fractions.map((value) => Math.round(value * 255)))
78
+ : null;
79
+ }
80
+ const parts = text.split(',');
81
+ if (parts.length >= 3)
82
+ return channelsOf(parts, false);
83
+ return text.startsWith('#') ? fromHexDigits(text.slice(1)) : null;
84
+ }
85
+ /**
86
+ * `#rrggbb` from the first three parts and the optional fourth, alpha, each
87
+ * 0 to 255, or null where one is out of range, which Qt reads as no colour.
88
+ * `strict` asks for whole numbers; otherwise a part that is not one reads as
89
+ * 0, as `QString::toInt` reads it.
90
+ */
91
+ function channelsOf(parts, strict) {
92
+ if (parts.length < 3)
93
+ return null;
94
+ const read = (part) => (/^\s*[+-]?\d+\s*$/.test(part) ? Number(part) : strict ? Number.NaN : 0);
95
+ const channels = parts.slice(0, 4).map(read);
96
+ if (!channels.every((channel) => Number.isInteger(channel) && channel >= 0 && channel <= 255))
97
+ return null;
98
+ return hex(channels.slice(0, 3));
99
+ }
100
+ function fromHexDigits(digits) {
101
+ if (!/^[0-9a-f]+$/i.test(digits))
102
+ return null;
103
+ const read = (start, length, max) => Math.round((parseInt(digits.slice(start, start + length), 16) / max) * 255);
104
+ switch (digits.length) {
105
+ case 3: return hex([0, 1, 2].map((i) => read(i, 1, 15)));
106
+ case 6: return hex([0, 2, 4].map((i) => read(i, 2, 255)));
107
+ case 8: return hex([2, 4, 6].map((i) => read(i, 2, 255)));
108
+ case 9: return hex([0, 3, 6].map((i) => read(i, 3, 4095)));
109
+ case 12: return hex([0, 4, 8].map((i) => read(i, 4, 65535)));
110
+ default: return null;
111
+ }
112
+ }
113
+ function hex(channels) {
114
+ return `#${channels.map((channel) => channel.toString(16).padStart(2, '0')).join('')}`;
115
+ }
@@ -26,3 +26,10 @@ export declare function parsePrintLayouts(qgisRoot: Element): PrintLayoutTemplat
26
26
  * empty.
27
27
  */
28
28
  export declare function writeLayoutTemplate(element: Element): string;
29
+ /**
30
+ * An element as XML text by `writeLayoutTemplate`'s rule, from its name, its
31
+ * attributes in order and its children already written: each
32
+ * `SOURCE_ATTRIBUTE` left out, and an attribute whose value is an
33
+ * `ABSOLUTE_PATH` written empty.
34
+ */
35
+ export declare function writeXmlElement(tagName: string, attributes: ReadonlyArray<readonly [string, string]>, children: string): string;
@@ -48,10 +48,6 @@ const ABSOLUTE_PATH = /^\s*(\/|\\|~[\\/]|[A-Za-z]:([\\/]|$)|file:)/i;
48
48
  * empty.
49
49
  */
50
50
  export function writeLayoutTemplate(element) {
51
- const attributes = Array.from(element.attributes)
52
- .filter((attribute) => !SOURCE_ATTRIBUTE.test(attribute.name))
53
- .map((attribute) => ` ${attribute.name}="${ABSOLUTE_PATH.test(attribute.value) ? '' : escapeAttribute(attribute.value)}"`)
54
- .join('');
55
51
  const children = Array.from(element.childNodes)
56
52
  .map((child) => {
57
53
  if (child.nodeType === 1)
@@ -63,9 +59,20 @@ export function writeLayoutTemplate(element) {
63
59
  return '';
64
60
  })
65
61
  .join('');
66
- return children === ''
67
- ? `<${element.tagName}${attributes}/>`
68
- : `<${element.tagName}${attributes}>${children}</${element.tagName}>`;
62
+ return writeXmlElement(element.tagName, Array.from(element.attributes, (attribute) => [attribute.name, attribute.value]), children);
63
+ }
64
+ /**
65
+ * An element as XML text by `writeLayoutTemplate`'s rule, from its name, its
66
+ * attributes in order and its children already written: each
67
+ * `SOURCE_ATTRIBUTE` left out, and an attribute whose value is an
68
+ * `ABSOLUTE_PATH` written empty.
69
+ */
70
+ export function writeXmlElement(tagName, attributes, children) {
71
+ const written = attributes
72
+ .filter(([name]) => !SOURCE_ATTRIBUTE.test(name))
73
+ .map(([name, value]) => ` ${name}="${ABSOLUTE_PATH.test(value) ? '' : escapeAttribute(value)}"`)
74
+ .join('');
75
+ return children === '' ? `<${tagName}${written}/>` : `<${tagName}${written}>${children}</${tagName}>`;
69
76
  }
70
77
  function escapeText(text) {
71
78
  return text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
@@ -1,3 +1,4 @@
1
+ import { writeLayoutTemplate, writeXmlElement } from "./parsePrintLayouts.js";
1
2
  import { devLog } from "../util/devLog.js";
2
3
  /**
3
4
  * Captures all named styles defined for a layer, plus the index of the
@@ -35,7 +36,7 @@ export function parseLayerStyles(maplayer) {
35
36
  const direct = captureMaplayerRenderer(maplayer, tag);
36
37
  if (!direct)
37
38
  return { styles: [], activeIndex: -1 };
38
- return { styles: [{ name: 'default', isActive: true, ...rendererFields(direct, tag) }], activeIndex: 0 };
39
+ return { styles: [{ name: 'default', isActive: true, ...rendererFields(direct, tag), styleDocument: writeStyleDocument(maplayer, maplayer, tag) }], activeIndex: 0 };
39
40
  }
40
41
  const currentName = manager.getAttribute('current') ?? '';
41
42
  const styles = [];
@@ -51,9 +52,11 @@ export function parseLayerStyles(maplayer) {
51
52
  const renderer = isActive
52
53
  ? captureMaplayerRenderer(maplayer, tag)
53
54
  : captureNestedRenderer(node, tag);
55
+ // The active style's settings are the layer's own; another's are the <qgis> document QGIS saved it as.
56
+ const source = isActive ? maplayer : node.firstElementChild;
54
57
  if (isActive)
55
58
  activeIndex = styles.length;
56
- styles.push({ name, isActive, ...rendererFields(renderer, tag) });
59
+ styles.push({ name, isActive, ...rendererFields(renderer, tag), ...(renderer && source ? { styleDocument: writeStyleDocument(source, maplayer, tag) } : {}) });
57
60
  }
58
61
  return { styles, activeIndex };
59
62
  }
@@ -80,6 +83,51 @@ function captureMaplayerRenderer(maplayer, tag) {
80
83
  }
81
84
  return null;
82
85
  }
86
+ /**
87
+ * The style categories a style document holds, as `QgsMapLayer::StyleCategories`
88
+ * names them, in their order: what the QUAC plugin exports a layer's style
89
+ * with, so both write the same kind of document.
90
+ */
91
+ const STYLE_CATEGORIES = 'Symbology|Symbology3D|Labeling|Diagrams|Rendering';
92
+ /**
93
+ * The elements QGIS writes for those categories (`QgsMapLayer::writeCommonStyle`,
94
+ * `src/core/qgsmaplayer.cpp`; `QgsVectorLayer::writeStyle`,
95
+ * `src/core/vector/qgsvectorlayer.cpp`; `qgis/QGIS@master`, read
96
+ * 2026-11-30): the renderer, the selection colour, the labels, the blend
97
+ * modes, the opacity, the 3D renderer and the diagrams. The renderer is added
98
+ * by its own tag.
99
+ */
100
+ const STYLE_ELEMENTS = new Set([
101
+ 'selection', 'labeling', 'blendMode', 'featureBlendMode', 'layerOpacity', 'renderer-3d',
102
+ 'SingleCategoryDiagramRenderer', 'LinearlyInterpolatedDiagramRenderer', 'StackedDiagramRenderer', 'DiagramLayerSettings'
103
+ ]);
104
+ /** The attributes QGIS writes on the layer's element for those categories, by the same functions. */
105
+ const STYLE_ATTRIBUTES = new Set([
106
+ 'layerType', 'labelsEnabled', 'hasScaleBasedVisibilityFlag', 'maxScale', 'minScale', 'autoRefreshMode', 'autoRefreshTime',
107
+ 'symbologyReferenceScale', 'simplifyDrawingHints', 'simplifyAlgorithm', 'simplifyDrawingTol', 'simplifyLocal', 'simplifyMaxScale'
108
+ ]);
109
+ /**
110
+ * A style as a QGIS style document (`.qml`), as `QgsMapLayer::exportNamedStyle`
111
+ * writes one for `STYLE_CATEGORIES`: a `<qgis>` element holding the project's
112
+ * QGIS version, the categories, and the attributes and elements of `source`
113
+ * that belong to them, written by `writeLayoutTemplate`'s rule, so it holds no
114
+ * path on the computer that saved the project. `source` is the layer's own
115
+ * element for its active style, and the `<qgis>` element QGIS saved for any
116
+ * other.
117
+ */
118
+ function writeStyleDocument(source, maplayer, tag) {
119
+ const version = maplayer.ownerDocument?.documentElement?.getAttribute('version') ?? '';
120
+ const attributes = [['version', version], ['styleCategories', STYLE_CATEGORIES]];
121
+ for (const attribute of Array.from(source.attributes)) {
122
+ if (STYLE_ATTRIBUTES.has(attribute.name))
123
+ attributes.push([attribute.name, attribute.value]);
124
+ }
125
+ const children = Array.from(source.children)
126
+ .filter((child) => child.tagName === tag || STYLE_ELEMENTS.has(child.tagName))
127
+ .map(writeLayoutTemplate)
128
+ .join('');
129
+ return `<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'>\n${writeXmlElement('qgis', attributes, children)}\n`;
130
+ }
83
131
  /** A style's renderer fields, from its renderer element or none. */
84
132
  function rendererFields(renderer, tag) {
85
133
  if (tag === 'renderer') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vectoriahq/quac",
3
- "version": "0.22.0-next.1",
3
+ "version": "0.23.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "description": "Writes and reads QUAC, which adds map layer settings to STAC catalogues.",
@@ -93,6 +93,26 @@
93
93
  "additionalProperties": false
94
94
  }
95
95
  },
96
+ "quac:brand_color": {
97
+ "description": "On the top-level Catalog: the colour that the source names as its brand, as #rrggbb in lower case. Written from the QGIS project colour labelled Brand (Project Properties, Colors).",
98
+ "type": "string",
99
+ "pattern": "^#[0-9a-f]{6}$"
100
+ },
101
+ "quac:left_out": {
102
+ "description": "On the top-level Catalog: the source's layers that the catalogue leaves out, in the source's order, each with the id its Collection would have had, its title and why it was left out. Written by the QUAC plugin for QGIS.",
103
+ "type": "array",
104
+ "minItems": 1,
105
+ "items": {
106
+ "type": "object",
107
+ "required": ["id", "title", "reason"],
108
+ "properties": {
109
+ "id": { "type": "string", "minLength": 1 },
110
+ "title": { "type": "string" },
111
+ "reason": { "enum": ["outside_folder", "not_a_file", "holds_credentials", "not_opened", "not_copied", "copy_failed"] }
112
+ },
113
+ "additionalProperties": false
114
+ }
115
+ },
96
116
  "quac:visibility_checked": {
97
117
  "description": "On a group: whether the group opens switched on. In a catalogue of basemaps, true marks the basemap that is shown first, and false keeps a group hidden.",
98
118
  "type": "boolean"
@@ -101,6 +121,12 @@
101
121
  "description": "The group shows only one of its children at a time, as a QGIS mutually exclusive group does. Written from a QGIS project's layer tree or QGIS Server's GetProjectSettings.",
102
122
  "const": true
103
123
  },
124
+ "links": {
125
+ "type": "array",
126
+ "items": {
127
+ "$ref": "#/definitions/link"
128
+ }
129
+ },
104
130
  "collections": {
105
131
  "type": "array",
106
132
  "items": {
@@ -339,10 +365,11 @@
339
365
  "type": "object",
340
366
  "properties": {
341
367
  "quac:geometry_type": {
342
- "description": "The layer's geometry type as a QGIS project names it, such as Point, as a one-item array.",
368
+ "description": "The layer's geometry type as a QGIS project names it, such as Point, as a one-item array; for a Collection made from QGIS's per-shape layers over one file, each layer's, in their order.",
343
369
  "type": "array",
344
370
  "minItems": 1,
345
- "maxItems": 1,
371
+ "maxItems": 3,
372
+ "uniqueItems": true,
346
373
  "items": {
347
374
  "$ref": "#/definitions/name"
348
375
  }
@@ -394,6 +421,10 @@
394
421
  "type": "string",
395
422
  "minLength": 1
396
423
  },
424
+ "quac:theme": {
425
+ "description": "On an icon link of the top-level Catalog: the theme the image is for. dark marks the logo shown in a dark theme, beside the icon link without it. Written from the QGIS project variable quac_logo_dark.",
426
+ "const": "dark"
427
+ },
397
428
  "quac:wmts_style": {
398
429
  "description": "On a WMTS link: the style that the layer's tiles are requested in. Written from a QGIS WMTS layer's style. Absent where QGIS uses the layer's default style. The Web Map Links extension defines no field for it and would be its natural home.",
399
430
  "type": "string",
@@ -424,7 +455,7 @@
424
455
  "minLength": 1
425
456
  },
426
457
  "quac:geometry_filter": {
427
- "description": "The geometry types in the asset's file that the Collection holds, so a layer shows only those features. A multi-part geometry, such as a MultiPoint, counts as its single-part type. Written from QGIS file layers' geometrytype= option, which QGIS uses to split a file holding several geometry types into one layer per type; one Collection made from two such layers lists both their types, and one made from all three has no filter, so it holds the whole file.",
458
+ "description": "The geometry types in the asset's file that the Collection holds, so a layer shows only those features. A multi-part geometry, such as a MultiPoint, counts as its single-part type. Written from QGIS file layers' geometrytype= option, which QGIS uses to split a file holding several geometry types into one layer per type; one Collection made from two such layers lists both their types, and one made from all three has no filter, so it holds the whole file. On a style asset of such a Collection: the one geometry type whose features the style draws, each layer's style being an asset of its own.",
428
459
  "type": "array",
429
460
  "minItems": 1,
430
461
  "uniqueItems": true,