@vectoriahq/quac 0.3.0-next.1 → 0.3.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.
|
@@ -41,10 +41,10 @@ function walkWmsNodes(nodes, context) {
|
|
|
41
41
|
const out = [];
|
|
42
42
|
for (const node of nodes) {
|
|
43
43
|
if (node.kind === 'layer') {
|
|
44
|
-
const
|
|
45
|
-
?
|
|
44
|
+
const wmsLinks = context.wmsEndpoint && !context.wfsPublished.has(node.name)
|
|
45
|
+
? buildQgisServerWmsLinks(context.wmsEndpoint, node)
|
|
46
46
|
: null;
|
|
47
|
-
out.push(
|
|
47
|
+
out.push(wmsLinks ? wmsOnlyLayerToNormalized(node, wmsLinks) : wmsLayerToNormalized(node, context.resolveWfsSource(node)));
|
|
48
48
|
}
|
|
49
49
|
else {
|
|
50
50
|
const subId = slugify(node.title || node.name || 'group') || 'group';
|
|
@@ -84,27 +84,38 @@ function wmsLayerToNormalized(layer, wfsSource) {
|
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
87
|
+
* The GetMap links for a layer QGIS Server publishes only over WMS. The first
|
|
88
|
+
* leaves the style empty, which draws the layer's current style
|
|
89
|
+
* (`QgsRenderer::setLayerStyle`, `src/server/services/wms/qgswmsrenderer.cpp`,
|
|
90
|
+
* `qgis/QGIS@master`, read 2026-11-15). Where the layer has more than one
|
|
91
|
+
* named style, one link follows for each, titled with the style's title.
|
|
92
|
+
* GetProjectSettings lists the styles in name order and does not say which is
|
|
93
|
+
* current (`QgsMapLayerStyleManager::styles`, `src/core/qgsmaplayerstylemanager.cpp`,
|
|
94
|
+
* and `appendLayerStyles`, `src/server/services/wms/qgswmsgetcapabilities.cpp`,
|
|
95
|
+
* same revision), so the current one is also among them. No version is
|
|
96
|
+
* stated, so an application reading the catalogue asks the server for one
|
|
90
97
|
* when the layer is first shown.
|
|
91
98
|
*/
|
|
92
|
-
function
|
|
93
|
-
|
|
99
|
+
function buildQgisServerWmsLinks(endpoint, layer) {
|
|
100
|
+
const link = (style) => ({
|
|
94
101
|
rel: 'wms',
|
|
95
102
|
href: endpoint,
|
|
96
103
|
type: 'image/png',
|
|
97
104
|
'wms:layers': [layer.name],
|
|
98
|
-
'wms:styles': [
|
|
105
|
+
'wms:styles': [style],
|
|
99
106
|
'wms:transparent': true,
|
|
100
107
|
'quac:wms_crs': chooseWmsCrs(layer.crsList)
|
|
101
|
-
};
|
|
108
|
+
});
|
|
109
|
+
const named = layer.styles.length > 1
|
|
110
|
+
? layer.styles.map((style) => ({ ...link(style.name), title: style.title || style.name }))
|
|
111
|
+
: [];
|
|
112
|
+
return [link(''), ...named];
|
|
102
113
|
}
|
|
103
114
|
/**
|
|
104
115
|
* A layer QGIS Server publishes only over WMS: an image layer, so it has no data
|
|
105
116
|
* asset, fields or editing, as a QGIS project's WMS layer has none.
|
|
106
117
|
*/
|
|
107
|
-
function wmsOnlyLayerToNormalized(layer,
|
|
118
|
+
function wmsOnlyLayerToNormalized(layer, wmsLinks) {
|
|
108
119
|
return {
|
|
109
120
|
kind: 'layer',
|
|
110
121
|
id: layer.name,
|
|
@@ -123,7 +134,7 @@ function wmsOnlyLayerToNormalized(layer, wmsLink) {
|
|
|
123
134
|
scaleRange: layer.scaleRange,
|
|
124
135
|
opacity: layer.opacity,
|
|
125
136
|
vendorFields: {},
|
|
126
|
-
links:
|
|
137
|
+
links: wmsLinks,
|
|
127
138
|
extensions: [WEB_MAP_LINKS_EXTENSION]
|
|
128
139
|
};
|
|
129
140
|
}
|