@geogirafe/lib-geoportal 1.1.0-dev.2463717290 → 1.1.0-dev.2467587002

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.
@@ -33,6 +33,9 @@ declare class WmtsManager {
33
33
  }> | null;
34
34
  changeOpacity(layer: LayerWmts): void;
35
35
  private manageLayerOptions;
36
+ private createSelectionImageLayer;
37
+ private getOrCreateLayersForOgcServer;
38
+ private createQueryableWmsLayer;
36
39
  selectFeatures(extent: number[]): void;
37
40
  getWmtsCapabilities(url: string): Promise<Record<string, unknown>>;
38
41
  }
@@ -158,6 +158,41 @@ class WmtsManager {
158
158
  olayer.setOpacity(layer.opacity);
159
159
  }
160
160
  }
161
+ createSelectionImageLayer(ogcServer, wmsLayer) {
162
+ return new ImageLayer({
163
+ source: new ImageWMS({
164
+ url: ogcServer.url,
165
+ params: { LAYERS: wmsLayer }
166
+ })
167
+ });
168
+ }
169
+ getOrCreateLayersForOgcServer(ogcServer, wmsLayer, ogcServerToWmsLayers, ogcServerToOlLayer) {
170
+ let layers = ogcServerToWmsLayers.get(ogcServer);
171
+ if (!layers) {
172
+ layers = [];
173
+ ogcServerToWmsLayers.set(ogcServer, layers);
174
+ ogcServerToOlLayer.set(ogcServer, this.createSelectionImageLayer(ogcServer, wmsLayer));
175
+ }
176
+ return layers;
177
+ }
178
+ createQueryableWmsLayer(wmtsLayer, wmsLayer) {
179
+ const hasQueryResolutionRestriction = wmtsLayer.minQueryResolution !== undefined || wmtsLayer.maxQueryResolution !== undefined;
180
+ return new LayerWms(0, wmsLayer, 0, wmtsLayer.ogcServer, {
181
+ queryLayers: wmsLayer,
182
+ layers: wmsLayer,
183
+ queryable: true,
184
+ minResolution: wmtsLayer.minQueryResolution,
185
+ maxResolution: wmtsLayer.maxQueryResolution,
186
+ queryLayersRanges: hasQueryResolutionRestriction
187
+ ? {
188
+ [wmsLayer]: {
189
+ minResolution: wmtsLayer.minQueryResolution,
190
+ maxResolution: wmtsLayer.maxQueryResolution
191
+ }
192
+ }
193
+ : undefined
194
+ });
195
+ }
161
196
  selectFeatures(extent) {
162
197
  const ogcServerToWmsLayers = new Map();
163
198
  const ogcServerToOlLayer = new Map();
@@ -170,26 +205,10 @@ class WmtsManager {
170
205
  }
171
206
  const wmsLayers = queryLayers.split(',');
172
207
  for (const wmsLayer of wmsLayers) {
173
- let layers = ogcServerToWmsLayers.get(wmtsLayer.ogcServer);
174
- if (!layers) {
175
- layers = [];
176
- ogcServerToWmsLayers.set(wmtsLayer.ogcServer, layers);
177
- const oLayer = new ImageLayer({
178
- source: new ImageWMS({
179
- url: wmtsLayer.ogcServer.url,
180
- params: { LAYERS: wmsLayer }
181
- })
182
- });
183
- ogcServerToOlLayer.set(wmtsLayer.ogcServer, oLayer);
184
- }
208
+ const layers = this.getOrCreateLayersForOgcServer(wmtsLayer.ogcServer, wmsLayer, ogcServerToWmsLayers, ogcServerToOlLayer);
185
209
  const alreadyExists = layers.some((l) => l.name === wmsLayer);
186
210
  if (!alreadyExists) {
187
- const layer = new LayerWms(0, wmsLayer, 0, wmtsLayer.ogcServer, {
188
- queryLayers: wmsLayer,
189
- layers: wmsLayer,
190
- queryable: true
191
- });
192
- layers.push(layer);
211
+ layers.push(this.createQueryableWmsLayer(wmtsLayer, wmsLayer));
193
212
  }
194
213
  }
195
214
  }
package/models/gmf.d.ts CHANGED
@@ -19,6 +19,8 @@ export interface GMFMetadata {
19
19
  hiDPILegendImages?: Record<string, string>;
20
20
  printLayers?: string;
21
21
  queryLayers?: string;
22
+ maxQueryResolution?: number;
23
+ minQueryResolution?: number;
22
24
  wmsLayers?: string;
23
25
  printNativeAngle?: boolean;
24
26
  protected?: boolean;
@@ -15,6 +15,8 @@ export type LayerWmtsOptions = {
15
15
  style?: string;
16
16
  wmsLayers?: string;
17
17
  queryLayers?: string;
18
+ maxQueryResolution?: number;
19
+ minQueryResolution?: number;
18
20
  ogcServer?: string;
19
21
  printLayers?: string;
20
22
  minResolution?: number;
@@ -47,6 +49,8 @@ declare class LayerWmts extends Layer implements ILayerWithLegend {
47
49
  ogcServer?: ServerOgc;
48
50
  wmsLayers?: string;
49
51
  queryLayers?: string;
52
+ maxQueryResolution?: number;
53
+ minQueryResolution?: number;
50
54
  printLayers?: string;
51
55
  hiDPILegendImages?: Record<string, string>;
52
56
  /** Linked ol layer, starting with an underscore to not be part of the proxy. **/
@@ -31,6 +31,8 @@ class LayerWmts extends Layer {
31
31
  ogcServer;
32
32
  wmsLayers;
33
33
  queryLayers;
34
+ maxQueryResolution;
35
+ minQueryResolution;
34
36
  printLayers;
35
37
  hiDPILegendImages;
36
38
  /** Linked ol layer, starting with an underscore to not be part of the proxy. **/
@@ -47,6 +49,8 @@ class LayerWmts extends Layer {
47
49
  this.style = opts.style;
48
50
  this.wmsLayers = opts.wmsLayers;
49
51
  this.queryLayers = opts.queryLayers;
52
+ this.maxQueryResolution = opts.maxQueryResolution;
53
+ this.minQueryResolution = opts.minQueryResolution;
50
54
  this.printLayers = opts.printLayers;
51
55
  this.minResolution = opts.minResolution;
52
56
  this.maxResolution = opts.maxResolution;
@@ -67,6 +71,8 @@ class LayerWmts extends Layer {
67
71
  imageType: this.imageType,
68
72
  style: this.style,
69
73
  queryLayers: this.queryLayers,
74
+ maxQueryResolution: this.maxQueryResolution,
75
+ minQueryResolution: this.minQueryResolution,
70
76
  wmsLayers: this.wmsLayers,
71
77
  printLayers: this.printLayers,
72
78
  minResolution: this.minResolution,
@@ -112,6 +118,8 @@ class LayerWmts extends Layer {
112
118
  wmsLayers: options.metadata?.wmsLayers,
113
119
  ogcServer: options.metadata?.ogcServer,
114
120
  queryLayers: options.metadata?.queryLayers,
121
+ maxQueryResolution: options.metadata?.maxQueryResolution,
122
+ minQueryResolution: options.metadata?.minQueryResolution,
115
123
  printLayers: options.metadata?.printLayers,
116
124
  minResolution: options.minResolutionHint,
117
125
  maxResolution: options.maxResolutionHint,
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "name": "GeoGirafe PSC",
6
6
  "url": "https://doc.geomapfish.dev"
7
7
  },
8
- "version": "1.1.0-dev.2463717290",
8
+ "version": "1.1.0-dev.2467587002",
9
9
  "type": "module",
10
10
  "engines": {
11
11
  "node": ">=20.19.0"
@@ -1 +1 @@
1
- {"version":"1.1.0-dev.2463717290", "build":"2463717290", "date":"19/04/2026"}
1
+ {"version":"1.1.0-dev.2467587002", "build":"2467587002", "date":"21/04/2026"}