@geogirafe/lib-geoportal 1.1.0-dev.2640868297 → 1.1.0-dev.2643015928
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/components/extlayers/component.js +12 -4
- package/components/print/tools/MFPEncoder.js +14 -4
- package/components/print/tools/MFPLegendEncoder.js +3 -3
- package/models/gmf.d.ts +2 -1
- package/models/main.d.ts +1 -1
- package/models/serverogc.d.ts +2 -2
- package/package.json +1 -1
- package/templates/api.html +20 -3
- package/templates/public/about.json +1 -1
- package/tools/share/serializers/layerconfigserializer.js +3 -2
- package/tools/share/serializers/sharedtypes.d.ts +2 -0
- package/tools/wms/wmsclient.d.ts +1 -1
- package/tools/wms/wmsclient.js +9 -2
|
@@ -96,16 +96,24 @@ ${this.htmlUnsafe(this.feedbackTemplateHtml ?? '')}`;
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
async scanLayersWMS(url) {
|
|
99
|
+
const parsedUrl = URL.parse(url);
|
|
100
|
+
if (!parsedUrl) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
99
103
|
this.themeName = this.parseName(url);
|
|
104
|
+
const urlTxt = `${parsedUrl?.origin}${parsedUrl?.pathname}`;
|
|
105
|
+
// Try to add a server type from the getCapabilities url params.
|
|
106
|
+
const serverTypeKey = Array.from(parsedUrl.searchParams.keys()).find((key) => key.toLowerCase() === 'servertype');
|
|
107
|
+
const serverType = (parsedUrl.searchParams.get(serverTypeKey ?? '') ?? 'other');
|
|
100
108
|
const server = new ServerOgc(this.themeName, {
|
|
101
|
-
url,
|
|
102
|
-
type:
|
|
109
|
+
url: urlTxt,
|
|
110
|
+
type: serverType,
|
|
103
111
|
wfsSupport: true,
|
|
104
|
-
urlWfs:
|
|
112
|
+
urlWfs: urlTxt,
|
|
105
113
|
imageType: 'image/png'
|
|
106
114
|
});
|
|
107
115
|
const client = this.context.wmsManager.createClient(WmsClientDefault, server);
|
|
108
|
-
const capabilities = await client.getWmsCapabilities();
|
|
116
|
+
const capabilities = await client.getWmsCapabilities(parsedUrl.searchParams);
|
|
109
117
|
if (capabilities?.Service?.Title) {
|
|
110
118
|
this.themeName = capabilities.Service.Title;
|
|
111
119
|
}
|
|
@@ -7,6 +7,12 @@ import LayerWmts from '../../../models/layers/layerwmts.js';
|
|
|
7
7
|
import VectorLayer from 'ol/layer/Vector.js';
|
|
8
8
|
import { isLayerVisible } from './printUtils.js';
|
|
9
9
|
import VectorSource from 'ol/source/Vector.js';
|
|
10
|
+
import LayerWmtsExternal from '../../../models/layers/layerwmtsexternal.js';
|
|
11
|
+
import LayerWmsExternal from '../../../models/layers/layerwmsexternal.js';
|
|
12
|
+
/** Supported MapFishPRint servers
|
|
13
|
+
* see https://github.com/mapfish/mapfish-print/blob/master/core/src/main/java/org/mapfish/print/map/image/wms/WmsLayerParam.java#L123
|
|
14
|
+
*/
|
|
15
|
+
const MFPSupportedServerType = new Set(['mapserver', 'geoserver', 'qgisserver']);
|
|
10
16
|
/**
|
|
11
17
|
* Class representing a Mapfish Print Encoder.
|
|
12
18
|
*/
|
|
@@ -132,6 +138,10 @@ export default class MFPEncoder {
|
|
|
132
138
|
return this.encodeTileWmtsLayer(layer);
|
|
133
139
|
case LayerLocalFile.name:
|
|
134
140
|
return this.encodeLocalFileLayer(layer);
|
|
141
|
+
case LayerWmsExternal.name:
|
|
142
|
+
return this.encodeWmsLayer(layer);
|
|
143
|
+
case LayerWmtsExternal.name:
|
|
144
|
+
return this.encodeTileWmtsLayer(layer);
|
|
135
145
|
default:
|
|
136
146
|
console.warn('Unsupported layer type for encoding:', layer.className);
|
|
137
147
|
return null;
|
|
@@ -183,16 +193,16 @@ export default class MFPEncoder {
|
|
|
183
193
|
customParams[key] = value;
|
|
184
194
|
});
|
|
185
195
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
if (serverType
|
|
196
|
+
let serverType = layerWms.ogcServer.type;
|
|
197
|
+
// Remove unsupported serverType (otherwise, you'll get an error from the print server).
|
|
198
|
+
if (!MFPSupportedServerType.has(serverType)) {
|
|
189
199
|
serverType = undefined;
|
|
190
200
|
}
|
|
191
201
|
const layers = layerWms.layers?.split(',') ?? [''];
|
|
192
202
|
// Add empty styles if needed
|
|
193
203
|
let styles = layerWms.style?.split(',');
|
|
194
204
|
styles ??= [''];
|
|
195
|
-
// Get the same
|
|
205
|
+
// Get the same number of styles than layers to print
|
|
196
206
|
while (layers.length > styles.length) {
|
|
197
207
|
styles.push('');
|
|
198
208
|
}
|
|
@@ -3,6 +3,7 @@ import LayerWmts from '../../../models/layers/layerwmts.js';
|
|
|
3
3
|
import GeoConsts from '../../../tools/geoconsts.js';
|
|
4
4
|
import { isLayerVisible } from './printUtils.js';
|
|
5
5
|
import LegendHelper from '../../../tools/legendhelper.js';
|
|
6
|
+
import LayerWmsExternal from '../../../models/layers/layerwmsexternal.js';
|
|
6
7
|
/**
|
|
7
8
|
* Class representing an encoder for creating a legend in the MFP (MapFishPrint) format.
|
|
8
9
|
* Iterates on the layer tree layers to collect layers in the right order and with all metadata.
|
|
@@ -53,7 +54,7 @@ export class MFPLegendEncoder {
|
|
|
53
54
|
if (layer.children) {
|
|
54
55
|
return this.encodeLayerGroupLegendClasses(layer);
|
|
55
56
|
}
|
|
56
|
-
if (
|
|
57
|
+
if ([LayerWms.name, LayerWmsExternal.name].includes(layer.className)) {
|
|
57
58
|
return this.encodeLayerWmsLegendClasses(layer);
|
|
58
59
|
}
|
|
59
60
|
if (layer.className === LayerWmts.name) {
|
|
@@ -113,8 +114,7 @@ export class MFPLegendEncoder {
|
|
|
113
114
|
if (!isLayerVisible(layerWms, this.options?.printResolution) || layerWms.inactive) {
|
|
114
115
|
return null;
|
|
115
116
|
}
|
|
116
|
-
const
|
|
117
|
-
const ogcServer = ogcServers ? ogcServers[layerWms.ogcServer.name] : undefined;
|
|
117
|
+
const ogcServer = layerWms.ogcServer;
|
|
118
118
|
const serverType = ogcServer?.type ?? '';
|
|
119
119
|
const dpi = this.options?.dpi ?? GeoConsts.SCREEN_DOTS_PER_INCH;
|
|
120
120
|
// Case node as a legend image
|
package/models/gmf.d.ts
CHANGED
|
@@ -76,13 +76,14 @@ export interface GMFGroup extends GMFTreeItem {
|
|
|
76
76
|
children: GMFTreeItem[];
|
|
77
77
|
}
|
|
78
78
|
export type GMFBackgroundLayer = GMFTreeItem;
|
|
79
|
+
export type GMFServerOgcType = 'mapserver' | 'qgisserver' | 'georama' | 'geoserver' | 'arcgis' | 'other';
|
|
79
80
|
export interface GMFServerOgc {
|
|
80
81
|
url: string;
|
|
81
82
|
wfsSupport: boolean;
|
|
82
83
|
urlWfs?: string;
|
|
83
84
|
oapifSupport?: boolean;
|
|
84
85
|
urlOapif?: string;
|
|
85
|
-
type:
|
|
86
|
+
type: GMFServerOgcType;
|
|
86
87
|
imageType: string;
|
|
87
88
|
attributes?: GMFServerOgcAttributes;
|
|
88
89
|
}
|
package/models/main.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { default as BasemapSwisstopoVectorTiles } from './basemaps/basemapswisst
|
|
|
5
5
|
export { default as CustomTheme } from './customtheme.js';
|
|
6
6
|
export type { FilterOperator, AttributeTypeGroup, LogicalFilterOperator } from './filter.js';
|
|
7
7
|
export { filterOperatorValues, filterOperators, isFilterOperator, isValuelessFilterOperator, isTwoSidedFilterOperator, isListFilterOperator, operatorsByAttributeTypeGroup, logicalFilterOperators, isLogicalFilterOperator } from './filter.js';
|
|
8
|
-
export type { GMFMetadata, GMFChildLayer, GMFTreeItem, GMFThemeFunctionality, GMFThemeFunctionalities, GMFTheme, GMFGroup, GMFBackgroundLayer, GMFServerOgc, GMFServerOgcAttributes, GMFServerOgcObjectAttributes, GMFServerOgcColumnAttributes } from './gmf.js';
|
|
8
|
+
export type { GMFMetadata, GMFChildLayer, GMFTreeItem, GMFThemeFunctionality, GMFThemeFunctionalities, GMFTheme, GMFGroup, GMFBackgroundLayer, GMFServerOgcType, GMFServerOgc, GMFServerOgcAttributes, GMFServerOgcObjectAttributes, GMFServerOgcColumnAttributes } from './gmf.js';
|
|
9
9
|
export { default as BaseLayer } from './layers/baselayer.js';
|
|
10
10
|
export type { GroupLayerOptions } from './layers/grouplayer.js';
|
|
11
11
|
export { default as GroupLayer } from './layers/grouplayer.js';
|
package/models/serverogc.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GMFServerOgc } from './gmf.js';
|
|
1
|
+
import { GMFServerOgc, GMFServerOgcType } from './gmf.js';
|
|
2
2
|
export default class ServerOgc {
|
|
3
3
|
name: string;
|
|
4
4
|
url: string;
|
|
@@ -6,7 +6,7 @@ export default class ServerOgc {
|
|
|
6
6
|
urlWfs?: string;
|
|
7
7
|
oapifSupport: boolean;
|
|
8
8
|
urlOapif?: string;
|
|
9
|
-
type:
|
|
9
|
+
type: GMFServerOgcType;
|
|
10
10
|
imageType: string;
|
|
11
11
|
aliases: Record<string, string>;
|
|
12
12
|
constructor(name: string, elem: GMFServerOgc);
|
package/package.json
CHANGED
package/templates/api.html
CHANGED
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
height: 100%;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
geogirafe-map {
|
|
81
|
+
:not(.left.default) > geogirafe-map {
|
|
82
82
|
position: absolute;
|
|
83
83
|
width: 100%;
|
|
84
84
|
height: 100%;
|
|
@@ -185,16 +185,33 @@
|
|
|
185
185
|
</section>
|
|
186
186
|
|
|
187
187
|
<h2>Add a simple map view</h2>
|
|
188
|
-
<p class="descr">Add a simple map to the page, with its default configuration.</p>
|
|
188
|
+
<p class="descr">Add a simple map to the page, with its default configuration and size.</p>
|
|
189
189
|
<section>
|
|
190
190
|
<div class="row">
|
|
191
|
-
<div class="left">
|
|
191
|
+
<div class="left default">
|
|
192
192
|
<geogirafe-map />
|
|
193
193
|
</div>
|
|
194
194
|
<div class="right"></div>
|
|
195
195
|
</div>
|
|
196
196
|
</section>
|
|
197
197
|
|
|
198
|
+
<h2>Add a simple map view with a custom size</h2>
|
|
199
|
+
<p class="descr">Add a simple map to the page, with a custom size.</p>
|
|
200
|
+
<section>
|
|
201
|
+
<div class="row">
|
|
202
|
+
<div class="left default">
|
|
203
|
+
<style>
|
|
204
|
+
.custom-size {
|
|
205
|
+
width: 100%;
|
|
206
|
+
height: 100%;
|
|
207
|
+
}
|
|
208
|
+
</style>
|
|
209
|
+
<geogirafe-map class="custom-size" />
|
|
210
|
+
</div>
|
|
211
|
+
<div class="right"></div>
|
|
212
|
+
</div>
|
|
213
|
+
</section>
|
|
214
|
+
|
|
198
215
|
<!-- With center -->
|
|
199
216
|
<h2>Add a map with center coordinates</h2>
|
|
200
217
|
<p class="descr">Set the default center point.</p>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"1.1.0-dev.
|
|
1
|
+
{"version":"1.1.0-dev.2643015928", "build":"2643015928", "date":"01/07/2026"}
|
|
@@ -103,7 +103,8 @@ export default class LayersConfigSerializer {
|
|
|
103
103
|
sharedLayer.wms = {
|
|
104
104
|
name: layer.layers,
|
|
105
105
|
title: layer.name,
|
|
106
|
-
url: layer.ogcServer.url
|
|
106
|
+
url: layer.ogcServer.url,
|
|
107
|
+
serverType: layer.ogcServer?.type ?? 'other'
|
|
107
108
|
};
|
|
108
109
|
}
|
|
109
110
|
return sharedLayer;
|
|
@@ -404,7 +405,7 @@ export default class LayersConfigSerializer {
|
|
|
404
405
|
}
|
|
405
406
|
const server = new ServerOgc('external', {
|
|
406
407
|
url: sharedLayer.wms.url,
|
|
407
|
-
type:
|
|
408
|
+
type: sharedLayer.wms.serverType,
|
|
408
409
|
wfsSupport: true,
|
|
409
410
|
urlWfs: sharedLayer.wms.url,
|
|
410
411
|
imageType: 'image/png'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FilterOperator, LogicalFilterOperator } from '../../../models/filter.js';
|
|
2
|
+
import { GMFServerOgcType } from '../../../models/gmf.js';
|
|
2
3
|
export type SharedFilterCondition = {
|
|
3
4
|
property: string;
|
|
4
5
|
propertyType?: string;
|
|
@@ -72,6 +73,7 @@ export type SharedExternalLayer = {
|
|
|
72
73
|
title: string;
|
|
73
74
|
name: string;
|
|
74
75
|
url: string;
|
|
76
|
+
serverType: GMFServerOgcType;
|
|
75
77
|
};
|
|
76
78
|
wmts?: {
|
|
77
79
|
name: string;
|
package/tools/wms/wmsclient.d.ts
CHANGED
|
@@ -55,7 +55,7 @@ export default abstract class WmsClient {
|
|
|
55
55
|
private getFeatureInfoUrl;
|
|
56
56
|
private handleGetFeatureInfoResponse;
|
|
57
57
|
refreshZIndexes(): void;
|
|
58
|
-
getWmsCapabilities(): Promise<Record<string, unknown>>;
|
|
58
|
+
getWmsCapabilities(params?: URLSearchParams): Promise<Record<string, unknown>>;
|
|
59
59
|
}
|
|
60
60
|
export declare class WmsClientQgis extends WmsClient {
|
|
61
61
|
/** QGIS-server does not filter on a WMS layer made from multiple underlying WFS queryLayers
|
package/tools/wms/wmsclient.js
CHANGED
|
@@ -368,7 +368,7 @@ export default class WmsClient {
|
|
|
368
368
|
obj.olayer.setZIndex(zindex);
|
|
369
369
|
}
|
|
370
370
|
}
|
|
371
|
-
async getWmsCapabilities() {
|
|
371
|
+
async getWmsCapabilities(params) {
|
|
372
372
|
if (this.capabilityPromise !== null) {
|
|
373
373
|
return this.capabilityPromise;
|
|
374
374
|
}
|
|
@@ -378,7 +378,14 @@ export default class WmsClient {
|
|
|
378
378
|
}
|
|
379
379
|
this.capabilityPromise = (async () => {
|
|
380
380
|
// Capabilities were not loaded yet.
|
|
381
|
-
|
|
381
|
+
if (params) {
|
|
382
|
+
params.delete('REQUEST');
|
|
383
|
+
params.delete('SERVICE');
|
|
384
|
+
params.delete('VERSION');
|
|
385
|
+
}
|
|
386
|
+
else {
|
|
387
|
+
params = new URLSearchParams();
|
|
388
|
+
}
|
|
382
389
|
params.append('REQUEST', 'GetCapabilities');
|
|
383
390
|
params.append('SERVICE', 'WMS');
|
|
384
391
|
params.append('VERSION', '1.3.0');
|