@vectoriahq/quac 0.15.0 → 0.17.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.
- package/dist/generate/normalizedProject.d.ts +17 -1
- package/dist/generate/normalizedProject.js +47 -7
- package/dist/generate/serverStacCatalogue.d.ts +16 -2
- package/dist/generate/serverStacCatalogue.js +49 -10
- package/dist/generate/stacCatalogue.d.ts +8 -0
- package/dist/generate/stacCatalogue.js +21 -6
- package/dist/generate/wmsStacCatalogue.js +13 -3
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -1
- package/dist/model/QgsProject.d.ts +13 -2
- package/dist/model/Stac.d.ts +6 -0
- package/dist/model/WmsProject.d.ts +33 -0
- package/dist/model/fieldIconAddress.d.ts +5 -1
- package/dist/model/fieldIconAddress.js +6 -2
- package/dist/parse/parseDataSource.js +15 -3
- package/dist/parse/parseGetProjectSettings.d.ts +3 -2
- package/dist/parse/parseGetProjectSettings.js +32 -3
- package/dist/parse/parseLayers.js +14 -15
- package/dist/parse/parsePrintLayouts.d.ts +28 -0
- package/dist/parse/parsePrintLayouts.js +79 -0
- package/dist/parse/parseQgsXml.js +2 -0
- package/dist/util/nameRecord.d.ts +7 -0
- package/dist/util/nameRecord.js +9 -0
- package/package.json +1 -1
- package/src/schema/quac.schema.json +36 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LayerLocks, FieldAttachment, FieldEditRule, LayerFormLayout, LayerScaleRange, ProjectMeasurement } from '../model/QgsProject.ts';
|
|
1
|
+
import type { LayerLocks, PrintLayoutTemplate, FieldAttachment, FieldEditRule, LayerFormLayout, LayerScaleRange, ProjectMeasurement } from '../model/QgsProject.ts';
|
|
2
2
|
import type { StacAsset, StacCatalog, StacCollection, StacExtent, StacLink, StacProvider, TableColumn, TableColumnValue, TableColumnValueRelation } from '../model/Stac.ts';
|
|
3
3
|
/**
|
|
4
4
|
* Source-agnostic intermediate model + the single STAC generator that
|
|
@@ -80,6 +80,8 @@ export declare const QUAC_MUTUALLY_EXCLUSIVE_FIELD = "quac:mutually_exclusive";
|
|
|
80
80
|
* names as the one the map opens with as the active layer.
|
|
81
81
|
*/
|
|
82
82
|
export declare const QUAC_ACTIVE_COLLECTION_FIELD = "quac:active_collection";
|
|
83
|
+
/** The project's print layouts, on the top-level Catalog: each as its name and its QGIS layout template. */
|
|
84
|
+
export declare const QUAC_PRINT_LAYOUTS_FIELD = "quac:print_layouts";
|
|
83
85
|
/**
|
|
84
86
|
* One relation a Collection declares in `quac:related_to`: the parent
|
|
85
87
|
* Collection its records hang off, the field pair(s) joining them, and the name
|
|
@@ -284,6 +286,14 @@ export declare function generateStacFromNormalized(project: NormalizedProject):
|
|
|
284
286
|
* Server type name this package does not map, gets no `data_type`.
|
|
285
287
|
*/
|
|
286
288
|
export declare function withDataType(column: TableColumn): TableColumn;
|
|
289
|
+
/**
|
|
290
|
+
* The column with `quac:length` and `quac:precision` as its data defines the
|
|
291
|
+
* field: a length for a text or number column, a precision for a `double`
|
|
292
|
+
* one, each where it is a whole number above nothing. QGIS gives 0 or -1
|
|
293
|
+
* where the data defines none, and a length for other types too, such as 1
|
|
294
|
+
* for a GeoPackage boolean, which says nothing about the values it holds.
|
|
295
|
+
*/
|
|
296
|
+
export declare function withFieldSize(column: TableColumn, length: number | undefined, precision: number | undefined): TableColumn;
|
|
287
297
|
/**
|
|
288
298
|
* Reads `quac:active_collection` back off a Catalog: the id of the Collection
|
|
289
299
|
* the map opens with as the active layer, or null where the source names none.
|
|
@@ -297,6 +307,12 @@ export declare function readCatalogueActiveCollection(catalog: StacCatalog): str
|
|
|
297
307
|
* about where to open", so a caller frames the map its own way rather than
|
|
298
308
|
* reading a missing field as an instruction.
|
|
299
309
|
*/
|
|
310
|
+
/**
|
|
311
|
+
* Reads `quac:print_layouts` back off a Catalog: each print layout's name and
|
|
312
|
+
* template, in its order. An entry without a string name, or whose template is
|
|
313
|
+
* not a `<Layout>` element, is not read. Empty where the Catalog lists none.
|
|
314
|
+
*/
|
|
315
|
+
export declare function readCataloguePrintLayouts(catalog: StacCatalog): PrintLayoutTemplate[];
|
|
300
316
|
export declare function readCatalogueInitialView(catalog: StacCatalog): NormalizedBbox | null;
|
|
301
317
|
/**
|
|
302
318
|
* Reads shared source declarations back off a Collection.
|
|
@@ -4,6 +4,7 @@ import { STAC_VERSION } from "../model/Stac.js";
|
|
|
4
4
|
import { PROJ_CODE, PROJECTION_EXTENSION } from "../model/stacProjection.js";
|
|
5
5
|
import { collectCatalogueCollections } from "../model/stacTreeWalk.js";
|
|
6
6
|
import { readNonBlank } from "../util/nonBlankText.js";
|
|
7
|
+
import { nameRecord } from "../util/nameRecord.js";
|
|
7
8
|
/**
|
|
8
9
|
* Source-agnostic intermediate model + the single STAC generator that
|
|
9
10
|
* consumes it.
|
|
@@ -89,6 +90,8 @@ const INITIAL_VIEW_FIELD = 'quac:initial_view';
|
|
|
89
90
|
* names as the one the map opens with as the active layer.
|
|
90
91
|
*/
|
|
91
92
|
export const QUAC_ACTIVE_COLLECTION_FIELD = 'quac:active_collection';
|
|
93
|
+
/** The project's print layouts, on the top-level Catalog: each as its name and its QGIS layout template. */
|
|
94
|
+
export const QUAC_PRINT_LAYOUTS_FIELD = 'quac:print_layouts';
|
|
92
95
|
/**
|
|
93
96
|
* Records where a catalogue came from as the Catalog's `self` link, so the
|
|
94
97
|
* document says it rather than a reader holding it alongside. Sources with no
|
|
@@ -336,6 +339,27 @@ export function withDataType(column) {
|
|
|
336
339
|
return column;
|
|
337
340
|
return { ...column, data_type: DATA_TYPE_BY_COLUMN_TYPE[type] };
|
|
338
341
|
}
|
|
342
|
+
/** The column types a length applies to: text and numbers. */
|
|
343
|
+
const SIZED_COLUMN_TYPES = new Set(['string', 'int', 'long', 'double']);
|
|
344
|
+
/**
|
|
345
|
+
* The column with `quac:length` and `quac:precision` as its data defines the
|
|
346
|
+
* field: a length for a text or number column, a precision for a `double`
|
|
347
|
+
* one, each where it is a whole number above nothing. QGIS gives 0 or -1
|
|
348
|
+
* where the data defines none, and a length for other types too, such as 1
|
|
349
|
+
* for a GeoPackage boolean, which says nothing about the values it holds.
|
|
350
|
+
*/
|
|
351
|
+
export function withFieldSize(column, length, precision) {
|
|
352
|
+
const sized = { ...column };
|
|
353
|
+
const type = column.type ?? '';
|
|
354
|
+
if (SIZED_COLUMN_TYPES.has(type) && isWholeAboveNothing(length))
|
|
355
|
+
sized['quac:length'] = length;
|
|
356
|
+
if (type === 'double' && isWholeAboveNothing(precision))
|
|
357
|
+
sized['quac:precision'] = precision;
|
|
358
|
+
return sized;
|
|
359
|
+
}
|
|
360
|
+
function isWholeAboveNothing(value) {
|
|
361
|
+
return Number.isSafeInteger(value) && value > 0;
|
|
362
|
+
}
|
|
339
363
|
/**
|
|
340
364
|
* Reads `quac:active_collection` back off a Catalog: the id of the Collection
|
|
341
365
|
* the map opens with as the active layer, or null where the source names none.
|
|
@@ -352,6 +376,22 @@ export function readCatalogueActiveCollection(catalog) {
|
|
|
352
376
|
* about where to open", so a caller frames the map its own way rather than
|
|
353
377
|
* reading a missing field as an instruction.
|
|
354
378
|
*/
|
|
379
|
+
/**
|
|
380
|
+
* Reads `quac:print_layouts` back off a Catalog: each print layout's name and
|
|
381
|
+
* template, in its order. An entry without a string name, or whose template is
|
|
382
|
+
* not a `<Layout>` element, is not read. Empty where the Catalog lists none.
|
|
383
|
+
*/
|
|
384
|
+
export function readCataloguePrintLayouts(catalog) {
|
|
385
|
+
const value = catalog[QUAC_PRINT_LAYOUTS_FIELD];
|
|
386
|
+
if (!Array.isArray(value))
|
|
387
|
+
return [];
|
|
388
|
+
return value.flatMap((entry) => {
|
|
389
|
+
if (!entry || typeof entry !== 'object')
|
|
390
|
+
return [];
|
|
391
|
+
const { name, template } = entry;
|
|
392
|
+
return typeof name === 'string' && typeof template === 'string' && /^<Layout[\s/>]/.test(template) ? [{ name, template }] : [];
|
|
393
|
+
});
|
|
394
|
+
}
|
|
355
395
|
export function readCatalogueInitialView(catalog) {
|
|
356
396
|
const value = catalog[INITIAL_VIEW_FIELD];
|
|
357
397
|
if (!Array.isArray(value) || value.length !== 4)
|
|
@@ -396,7 +436,7 @@ export function* declaredColumns(collection) {
|
|
|
396
436
|
}
|
|
397
437
|
/** Each field's alias, its column's `title`. A column with a blank or no `title` is absent. */
|
|
398
438
|
export function readCollectionFieldAliases(collection) {
|
|
399
|
-
const aliases =
|
|
439
|
+
const aliases = nameRecord();
|
|
400
440
|
for (const [name, column] of declaredColumns(collection)) {
|
|
401
441
|
const alias = readNonBlank(column.title);
|
|
402
442
|
if (alias)
|
|
@@ -406,7 +446,7 @@ export function readCollectionFieldAliases(collection) {
|
|
|
406
446
|
}
|
|
407
447
|
/** Each field's comment, its column's `description`, trimmed. A column with a blank or no `description` is absent. */
|
|
408
448
|
export function readCollectionFieldComments(collection) {
|
|
409
|
-
const comments =
|
|
449
|
+
const comments = nameRecord();
|
|
410
450
|
for (const [name, column] of declaredColumns(collection)) {
|
|
411
451
|
const comment = readNonBlank(column.description);
|
|
412
452
|
if (comment)
|
|
@@ -425,7 +465,7 @@ export function readCollectionFieldNames(collection) {
|
|
|
425
465
|
}
|
|
426
466
|
/** Each declared column `type`, keyed by field name. A column with no `type` is absent. */
|
|
427
467
|
export function readCollectionFieldTypes(collection) {
|
|
428
|
-
const types =
|
|
468
|
+
const types = nameRecord();
|
|
429
469
|
for (const [name, column] of declaredColumns(collection)) {
|
|
430
470
|
const type = readNonBlank(column.type);
|
|
431
471
|
if (type)
|
|
@@ -439,7 +479,7 @@ export function readCollectionFieldTypes(collection) {
|
|
|
439
479
|
* other kind, is dropped, and a column left with no entries is absent.
|
|
440
480
|
*/
|
|
441
481
|
export function readCollectionFieldValues(collection) {
|
|
442
|
-
const picklists =
|
|
482
|
+
const picklists = nameRecord();
|
|
443
483
|
for (const [name, column] of declaredColumns(collection)) {
|
|
444
484
|
const declared = column['quac:values'];
|
|
445
485
|
if (!Array.isArray(declared))
|
|
@@ -468,7 +508,7 @@ export function readCollectionFieldValues(collection) {
|
|
|
468
508
|
* `order_field`, reads as ordered by key.
|
|
469
509
|
*/
|
|
470
510
|
export function readCollectionFieldValueRelations(collection) {
|
|
471
|
-
const relations =
|
|
511
|
+
const relations = nameRecord();
|
|
472
512
|
for (const [name, column] of declaredColumns(collection)) {
|
|
473
513
|
const declared = column['quac:value_relation'];
|
|
474
514
|
if (!declared || typeof declared !== 'object')
|
|
@@ -585,7 +625,7 @@ export function readCollectionPrivate(collection) {
|
|
|
585
625
|
* omitted or unrecognised `relative_storage` as absolute.
|
|
586
626
|
*/
|
|
587
627
|
export function readCollectionFieldAttachments(collection) {
|
|
588
|
-
const attachments =
|
|
628
|
+
const attachments = nameRecord();
|
|
589
629
|
for (const [name, column] of declaredColumns(collection)) {
|
|
590
630
|
const declared = column['quac:attachment'];
|
|
591
631
|
if (!declared || typeof declared !== 'object' || Array.isArray(declared))
|
|
@@ -623,7 +663,7 @@ export function readCollectionFieldAttachments(collection) {
|
|
|
623
663
|
*/
|
|
624
664
|
export function readCollectionFieldEditRules(collection) {
|
|
625
665
|
const relations = readCollectionFieldValueRelations(collection);
|
|
626
|
-
const rules =
|
|
666
|
+
const rules = nameRecord();
|
|
627
667
|
for (const [name, candidate] of declaredColumns(collection)) {
|
|
628
668
|
const readOnly = candidate['quac:editable'] === false;
|
|
629
669
|
const defaultValue = readColumnDefault(candidate['quac:default']);
|
|
@@ -62,15 +62,29 @@ export declare function generateServerStacCatalogue(project: QgsProject, options
|
|
|
62
62
|
* served address would repeat.
|
|
63
63
|
*/
|
|
64
64
|
export declare function serverWmsEndpoint(serverAddress: string): string | null;
|
|
65
|
-
/**
|
|
65
|
+
/**
|
|
66
|
+
* A field as QGIS gives it. GetProjectSettings reports its Qt type name, such
|
|
67
|
+
* as `qlonglong`, its provider's type name, the comment its data holds, such
|
|
68
|
+
* as a PostgreSQL column comment (`QgsField::comment`), its length and
|
|
69
|
+
* precision (`QgsField::length`, `QgsField::precision`), and whether it is
|
|
70
|
+
* part of the layer's primary key (`QgsVectorLayer::primaryKeyAttributes`).
|
|
71
|
+
* `filledByData` is whether the data gives it a value of its own when a new
|
|
72
|
+
* feature leaves it empty (`QgsVectorDataProvider::defaultValueClause`), which
|
|
73
|
+
* QGIS Server does not report.
|
|
74
|
+
*/
|
|
66
75
|
export interface QgisFieldType {
|
|
67
76
|
type: string;
|
|
68
77
|
typeName: string;
|
|
78
|
+
comment?: string;
|
|
79
|
+
length?: number;
|
|
80
|
+
precision?: number;
|
|
81
|
+
filledByData?: boolean;
|
|
82
|
+
primaryKey?: boolean;
|
|
69
83
|
}
|
|
70
84
|
export interface ServerCatalogueOptions {
|
|
71
85
|
/** The address QGIS Server serves the project from, as its own `wmsServiceUrl` gives it. */
|
|
72
86
|
serverAddress: string;
|
|
73
|
-
/** Each layer's field types, by layer id and then field name. */
|
|
87
|
+
/** Each layer's field types and comments, by layer id and then field name. */
|
|
74
88
|
fieldTypes?: Record<string, Record<string, QgisFieldType>>;
|
|
75
89
|
/** The WGS84 box of a layer whose project saves no `<wgs84extent>`, by layer id. */
|
|
76
90
|
layerWgs84Extents?: Record<string, BoundingBox>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { buildStacExtent, unionBboxes, withDataType } from "./normalizedProject.js";
|
|
1
|
+
import { buildStacExtent, unionBboxes, withDataType, withFieldSize } from "./normalizedProject.js";
|
|
2
2
|
import { serverLayerTree, wmsPublishedLayerIds } from "./serverLayerTree.js";
|
|
3
3
|
import { generateStacCatalogue, QUAC_CATEGORISED_FIELD } from "./stacCatalogue.js";
|
|
4
4
|
import { wfsGetFeatureAsset } from "./wfsStacCatalogue.js";
|
|
@@ -212,7 +212,7 @@ function serveCollection(source, context) {
|
|
|
212
212
|
hiddenOf: (id) => hiddenFieldsOf(context.layersById.get(id)),
|
|
213
213
|
servedId: (id) => context.servedIds.get(id) ?? null
|
|
214
214
|
});
|
|
215
|
-
serveFieldTypes(shown, context.fieldTypes[layerId] ?? {});
|
|
215
|
+
serveFieldTypes(shown, context.fieldTypes[layerId] ?? {}, context.layersById.get(layerId)?.fieldComments ?? {});
|
|
216
216
|
return shown;
|
|
217
217
|
}
|
|
218
218
|
/**
|
|
@@ -295,11 +295,31 @@ function serveColumns(collection, hidden, context) {
|
|
|
295
295
|
else
|
|
296
296
|
delete collection['table:columns'];
|
|
297
297
|
}
|
|
298
|
-
/**
|
|
299
|
-
|
|
298
|
+
/**
|
|
299
|
+
* Each column with what QGIS gives for its field (`withFieldType`), and the
|
|
300
|
+
* Collection with its primary key (`primaryKeyOf`).
|
|
301
|
+
*/
|
|
302
|
+
function serveFieldTypes(collection, fieldTypes, projectComments) {
|
|
300
303
|
const columns = collection['table:columns'];
|
|
301
|
-
if (Array.isArray(columns))
|
|
302
|
-
|
|
304
|
+
if (!Array.isArray(columns))
|
|
305
|
+
return;
|
|
306
|
+
const typed = columns.map((column) => withFieldType(column, fieldTypes[column.name], projectComments));
|
|
307
|
+
collection['table:columns'] = typed;
|
|
308
|
+
const primaryKey = primaryKeyOf(typed, fieldTypes);
|
|
309
|
+
if (primaryKey)
|
|
310
|
+
collection['quac:primary_key'] = primaryKey;
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* The names of the fields QGIS gives as the layer's primary key, in the
|
|
314
|
+
* columns' order, or null where it gives none or where a key field is not
|
|
315
|
+
* among the columns, such as one hidden: part of a key identifies nothing.
|
|
316
|
+
*/
|
|
317
|
+
function primaryKeyOf(columns, fieldTypes) {
|
|
318
|
+
const keys = Object.entries(fieldTypes).filter(([, fieldType]) => fieldType.primaryKey).map(([name]) => name);
|
|
319
|
+
const names = new Set(columns.map((column) => column.name));
|
|
320
|
+
if (keys.length === 0 || keys.some((name) => !names.has(name)))
|
|
321
|
+
return null;
|
|
322
|
+
return columns.filter((column) => keys.includes(column.name)).map((column) => column.name);
|
|
303
323
|
}
|
|
304
324
|
/** A style asset's categorised field, dropped where the layer hides it. */
|
|
305
325
|
function serveStyleFields(collection, hidden) {
|
|
@@ -317,10 +337,29 @@ function serveStyleFields(collection, hidden) {
|
|
|
317
337
|
}
|
|
318
338
|
collection.assets = assets;
|
|
319
339
|
}
|
|
320
|
-
/**
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
340
|
+
/**
|
|
341
|
+
* The column with the `type` QGIS Server reports for its field, and the
|
|
342
|
+
* `data_type` beside it, where QGIS Server reports one. Its `description` is
|
|
343
|
+
* the comment the field's data holds where the project saves no comment of its
|
|
344
|
+
* own for the field, `projectComments` holding those, a blank one included:
|
|
345
|
+
* QGIS's form shows the project's comment, hides the data's behind a blank
|
|
346
|
+
* one, and shows the data's otherwise (`QgsAttributeForm`,
|
|
347
|
+
* `src/gui/qgsattributeform.cpp`, `qgis/QGIS@master`, read 2026-11-25). It
|
|
348
|
+
* takes `quac:length` and `quac:precision` (`withFieldSize`), and
|
|
349
|
+
* `quac:filled_by_data` where the data fills the field.
|
|
350
|
+
*/
|
|
351
|
+
function withFieldType(column, fieldType, projectComments) {
|
|
352
|
+
if (!fieldType)
|
|
353
|
+
return column;
|
|
354
|
+
const type = mapQtTypeToStacTableType(fieldType.type, fieldType.typeName);
|
|
355
|
+
const typed = type ? withDataType({ ...column, type }) : { ...column };
|
|
356
|
+
const comment = fieldType.comment?.trim();
|
|
357
|
+
if (comment && !Object.hasOwn(projectComments, column.name))
|
|
358
|
+
typed.description = comment;
|
|
359
|
+
const sized = withFieldSize(typed, fieldType.length, fieldType.precision);
|
|
360
|
+
if (fieldType.filledByData)
|
|
361
|
+
sized['quac:filled_by_data'] = true;
|
|
362
|
+
return sized;
|
|
324
363
|
}
|
|
325
364
|
function serveColumn(source, hidden, context) {
|
|
326
365
|
const column = { ...source };
|
|
@@ -119,4 +119,12 @@ export declare function parseQgisStyleAssetHref(href: string): {
|
|
|
119
119
|
layerId: string;
|
|
120
120
|
styleName: string;
|
|
121
121
|
} | null;
|
|
122
|
+
/**
|
|
123
|
+
* Whether an Attachment widget's default folder is a path relative to the
|
|
124
|
+
* project, and not a path on the computer that saved it, such as
|
|
125
|
+
* `/srv/photos`, `C:\\Survey` or `~/photos`, a network share or an address.
|
|
126
|
+
* QGIS's folder picker saves an absolute path, which would publish the
|
|
127
|
+
* computer's folder names.
|
|
128
|
+
*/
|
|
129
|
+
export declare function isProjectRelativeFolder(folder: string): boolean;
|
|
122
130
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { arcgisQueryAsset } from "./arcgisStacCatalogue.js";
|
|
2
|
-
import { QUAC_MEASUREMENT_FIELD, slugify, generateStacFromNormalized, unionBboxes, withSelfLink } from "./normalizedProject.js";
|
|
2
|
+
import { 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";
|
|
@@ -13,6 +13,7 @@ import { buildXyzLink } from "../model/stacXyz.js";
|
|
|
13
13
|
import { findGeometrySiblings, readSiblingShapes, siblingCollectionId } from "../parse/geometrySiblings.js";
|
|
14
14
|
import { findValueRelationLookup, isFilterInProject, isRelationInProject } from "../parse/projectNotes.js";
|
|
15
15
|
import { declaredMediaTypeForFile, isLayerFileOfFormat, PROJECT_DATA_ROLES, QML_STYLE_MEDIA_TYPE } from "../util/catalogueFileFormats.js";
|
|
16
|
+
import { nameRecord } from "../util/nameRecord.js";
|
|
16
17
|
/**
|
|
17
18
|
* Generates a STAC Catalog tree from a parsed QgsProject.
|
|
18
19
|
*
|
|
@@ -162,6 +163,9 @@ function qgsProjectToNormalized(project, companions, projectPath, projectFileNam
|
|
|
162
163
|
activeCollectionId: project.initialActiveLayerId && layersById.has(project.initialActiveLayerId)
|
|
163
164
|
? collectionIdOf(project.initialActiveLayerId)
|
|
164
165
|
: null,
|
|
166
|
+
vendorFields: project.printLayouts && project.printLayouts.length > 0
|
|
167
|
+
? { [QUAC_PRINT_LAYOUTS_FIELD]: project.printLayouts.map(({ name, template }) => ({ name, template })) }
|
|
168
|
+
: undefined,
|
|
165
169
|
nodes
|
|
166
170
|
};
|
|
167
171
|
}
|
|
@@ -217,7 +221,7 @@ function collectRelationsByChildLayerId(relations, layersById, collectionIdOf) {
|
|
|
217
221
|
function collectValueRelationsByLayerId(layers, layersById, collectionIdOf) {
|
|
218
222
|
const byLayerId = new Map();
|
|
219
223
|
for (const layer of layers) {
|
|
220
|
-
const relations =
|
|
224
|
+
const relations = nameRecord();
|
|
221
225
|
for (const [field, widget] of Object.entries(layer.fieldValueRelations)) {
|
|
222
226
|
const lookup = findValueRelationLookup(widget, layers, layersById);
|
|
223
227
|
if (lookup)
|
|
@@ -639,7 +643,7 @@ function buildAssets(layer, geometryFilter) {
|
|
|
639
643
|
* one of them takes a disambiguated key instead of replacing it.
|
|
640
644
|
*/
|
|
641
645
|
function buildStyleAssets(layer, projectPath, existing) {
|
|
642
|
-
const assets =
|
|
646
|
+
const assets = nameRecord();
|
|
643
647
|
// The first style with a renderer is the default — the active one, unless
|
|
644
648
|
// QGIS wrote no renderer for it. Marked rather than left to its position,
|
|
645
649
|
// because a style named `2024` takes an asset key JavaScript enumerates
|
|
@@ -774,7 +778,7 @@ function unionExtent(layers, layerWgs84Extents) {
|
|
|
774
778
|
* exist": this means a hidden WFS layer's schema is fully visible to the
|
|
775
779
|
* dev panel and to STAC clients before any data is fetched.
|
|
776
780
|
*/
|
|
777
|
-
function deriveTableColumns(geojson, fieldNames, fieldAliases, fieldValueMaps =
|
|
781
|
+
function deriveTableColumns(geojson, fieldNames, fieldAliases, fieldValueMaps = nameRecord(), fieldAttachments = nameRecord(), fieldEditRules = nameRecord(), fieldValueRelations = nameRecord(), formLayout = null, fieldIcons = nameRecord(), fieldControls = nameRecord(), fieldComments = nameRecord()) {
|
|
778
782
|
const observedTypes = new Map();
|
|
779
783
|
const orderedFieldNames = [];
|
|
780
784
|
const seen = new Set();
|
|
@@ -902,15 +906,26 @@ function defaultToJson(defaultValue) {
|
|
|
902
906
|
case 'fixed': return { kind: 'fixed', value: defaultValue.value, on_update: defaultValue.onUpdate };
|
|
903
907
|
}
|
|
904
908
|
}
|
|
909
|
+
/**
|
|
910
|
+
* Whether an Attachment widget's default folder is a path relative to the
|
|
911
|
+
* project, and not a path on the computer that saved it, such as
|
|
912
|
+
* `/srv/photos`, `C:\\Survey` or `~/photos`, a network share or an address.
|
|
913
|
+
* QGIS's folder picker saves an absolute path, which would publish the
|
|
914
|
+
* computer's folder names.
|
|
915
|
+
*/
|
|
916
|
+
export function isProjectRelativeFolder(folder) {
|
|
917
|
+
return !/^(?:[/\\~]|[A-Za-z][A-Za-z0-9+.-]*:)/.test(folder.trim());
|
|
918
|
+
}
|
|
905
919
|
/**
|
|
906
920
|
* A field's Attachment widget as `quac:attachment` stores it. A member
|
|
907
|
-
* the source said nothing about is left off rather than written null
|
|
921
|
+
* the source said nothing about is left off rather than written null, and a
|
|
922
|
+
* default folder that is not relative to the project is left off.
|
|
908
923
|
*/
|
|
909
924
|
function attachmentToJson(attachment) {
|
|
910
925
|
return {
|
|
911
926
|
...(attachment.viewer ? { viewer: attachment.viewer } : {}),
|
|
912
927
|
...(attachment.filter ? { filter: attachment.filter } : {}),
|
|
913
|
-
...(attachment.defaultRoot ? { default_root: attachment.defaultRoot } : {}),
|
|
928
|
+
...(attachment.defaultRoot && isProjectRelativeFolder(attachment.defaultRoot) ? { default_root: attachment.defaultRoot } : {}),
|
|
914
929
|
relative_storage: attachment.relativeStorage
|
|
915
930
|
};
|
|
916
931
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { slugify, generateStacFromNormalized } from "./normalizedProject.js";
|
|
1
|
+
import { slugify, generateStacFromNormalized, withFieldSize } from "./normalizedProject.js";
|
|
2
2
|
import { wfsGetFeatureAsset } from "./wfsStacCatalogue.js";
|
|
3
3
|
import { chooseWmsCrs, WEB_MAP_LINKS_EXTENSION, wmsEndpoint } from "../model/stacWms.js";
|
|
4
4
|
export function generateStacCatalogueFromWms(project, options = {}) {
|
|
@@ -80,7 +80,7 @@ function wmsLayerToNormalized(layer, wfsSource) {
|
|
|
80
80
|
identifiable: layer.queryable,
|
|
81
81
|
scaleRange: layer.scaleRange,
|
|
82
82
|
opacity: layer.opacity,
|
|
83
|
-
vendorFields: buildVendorFields(wfsSource)
|
|
83
|
+
vendorFields: { ...buildVendorFields(wfsSource), ...primaryKeyField(layer) }
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
@@ -146,6 +146,16 @@ function buildVendorFields(wfsSource) {
|
|
|
146
146
|
fields['quac:wfs_type_name'] = wfsSource.typeName;
|
|
147
147
|
return fields;
|
|
148
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* The layer's `quac:primary_key`, where QGIS Server lists one and every field
|
|
151
|
+
* of it is among the layer's attributes: part of a key identifies nothing.
|
|
152
|
+
*/
|
|
153
|
+
function primaryKeyField(layer) {
|
|
154
|
+
const names = new Set(layer.attributes.map((attribute) => attribute.name));
|
|
155
|
+
if (layer.primaryKey.length === 0 || layer.primaryKey.some((name) => !names.has(name)))
|
|
156
|
+
return {};
|
|
157
|
+
return { 'quac:primary_key': layer.attributes.filter((attribute) => layer.primaryKey.includes(attribute.name)).map((attribute) => attribute.name) };
|
|
158
|
+
}
|
|
149
159
|
function wmsBboxToNormalized(bbox) {
|
|
150
160
|
return {
|
|
151
161
|
xmin: bbox.westBoundLongitude,
|
|
@@ -175,7 +185,7 @@ function deriveTableColumnsFromAttributes(attributes) {
|
|
|
175
185
|
const stacType = mapQtTypeToStacTableType(attr.type, attr.typeName);
|
|
176
186
|
if (stacType)
|
|
177
187
|
column.type = stacType;
|
|
178
|
-
return column;
|
|
188
|
+
return withFieldSize(column, attr.length, attr.precision);
|
|
179
189
|
});
|
|
180
190
|
}
|
|
181
191
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export { FILE_EXTENSION, FILE_SIZE_FIELD, TABLE_ROW_COUNT_FIELD, readCollectionR
|
|
|
34
34
|
export { PMTILES_MEDIA_TYPE, VISUAL_ROLE, readCollectionPmtiles } from './model/stacPmtiles.ts';
|
|
35
35
|
export type { StacPmtilesSource } from './model/stacPmtiles.ts';
|
|
36
36
|
export type { StacCompanionData } from './generate/stacCatalogue.ts';
|
|
37
|
-
export { QUAC_ACTIVE_COLLECTION_FIELD, QUAC_FILTERS_FIELD, QUAC_FORM_ORDER_FIELD, QUAC_LOCKS_FIELD, QUAC_MUTUALLY_EXCLUSIVE_FIELD, QUAC_PRIVATE_FIELD, readCatalogueActiveCollection, readCatalogueInitialView, readCollectionDisplayField, readCollectionEditable, readCollectionFieldAliases, readCollectionFieldComments, readCollectionFieldAttachments, readCollectionFieldEditRules, readCollectionFieldNames, readCollectionFieldTypes, readCollectionFieldValueRelations, readCollectionFieldValues, readCollectionFormLayout, readCollectionGeometryType, readCollectionIdentifiable, readCollectionMeasurement, readCollectionOpacity, readCollectionIcon, readCollectionAddedMessage, readCollectionLegendImage, readCollectionFilters, readCollectionLocks, readCollectionPrivate, readCollectionRelatedTo, readCollectionScaleRange, readCollectionVisibility, statedOpacity } from './generate/normalizedProject.ts';
|
|
37
|
+
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, readCollectionLegendImage, readCollectionFilters, readCollectionLocks, readCollectionPrivate, readCollectionRelatedTo, readCollectionScaleRange, readCollectionVisibility, statedOpacity } from './generate/normalizedProject.ts';
|
|
38
38
|
export type { CollectionFilter, CollectionFormLayout, CollectionRelation, CollectionRelationField } from './generate/normalizedProject.ts';
|
|
39
39
|
export { generateStacCatalogueFromWfsCapabilities } from './generate/wfsStacCatalogue.ts';
|
|
40
40
|
export type { WfsStacCatalogueOptions } from './generate/wfsStacCatalogue.ts';
|
|
@@ -49,7 +49,8 @@ export type { ArcgisStacCatalogueOptions } from './generate/arcgisStacCatalogue.
|
|
|
49
49
|
export { normalizeExternalStacCatalogue, parseWfsGetFeatureUrl, resolveWfsCollectionSource } from './generate/externalStacCatalogue.ts';
|
|
50
50
|
export { decodeItemRowId, describeItem, encodeItemRowId, itemAsCollection, ITEMS_PAGE_SIZE, readItemsHref, readItemTimestamp, sortItemsNewestFirst } from './sources/stacItems.ts';
|
|
51
51
|
export { stripQgisServerQuery } from './sources/qgisServerUrl.ts';
|
|
52
|
-
export type {
|
|
52
|
+
export type { PrintLayoutTemplate } from './model/QgsProject.ts';
|
|
53
|
+
export type { WmsProject, WmsLayerTreeNode, WmsLayer, WmsLayerGroup, WmsBoundingBox, WmsStyle, WmsAttribute, WmsPrintLayout, WmsPrintLayoutMap } from './model/WmsProject.ts';
|
|
53
54
|
export { parseGetProjectSettings } from './parse/parseGetProjectSettings.ts';
|
|
54
55
|
export { generateStacCatalogueFromWms } from './generate/wmsStacCatalogue.ts';
|
|
55
56
|
export type { WmsStacCatalogueOptions } from './generate/wmsStacCatalogue.ts';
|
package/dist/index.js
CHANGED
|
@@ -23,7 +23,7 @@ export { DATA_ROLE, findAssetByRole, readDataAsset } from "./model/stacAssetRole
|
|
|
23
23
|
export { THUMBNAIL_ROLE, readCollectionAttribution, readCollectionDeprecation, readCollectionSelfHref, readCollectionThumbnail } from "./model/stacCollectionNotes.js";
|
|
24
24
|
export { FILE_EXTENSION, FILE_SIZE_FIELD, TABLE_ROW_COUNT_FIELD, readCollectionRowCount, readDataAssetFileSize } from "./model/stacSizeAndCount.js";
|
|
25
25
|
export { PMTILES_MEDIA_TYPE, VISUAL_ROLE, readCollectionPmtiles } from "./model/stacPmtiles.js";
|
|
26
|
-
export { QUAC_ACTIVE_COLLECTION_FIELD, QUAC_FILTERS_FIELD, QUAC_FORM_ORDER_FIELD, QUAC_LOCKS_FIELD, QUAC_MUTUALLY_EXCLUSIVE_FIELD, QUAC_PRIVATE_FIELD, readCatalogueActiveCollection, readCatalogueInitialView, readCollectionDisplayField, readCollectionEditable, readCollectionFieldAliases, readCollectionFieldComments, readCollectionFieldAttachments, readCollectionFieldEditRules, readCollectionFieldNames, readCollectionFieldTypes, readCollectionFieldValueRelations, readCollectionFieldValues, readCollectionFormLayout, readCollectionGeometryType, readCollectionIdentifiable, readCollectionMeasurement, readCollectionOpacity, readCollectionIcon, readCollectionAddedMessage, readCollectionLegendImage, readCollectionFilters, readCollectionLocks, readCollectionPrivate, readCollectionRelatedTo, readCollectionScaleRange, readCollectionVisibility, statedOpacity } from "./generate/normalizedProject.js";
|
|
26
|
+
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, readCollectionLegendImage, readCollectionFilters, readCollectionLocks, readCollectionPrivate, readCollectionRelatedTo, readCollectionScaleRange, readCollectionVisibility, statedOpacity } from "./generate/normalizedProject.js";
|
|
27
27
|
export { generateStacCatalogueFromWfsCapabilities } from "./generate/wfsStacCatalogue.js";
|
|
28
28
|
export { generateStacCatalogueFromFolder } from "./generate/folderStacCatalogue.js";
|
|
29
29
|
export { generateCollectionForDroppedFile, generateCollectionForLinkedFile } from "./generate/fileLayerCollection.js";
|
|
@@ -66,9 +66,19 @@ export interface QgsProject {
|
|
|
66
66
|
* notes are not written into the catalogue.
|
|
67
67
|
*/
|
|
68
68
|
notes?: ProjectNote[];
|
|
69
|
+
/**
|
|
70
|
+
* The project's print layouts, in its order (`parsePrintLayouts`); absent or
|
|
71
|
+
* empty where it has none.
|
|
72
|
+
*/
|
|
73
|
+
printLayouts?: PrintLayoutTemplate[];
|
|
69
74
|
/** Original full QGS XML, retained so future parsers can re-mine without re-loading. */
|
|
70
75
|
rawXml: string | null;
|
|
71
76
|
}
|
|
77
|
+
/** A print layout as its name and its `<Layout>` element, which is a QGIS layout template. */
|
|
78
|
+
export interface PrintLayoutTemplate {
|
|
79
|
+
name: string;
|
|
80
|
+
template: string;
|
|
81
|
+
}
|
|
72
82
|
/**
|
|
73
83
|
* Why a project's setting is not in its catalogue:
|
|
74
84
|
*
|
|
@@ -226,8 +236,9 @@ export interface LayerEntry {
|
|
|
226
236
|
fieldAliases: Record<string, string>;
|
|
227
237
|
/**
|
|
228
238
|
* Each field's comment from the Attributes Form's Comment, a custom comment
|
|
229
|
-
* QGIS 4.2 and later saves in the project as `<customComments>`.
|
|
230
|
-
*
|
|
239
|
+
* QGIS 4.2 and later saves in the project as `<customComments>`. A blank one,
|
|
240
|
+
* which hides the comment the field's data gives, is an empty string. Fields
|
|
241
|
+
* with none are absent.
|
|
231
242
|
*/
|
|
232
243
|
fieldComments?: Record<string, string>;
|
|
233
244
|
/**
|
package/dist/model/Stac.d.ts
CHANGED
|
@@ -190,6 +190,12 @@ export interface TableColumn {
|
|
|
190
190
|
'quac:editable_when'?: string;
|
|
191
191
|
/** The `https://` address of the icon drawn beside the column's name. */
|
|
192
192
|
'quac:icon'?: string;
|
|
193
|
+
/** The most characters a text column holds, or the most digits a number column holds, as its data defines the field. */
|
|
194
|
+
'quac:length'?: number;
|
|
195
|
+
/** The most digits after the decimal point a number column holds, as its data defines the field. */
|
|
196
|
+
'quac:precision'?: number;
|
|
197
|
+
/** Written only as `true`: the data gives the column a value of its own when a new feature leaves it empty. */
|
|
198
|
+
'quac:filled_by_data'?: true;
|
|
193
199
|
/** The control the source asks the edit form to draw the column's choices with. */
|
|
194
200
|
'quac:control'?: 'buttons' | 'dropdown';
|
|
195
201
|
/** Written only as `true`: the source's form puts the column's name above its value. */
|
|
@@ -22,9 +22,40 @@ export interface WmsProject {
|
|
|
22
22
|
layerTree: WmsLayerTreeNode[];
|
|
23
23
|
/** Names of layers exposed via WFS (subset of the layer tree). */
|
|
24
24
|
wfsLayerNames: string[];
|
|
25
|
+
/** The print layouts the server can print with GetPrint, in the order it lists them. */
|
|
26
|
+
printLayouts: WmsPrintLayout[];
|
|
25
27
|
/** Full source XML, retained so future enhancements can re-mine. */
|
|
26
28
|
rawXml: string | null;
|
|
27
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* A print layout as GetProjectSettings lists it, in `<ComposerTemplates>`
|
|
32
|
+
* (`getComposerTemplatesElement`, `src/server/services/wms/qgswmsgetcapabilities.cpp`,
|
|
33
|
+
* `qgis/QGIS@master`, read 2026-11-25). Sizes are in millimetres.
|
|
34
|
+
*/
|
|
35
|
+
export interface WmsPrintLayout {
|
|
36
|
+
/** The layout's name: GetPrint's `TEMPLATE`. */
|
|
37
|
+
name: string;
|
|
38
|
+
/** The first page's width. */
|
|
39
|
+
width: number;
|
|
40
|
+
/** The first page's height. */
|
|
41
|
+
height: number;
|
|
42
|
+
/** Whether the layout's atlas is on: GetPrint's `ATLAS_PK` then prints chosen features. */
|
|
43
|
+
isAtlasEnabled: boolean;
|
|
44
|
+
/** The atlas's coverage layer, by the name GetPrint's `LAYERS` uses; null when none is listed. */
|
|
45
|
+
atlasCoverageLayer: string | null;
|
|
46
|
+
/** The layout's map items. */
|
|
47
|
+
maps: WmsPrintLayoutMap[];
|
|
48
|
+
/** The IDs of the layout's labels; a label with no ID is not listed. */
|
|
49
|
+
labelIds: string[];
|
|
50
|
+
}
|
|
51
|
+
export interface WmsPrintLayoutMap {
|
|
52
|
+
/** The map item's name in GetPrint parameters, such as `map0` in `map0:EXTENT`. */
|
|
53
|
+
name: string;
|
|
54
|
+
/** The map item's name in the layout, as QGIS shows it. */
|
|
55
|
+
itemName: string;
|
|
56
|
+
width: number;
|
|
57
|
+
height: number;
|
|
58
|
+
}
|
|
28
59
|
export interface WmsBoundingBox {
|
|
29
60
|
westBoundLongitude: number;
|
|
30
61
|
eastBoundLongitude: number;
|
|
@@ -76,6 +107,8 @@ export interface WmsLayer {
|
|
|
76
107
|
styles: WmsStyle[];
|
|
77
108
|
/** Attribute schema (vector layers; empty for raster). */
|
|
78
109
|
attributes: WmsAttribute[];
|
|
110
|
+
/** The names of the fields of the layer's primary key, as `<PrimaryKey>` lists them; empty where it lists none. */
|
|
111
|
+
primaryKey: string[];
|
|
79
112
|
/** Display name in the layer panel. */
|
|
80
113
|
treeName: string;
|
|
81
114
|
}
|
|
@@ -23,5 +23,9 @@ export declare function resolveFieldIconAddress(value: string): string | null;
|
|
|
23
23
|
* name `@latest` or an exact release.
|
|
24
24
|
*/
|
|
25
25
|
export declare function isIconLibraryAddress(url: string): boolean;
|
|
26
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* The address as the URL parser writes it, or null where it is not an
|
|
28
|
+
* `https://` address or holds a user name or password, which a catalogue
|
|
29
|
+
* would otherwise publish.
|
|
30
|
+
*/
|
|
27
31
|
export declare function readHttpsAddress(value: unknown): string | null;
|
|
@@ -79,13 +79,17 @@ export function isIconLibraryAddress(url) {
|
|
|
79
79
|
const rest = url.slice(JSDELIVR_NPM.length);
|
|
80
80
|
return Object.values(ICON_LIBRARIES).some((library) => rest.startsWith(`${library.packageName}@`) || rest.startsWith(`${library.packageName}/`));
|
|
81
81
|
}
|
|
82
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* The address as the URL parser writes it, or null where it is not an
|
|
84
|
+
* `https://` address or holds a user name or password, which a catalogue
|
|
85
|
+
* would otherwise publish.
|
|
86
|
+
*/
|
|
83
87
|
export function readHttpsAddress(value) {
|
|
84
88
|
if (typeof value !== 'string')
|
|
85
89
|
return null;
|
|
86
90
|
try {
|
|
87
91
|
const url = new URL(value.trim());
|
|
88
|
-
return url.protocol === 'https:' ? url.href : null;
|
|
92
|
+
return url.protocol === 'https:' && !url.username && !url.password ? url.href : null;
|
|
89
93
|
}
|
|
90
94
|
catch {
|
|
91
95
|
return null;
|
|
@@ -106,6 +106,8 @@ export function parseDataSource(raw, providerHint = null) {
|
|
|
106
106
|
const url = params.url;
|
|
107
107
|
const typeName = params.typename ?? params.typeName;
|
|
108
108
|
if (url && typeName) {
|
|
109
|
+
if (wfsSourceSignsIn(params))
|
|
110
|
+
return { kind: 'unsupported', raw, hint: providerHint ?? 'WFS' };
|
|
109
111
|
// QGIS sends the server a `SELECT` statement where the source has one, and the `filter`
|
|
110
112
|
// otherwise (`QgsWFSProvider::QgsWFSProvider`, `src/providers/wfs/qgswfsprovider.cpp`,
|
|
111
113
|
// `qgis/QGIS@master`, read 2026-10-26).
|
|
@@ -148,6 +150,14 @@ function needsCredentialsOrHeaders(params) {
|
|
|
148
150
|
}
|
|
149
151
|
return false;
|
|
150
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* Whether a WFS source signs in to its server: QGIS reads its login from
|
|
155
|
+
* `authcfg`, or a user name from `user` or `username` and a `password`
|
|
156
|
+
* (`QgsDataSourceUri`, QGIS 3.34).
|
|
157
|
+
*/
|
|
158
|
+
function wfsSourceSignsIn(params) {
|
|
159
|
+
return ['authcfg', 'user', 'username', 'password'].some((key) => params[key]?.trim());
|
|
160
|
+
}
|
|
151
161
|
/**
|
|
152
162
|
* An XYZ tile layer. QGIS's `{q}` is Bing's quadkey, written as the `{quadkey}`
|
|
153
163
|
* the tile layer fills in. Null for a template that is not an absolute
|
|
@@ -407,12 +417,14 @@ function basename(pathLike) {
|
|
|
407
417
|
*/
|
|
408
418
|
function parseSpaceSeparatedKeyValues(raw) {
|
|
409
419
|
const out = {};
|
|
410
|
-
// Match key='...'
|
|
411
|
-
|
|
420
|
+
// Match key='...', key="..." or a bare key=value, which is how QGIS writes `authcfg`
|
|
421
|
+
// (`QgsDataSourceUri::uri`, QGIS 3.34).
|
|
422
|
+
// A bare value starts straight after `=`, so a key written with no value never takes the next pair.
|
|
423
|
+
const re = /(\w+)\s*(?:=\s*'((?:\\.|[^'\\])*)'|=\s*"((?:\\.|[^"\\])*)"|=([^\s'"]+))/g;
|
|
412
424
|
let m;
|
|
413
425
|
while ((m = re.exec(raw)) !== null) {
|
|
414
426
|
const key = m[1];
|
|
415
|
-
const value = (m[2] ?? m[3] ?? '').replace(/\\(.)/g, '$1');
|
|
427
|
+
const value = m[4] ?? (m[2] ?? m[3] ?? '').replace(/\\(.)/g, '$1');
|
|
416
428
|
out[key] = value;
|
|
417
429
|
}
|
|
418
430
|
return out;
|
|
@@ -5,8 +5,9 @@ import type { WmsProject } from '../model/WmsProject.ts';
|
|
|
5
5
|
*
|
|
6
6
|
* The response is a WMS_Capabilities document with QGIS-specific extensions
|
|
7
7
|
* for `displayField`, `geometryType`, `visibilityChecked`, `<Attributes>`
|
|
8
|
-
* and `<
|
|
9
|
-
* generation and ignore what isn't (e.g.
|
|
8
|
+
* `<WFSLayers>` and `<ComposerTemplates>`. We capture what's useful for STAC +
|
|
9
|
+
* app-config generation and for printing a layout, and ignore what isn't (e.g.
|
|
10
|
+
* GetMap / GetPrint format lists).
|
|
10
11
|
*
|
|
11
12
|
* Throws when the XML is unparseable or has the wrong root element.
|
|
12
13
|
* Sub-elements that fail to parse log via devLog and yield null/empty
|
|
@@ -5,8 +5,9 @@ import { devLog } from "../util/devLog.js";
|
|
|
5
5
|
*
|
|
6
6
|
* The response is a WMS_Capabilities document with QGIS-specific extensions
|
|
7
7
|
* for `displayField`, `geometryType`, `visibilityChecked`, `<Attributes>`
|
|
8
|
-
* and `<
|
|
9
|
-
* generation and ignore what isn't (e.g.
|
|
8
|
+
* `<WFSLayers>` and `<ComposerTemplates>`. We capture what's useful for STAC +
|
|
9
|
+
* app-config generation and for printing a layout, and ignore what isn't (e.g.
|
|
10
|
+
* GetMap / GetPrint format lists).
|
|
10
11
|
*
|
|
11
12
|
* Throws when the XML is unparseable or has the wrong root element.
|
|
12
13
|
* Sub-elements that fail to parse log via devLog and yield null/empty
|
|
@@ -38,10 +39,13 @@ export function parseGetProjectSettings(xmlText) {
|
|
|
38
39
|
const wfsLayerNames = Array.from(capability?.querySelectorAll(':scope > WFSLayers > WFSLayer') ?? [])
|
|
39
40
|
.map((node) => node.getAttribute('name'))
|
|
40
41
|
.filter((name) => Boolean(name));
|
|
42
|
+
const printLayouts = Array.from(capability?.querySelectorAll(':scope > ComposerTemplates > ComposerTemplate') ?? [])
|
|
43
|
+
.map(parsePrintLayout);
|
|
41
44
|
devLog('qgs/parseGetProjectSettings', 'parsed WMS project', {
|
|
42
45
|
title,
|
|
43
46
|
rootLayerCount: layerTree.length,
|
|
44
|
-
wfsLayerCount: wfsLayerNames.length
|
|
47
|
+
wfsLayerCount: wfsLayerNames.length,
|
|
48
|
+
printLayoutCount: printLayouts.length
|
|
45
49
|
});
|
|
46
50
|
return {
|
|
47
51
|
title,
|
|
@@ -49,9 +53,29 @@ export function parseGetProjectSettings(xmlText) {
|
|
|
49
53
|
bbox: projectBbox,
|
|
50
54
|
layerTree,
|
|
51
55
|
wfsLayerNames,
|
|
56
|
+
printLayouts,
|
|
52
57
|
rawXml: xmlText
|
|
53
58
|
};
|
|
54
59
|
}
|
|
60
|
+
function parsePrintLayout(element) {
|
|
61
|
+
const maps = Array.from(element.querySelectorAll(':scope > ComposerMap')).map((map) => ({
|
|
62
|
+
name: map.getAttribute('name') ?? '',
|
|
63
|
+
itemName: map.getAttribute('itemName') ?? '',
|
|
64
|
+
width: Number(map.getAttribute('width')) || 0,
|
|
65
|
+
height: Number(map.getAttribute('height')) || 0
|
|
66
|
+
}));
|
|
67
|
+
return {
|
|
68
|
+
name: element.getAttribute('name') ?? '',
|
|
69
|
+
width: Number(element.getAttribute('width')) || 0,
|
|
70
|
+
height: Number(element.getAttribute('height')) || 0,
|
|
71
|
+
isAtlasEnabled: element.getAttribute('atlasEnabled') === '1',
|
|
72
|
+
atlasCoverageLayer: element.getAttribute('atlasCoverageLayer') || null,
|
|
73
|
+
maps,
|
|
74
|
+
labelIds: Array.from(element.querySelectorAll(':scope > ComposerLabel'))
|
|
75
|
+
.map((label) => label.getAttribute('name') ?? '')
|
|
76
|
+
.filter(Boolean)
|
|
77
|
+
};
|
|
78
|
+
}
|
|
55
79
|
function bboxOf(node) {
|
|
56
80
|
return node.kind === 'layer' ? node.bbox : node.bbox;
|
|
57
81
|
}
|
|
@@ -106,6 +130,10 @@ function parseLeafLayer(layerEl, name, title, bbox, visibilityChecked, treeName)
|
|
|
106
130
|
editType: attrEl.getAttribute('editType') ?? '',
|
|
107
131
|
comment: attrEl.getAttribute('comment') ?? ''
|
|
108
132
|
})).filter((a) => a.name);
|
|
133
|
+
// QGIS Server lists the key's fields by name, the ones it leaves out of `<Attributes>` among them (`qgswmsgetcapabilities.cpp`, `qgis/QGIS@master`, read 2026-11-25).
|
|
134
|
+
const primaryKey = Array.from(layerEl.querySelectorAll(':scope > PrimaryKey > PrimaryKeyAttribute'))
|
|
135
|
+
.map((node) => node.textContent?.trim() ?? '')
|
|
136
|
+
.filter(Boolean);
|
|
109
137
|
const crsList = Array.from(layerEl.querySelectorAll(':scope > CRS'))
|
|
110
138
|
.map((node) => node.textContent?.trim() ?? '')
|
|
111
139
|
.filter(Boolean);
|
|
@@ -123,6 +151,7 @@ function parseLeafLayer(layerEl, name, title, bbox, visibilityChecked, treeName)
|
|
|
123
151
|
crsList,
|
|
124
152
|
styles,
|
|
125
153
|
attributes,
|
|
154
|
+
primaryKey,
|
|
126
155
|
treeName
|
|
127
156
|
};
|
|
128
157
|
}
|
|
@@ -6,6 +6,7 @@ import { parseLayerStyles } from "./parseStyle.js";
|
|
|
6
6
|
import { readQgisExpression, unescapeStringLiteral } from "./qgisExpression.js";
|
|
7
7
|
import { resolveFieldIconAddress } from "../model/fieldIconAddress.js";
|
|
8
8
|
import { devLog } from "../util/devLog.js";
|
|
9
|
+
import { nameRecord } from "../util/nameRecord.js";
|
|
9
10
|
/**
|
|
10
11
|
* Parses the <projectlayers> block into a list of LayerEntry. Annotation
|
|
11
12
|
* layers (<main-annotation-layer>) are filtered out — they're QGIS's drawing
|
|
@@ -310,7 +311,7 @@ const VALUE_MAP_NULL_CODE = '{2839923C-8B7D-419E-B84B-CA2FE9B80EC7}';
|
|
|
310
311
|
* returned map.
|
|
311
312
|
*/
|
|
312
313
|
function parseFieldValueMaps(maplayer) {
|
|
313
|
-
const result =
|
|
314
|
+
const result = nameRecord();
|
|
314
315
|
for (const [name, editWidget] of layerEditWidgets(maplayer)) {
|
|
315
316
|
if (result[name])
|
|
316
317
|
continue;
|
|
@@ -365,7 +366,7 @@ function parseFieldValueMaps(maplayer) {
|
|
|
365
366
|
* A field with no ValueRelation widget is absent from the returned map.
|
|
366
367
|
*/
|
|
367
368
|
function parseFieldValueRelations(maplayer) {
|
|
368
|
-
const result =
|
|
369
|
+
const result = nameRecord();
|
|
369
370
|
for (const [name, editWidget] of layerEditWidgets(maplayer)) {
|
|
370
371
|
if (result[name])
|
|
371
372
|
continue;
|
|
@@ -441,7 +442,7 @@ const SINGLE_FILE_STORAGE_MODES = new Set([0, 3]);
|
|
|
441
442
|
* A field with no ExternalResource widget is absent from the returned map.
|
|
442
443
|
*/
|
|
443
444
|
function parseFieldAttachments(maplayer) {
|
|
444
|
-
const result =
|
|
445
|
+
const result = nameRecord();
|
|
445
446
|
for (const [name, editWidget] of layerEditWidgets(maplayer)) {
|
|
446
447
|
if (result[name])
|
|
447
448
|
continue;
|
|
@@ -499,7 +500,7 @@ const NOW_EXPRESSIONS = new Set(['now()', '$now', 'to_date(now())', 'to_datetime
|
|
|
499
500
|
* settings is absent from the returned map.
|
|
500
501
|
*/
|
|
501
502
|
function parseFieldEditRules(maplayer, note) {
|
|
502
|
-
const result =
|
|
503
|
+
const result = nameRecord();
|
|
503
504
|
const ruleFor = (name) => {
|
|
504
505
|
result[name] ??= { readOnly: false, defaultValue: null, notNull: null, unique: null, hidden: false, reuseLastValue: false, duplicatePolicy: null };
|
|
505
506
|
return result[name];
|
|
@@ -912,7 +913,7 @@ function parseFieldNames(maplayer) {
|
|
|
912
913
|
* per field, which is the active-style block's when both are present.
|
|
913
914
|
*/
|
|
914
915
|
function parseFieldAliases(maplayer) {
|
|
915
|
-
const out =
|
|
916
|
+
const out = nameRecord();
|
|
916
917
|
const nodes = maplayer.querySelectorAll('aliases > alias');
|
|
917
918
|
for (const node of Array.from(nodes)) {
|
|
918
919
|
const field = node.getAttribute('field');
|
|
@@ -934,20 +935,18 @@ function parseFieldAliases(maplayer) {
|
|
|
934
935
|
* (`QgsVectorLayer::readSymbology` and `writeSymbology`,
|
|
935
936
|
* `src/core/vector/qgsvectorlayer.cpp`, `qgis/QGIS@master`, read 2026-11-19).
|
|
936
937
|
* A blank comment, which QGIS saves to hide the comment the field's data gives,
|
|
937
|
-
* is
|
|
938
|
-
*
|
|
938
|
+
* is kept as an empty string, so a producer that has the data's comment knows
|
|
939
|
+
* to leave it out (`QgsAttributeForm`, `src/gui/qgsattributeform.cpp`, same
|
|
940
|
+
* revision, read 2026-11-25). Where two entries name a field, the later
|
|
941
|
+
* stands, as QGIS's map of them keeps it.
|
|
939
942
|
*/
|
|
940
943
|
function parseFieldComments(maplayer) {
|
|
941
|
-
const out =
|
|
944
|
+
const out = nameRecord();
|
|
942
945
|
for (const node of directChild(maplayer, 'customComments')?.querySelectorAll(':scope > customComment') ?? []) {
|
|
943
946
|
const field = node.getAttribute('field');
|
|
944
947
|
if (!field)
|
|
945
948
|
continue;
|
|
946
|
-
|
|
947
|
-
if (comment)
|
|
948
|
-
out[field] = comment;
|
|
949
|
-
else
|
|
950
|
-
delete out[field];
|
|
949
|
+
out[field] = node.getAttribute('value')?.trim() ?? '';
|
|
951
950
|
}
|
|
952
951
|
return out;
|
|
953
952
|
}
|
|
@@ -982,7 +981,7 @@ const FIELD_ICON_VARIABLE_PREFIX = 'quac_icon_';
|
|
|
982
981
|
* 2026-10-25).
|
|
983
982
|
*/
|
|
984
983
|
function parseFieldIcons(maplayer) {
|
|
985
|
-
const icons =
|
|
984
|
+
const icons = nameRecord();
|
|
986
985
|
for (const [field, value] of readFieldVariables(maplayer, FIELD_ICON_VARIABLE_PREFIX)) {
|
|
987
986
|
const address = resolveFieldIconAddress(value);
|
|
988
987
|
if (address)
|
|
@@ -1034,7 +1033,7 @@ const FIELD_CONTROL_VARIABLE_PREFIX = 'quac_control_';
|
|
|
1034
1033
|
* out.
|
|
1035
1034
|
*/
|
|
1036
1035
|
function parseFieldControls(maplayer) {
|
|
1037
|
-
const controls =
|
|
1036
|
+
const controls = nameRecord();
|
|
1038
1037
|
for (const [field, value] of readFieldVariables(maplayer, FIELD_CONTROL_VARIABLE_PREFIX)) {
|
|
1039
1038
|
const control = value.trim().toLowerCase();
|
|
1040
1039
|
if (control === 'buttons' || control === 'dropdown')
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { PrintLayoutTemplate } from '../model/QgsProject.ts';
|
|
2
|
+
/**
|
|
3
|
+
* The project's print layouts, from `<qgis><Layouts>`, each as its name and its
|
|
4
|
+
* `<Layout>` element written out by `writeLayoutTemplate`. That element is what
|
|
5
|
+
* QGIS saves as a layout template (`.qpt`): `QgsLayout::saveAsTemplate` writes
|
|
6
|
+
* the same `writeXml` element as the only element of the file
|
|
7
|
+
* (`src/core/layout/qgslayout.cpp`, `qgis/QGIS@master`, read 2026-11-25).
|
|
8
|
+
*
|
|
9
|
+
* A layout whose name the project leaves out of WMS, under Project Properties →
|
|
10
|
+
* QGIS Server → WMS capabilities → **Exclude layouts**, saved as
|
|
11
|
+
* `WMSRestrictedComposers` (`QgsServerProjectUtils::wmsRestrictedComposers`,
|
|
12
|
+
* `src/server/qgsserverprojectutils.cpp`, same revision), is left out, as its
|
|
13
|
+
* excluded layers are. Reports are not read.
|
|
14
|
+
*/
|
|
15
|
+
export declare function parsePrintLayouts(qgisRoot: Element): PrintLayoutTemplate[];
|
|
16
|
+
/**
|
|
17
|
+
* A layout element as XML text, written by one fixed rule so that the
|
|
18
|
+
* plugin's Python writes the same text: attributes in the order the document
|
|
19
|
+
* holds them, an element with no children closed as `<name/>`, text that is
|
|
20
|
+
* only white space left out, comments and processing instructions left out,
|
|
21
|
+
* and `&`, `<`, `>` escaped everywhere, with `"`, tab, line feed and carriage
|
|
22
|
+
* return escaped in attribute values too.
|
|
23
|
+
*
|
|
24
|
+
* It holds no layer's data source and no absolute path: each `SOURCE_ATTRIBUTE`
|
|
25
|
+
* is left out, and an attribute whose value is an `ABSOLUTE_PATH` is written
|
|
26
|
+
* empty.
|
|
27
|
+
*/
|
|
28
|
+
export declare function writeLayoutTemplate(element: Element): string;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { propertyList } from "./projectProperties.js";
|
|
2
|
+
/**
|
|
3
|
+
* The project's print layouts, from `<qgis><Layouts>`, each as its name and its
|
|
4
|
+
* `<Layout>` element written out by `writeLayoutTemplate`. That element is what
|
|
5
|
+
* QGIS saves as a layout template (`.qpt`): `QgsLayout::saveAsTemplate` writes
|
|
6
|
+
* the same `writeXml` element as the only element of the file
|
|
7
|
+
* (`src/core/layout/qgslayout.cpp`, `qgis/QGIS@master`, read 2026-11-25).
|
|
8
|
+
*
|
|
9
|
+
* A layout whose name the project leaves out of WMS, under Project Properties →
|
|
10
|
+
* QGIS Server → WMS capabilities → **Exclude layouts**, saved as
|
|
11
|
+
* `WMSRestrictedComposers` (`QgsServerProjectUtils::wmsRestrictedComposers`,
|
|
12
|
+
* `src/server/qgsserverprojectutils.cpp`, same revision), is left out, as its
|
|
13
|
+
* excluded layers are. Reports are not read.
|
|
14
|
+
*/
|
|
15
|
+
export function parsePrintLayouts(qgisRoot) {
|
|
16
|
+
const properties = qgisRoot.querySelector(':scope > properties');
|
|
17
|
+
const restricted = new Set(properties ? propertyList(properties, 'WMSRestrictedComposers') : []);
|
|
18
|
+
return Array.from(qgisRoot.querySelectorAll(':scope > Layouts > Layout'))
|
|
19
|
+
.map((layout) => ({ name: layout.getAttribute('name') ?? '', template: writeLayoutTemplate(layout) }))
|
|
20
|
+
.filter((layout) => !restricted.has(layout.name));
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* An attribute QGIS writes a layer's data source or provider in: `source` and
|
|
24
|
+
* `provider` on a map item's `<Layer>`, and `coverageLayerSource`,
|
|
25
|
+
* `vectorLayerSource` and the like, which a data source's password or file
|
|
26
|
+
* path can be in.
|
|
27
|
+
*/
|
|
28
|
+
const SOURCE_ATTRIBUTE = /^(source|provider)$|(Source|Provider)$/;
|
|
29
|
+
/**
|
|
30
|
+
* A value that is a path on the computer that saved the project: from the
|
|
31
|
+
* root of a disk or a home folder (`~/`), a drive, a network share, or a
|
|
32
|
+
* `file:` address. It is narrower than `isProjectRelativeFolder`'s test of an
|
|
33
|
+
* Attachment folder, because it reads every attribute of a layout, label text
|
|
34
|
+
* included, so a value such as `Address: 12 Main St` is not taken for an
|
|
35
|
+
* address.
|
|
36
|
+
*/
|
|
37
|
+
const ABSOLUTE_PATH = /^\s*(\/|\\|~[\\/]|[A-Za-z]:([\\/]|$)|file:)/i;
|
|
38
|
+
/**
|
|
39
|
+
* A layout element as XML text, written by one fixed rule so that the
|
|
40
|
+
* plugin's Python writes the same text: attributes in the order the document
|
|
41
|
+
* holds them, an element with no children closed as `<name/>`, text that is
|
|
42
|
+
* only white space left out, comments and processing instructions left out,
|
|
43
|
+
* and `&`, `<`, `>` escaped everywhere, with `"`, tab, line feed and carriage
|
|
44
|
+
* return escaped in attribute values too.
|
|
45
|
+
*
|
|
46
|
+
* It holds no layer's data source and no absolute path: each `SOURCE_ATTRIBUTE`
|
|
47
|
+
* is left out, and an attribute whose value is an `ABSOLUTE_PATH` is written
|
|
48
|
+
* empty.
|
|
49
|
+
*/
|
|
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
|
+
const children = Array.from(element.childNodes)
|
|
56
|
+
.map((child) => {
|
|
57
|
+
if (child.nodeType === 1)
|
|
58
|
+
return writeLayoutTemplate(child);
|
|
59
|
+
if (child.nodeType === 3 || child.nodeType === 4) {
|
|
60
|
+
const text = child.nodeValue ?? '';
|
|
61
|
+
return text.trim() === '' ? '' : escapeText(text);
|
|
62
|
+
}
|
|
63
|
+
return '';
|
|
64
|
+
})
|
|
65
|
+
.join('');
|
|
66
|
+
return children === ''
|
|
67
|
+
? `<${element.tagName}${attributes}/>`
|
|
68
|
+
: `<${element.tagName}${attributes}>${children}</${element.tagName}>`;
|
|
69
|
+
}
|
|
70
|
+
function escapeText(text) {
|
|
71
|
+
return text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
72
|
+
}
|
|
73
|
+
function escapeAttribute(value) {
|
|
74
|
+
return escapeText(value)
|
|
75
|
+
.replace(/"/g, '"')
|
|
76
|
+
.replace(/\t/g, '	')
|
|
77
|
+
.replace(/\n/g, ' ')
|
|
78
|
+
.replace(/\r/g, ' ');
|
|
79
|
+
}
|
|
@@ -5,6 +5,7 @@ import { parseProjectLayers } from "./parseLayers.js";
|
|
|
5
5
|
import { parseLegendTree } from "./parseLegendTree.js";
|
|
6
6
|
import { parseProjectMeasurement } from "./parseMeasurement.js";
|
|
7
7
|
import { parseMerginFilters } from "./parseMergin.js";
|
|
8
|
+
import { parsePrintLayouts } from "./parsePrintLayouts.js";
|
|
8
9
|
import { parseProjectVariables } from "./parseProjectVariables.js";
|
|
9
10
|
import { parseInitialActiveLayerId, parseWfsTransactionLayers } from "./parseQfieldSync.js";
|
|
10
11
|
import { parseProjectRelations } from "./parseRelations.js";
|
|
@@ -88,6 +89,7 @@ export function parseQgsXml(xmlText) {
|
|
|
88
89
|
wmsCrsList: parseWmsCrsList(qgisRoot),
|
|
89
90
|
merginFilters,
|
|
90
91
|
notes,
|
|
92
|
+
printLayouts: parsePrintLayouts(qgisRoot),
|
|
91
93
|
rawXml: xmlText
|
|
92
94
|
};
|
|
93
95
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An empty record to file values by a name a project gives, such as a field's
|
|
3
|
+
* or a style's, with no properties of its own to inherit: a field named
|
|
4
|
+
* `__proto__` is then a key like any other rather than the record's
|
|
5
|
+
* prototype, and one named `constructor` reads as absent until it is set.
|
|
6
|
+
*/
|
|
7
|
+
export declare function nameRecord<T>(): Record<string, T>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An empty record to file values by a name a project gives, such as a field's
|
|
3
|
+
* or a style's, with no properties of its own to inherit: a field named
|
|
4
|
+
* `__proto__` is then a key like any other rather than the record's
|
|
5
|
+
* prototype, and one named `constructor` reads as absent until it is set.
|
|
6
|
+
*/
|
|
7
|
+
export function nameRecord() {
|
|
8
|
+
return Object.create(null);
|
|
9
|
+
}
|
package/package.json
CHANGED
|
@@ -79,6 +79,20 @@
|
|
|
79
79
|
"maxItems": 4,
|
|
80
80
|
"items": { "type": "number" }
|
|
81
81
|
},
|
|
82
|
+
"quac:print_layouts": {
|
|
83
|
+
"description": "On the top-level Catalog: the source's print layouts, in its order, each as its name and its QGIS layout template, the <Layout> element that QGIS saves in a .qpt file. Written from a QGIS project's Layout Manager, less any layout that its QGIS Server settings exclude.",
|
|
84
|
+
"type": "array",
|
|
85
|
+
"minItems": 1,
|
|
86
|
+
"items": {
|
|
87
|
+
"type": "object",
|
|
88
|
+
"required": ["name", "template"],
|
|
89
|
+
"properties": {
|
|
90
|
+
"name": { "type": "string" },
|
|
91
|
+
"template": { "type": "string", "pattern": "^<Layout[ />]" }
|
|
92
|
+
},
|
|
93
|
+
"additionalProperties": false
|
|
94
|
+
}
|
|
95
|
+
},
|
|
82
96
|
"quac:visibility_checked": {
|
|
83
97
|
"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.",
|
|
84
98
|
"type": "boolean"
|
|
@@ -258,6 +272,14 @@
|
|
|
258
272
|
"type": "string",
|
|
259
273
|
"minLength": 1
|
|
260
274
|
},
|
|
275
|
+
"quac:primary_key": {
|
|
276
|
+
"description": "The names of the fields whose values identify a feature in the layer's data, its primary key. Written from QGIS, which gives a layer's primary key, where every field of the key is among the columns.",
|
|
277
|
+
"type": "array",
|
|
278
|
+
"minItems": 1,
|
|
279
|
+
"items": {
|
|
280
|
+
"$ref": "#/definitions/name"
|
|
281
|
+
}
|
|
282
|
+
},
|
|
261
283
|
"quac:form_order": {
|
|
262
284
|
"description": "The names of the fields the source's form layout places, in its order. A column not listed is left out of the form. Written from a QGIS layer's Drag and Drop Designer form.",
|
|
263
285
|
"type": "array",
|
|
@@ -583,6 +605,20 @@
|
|
|
583
605
|
"dropdown"
|
|
584
606
|
]
|
|
585
607
|
},
|
|
608
|
+
"quac:length": {
|
|
609
|
+
"description": "The most characters a text field holds, or the most digits a number field holds, as the field's data defines it. Written from QGIS, which gives a field's length.",
|
|
610
|
+
"type": "integer",
|
|
611
|
+
"minimum": 1
|
|
612
|
+
},
|
|
613
|
+
"quac:precision": {
|
|
614
|
+
"description": "The most digits after the decimal point a decimal number field holds, as the field's data defines it. Written from QGIS, which gives a field's precision.",
|
|
615
|
+
"type": "integer",
|
|
616
|
+
"minimum": 1
|
|
617
|
+
},
|
|
618
|
+
"quac:filled_by_data": {
|
|
619
|
+
"description": "The field's data gives it a value of its own, such as the next number of a sequence, when a new feature leaves it empty. Written from QGIS, where the data source states a default for the field.",
|
|
620
|
+
"const": true
|
|
621
|
+
},
|
|
586
622
|
"quac:label_on_top": {
|
|
587
623
|
"description": "The form puts the field's name above its value, across the form's width. Written from QGIS's Label on top in the Attributes Form.",
|
|
588
624
|
"const": true
|