@geogirafe/lib-geoportal 1.1.0-dev.2636580374 → 1.1.0-dev.2640738406

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.
@@ -153,12 +153,10 @@ ${this.htmlUnsafe(this.feedbackTemplateHtml ?? '')}`;
153
153
  }
154
154
  this.awaitingIframeUrl = true;
155
155
  this.refreshRender();
156
- const baseUrl = this.context.urlManager.getRootUrl();
156
+ const iframeBaseUrl = this.context.configManager.Config.share?.iframeBaseUrl ?? `${this.context.urlManager.getRootUrl()}iframe.html`;
157
157
  const hash = this.context.shareManager.getStateToShare();
158
- // Get short URL for iframe
159
- const indexDocument = `iframe.html`;
160
- const longIframeUrl = `${baseUrl}${indexDocument}#${hash}`;
161
- const response = await this.urlShortener.shortenUrl(longIframeUrl, indexDocument);
158
+ const longIframeUrl = `${iframeBaseUrl}#${hash}`;
159
+ const response = await this.urlShortener.shortenUrl(longIframeUrl, iframeBaseUrl);
162
160
  this.iframeUrl = response.shorturl;
163
161
  this.iframeCode = `<iframe title="iframe GeoGirafe" width="${this.iframeWidth}" height="${this.iframeHeight}" src="${this.iframeUrl}"></iframe>`;
164
162
  this.awaitingIframeUrl = false;
@@ -4,6 +4,6 @@ declare class GeoGirafeShareManager implements IUrlShortener {
4
4
  private readonly serviceUrl;
5
5
  private readonly urlManager;
6
6
  constructor(serviceUrl: string, urlManager: UrlManager);
7
- shortenUrl(longUrl: string, indexDocument?: string): Promise<UrlShortenerResponse>;
7
+ shortenUrl(longUrl: string, forcedBaseUrl?: string): Promise<UrlShortenerResponse>;
8
8
  }
9
9
  export default GeoGirafeShareManager;
@@ -6,7 +6,7 @@ class GeoGirafeShareManager {
6
6
  this.serviceUrl = serviceUrl;
7
7
  this.urlManager = urlManager;
8
8
  }
9
- async shortenUrl(longUrl, indexDocument) {
9
+ async shortenUrl(longUrl, forcedBaseUrl) {
10
10
  const errorResponse = {
11
11
  success: false,
12
12
  shorturl: longUrl
@@ -23,9 +23,9 @@ class GeoGirafeShareManager {
23
23
  });
24
24
  const response_data = (await response.json());
25
25
  if (response_data) {
26
- const baseUrl = this.urlManager.getBaseUrlPath();
26
+ const baseUrl = forcedBaseUrl ?? this.urlManager.getBaseUrlPath();
27
27
  const hash = response_data.short_url.split('/').pop();
28
- const shortUrl = `${baseUrl}${indexDocument ?? ''}#gg-${hash}`;
28
+ const shortUrl = `${baseUrl}#gg-${hash}`;
29
29
  const qrcode = await generateQrCode(shortUrl);
30
30
  return {
31
31
  success: true,
@@ -33,6 +33,7 @@ export type LayerWmsOptions = {
33
33
  maxResolution?: number;
34
34
  };
35
35
  };
36
+ wmsInfoFormat?: string;
36
37
  time?: ITimeOptions;
37
38
  snappingConfig?: ISnappingConfig;
38
39
  timeAttribute?: string;
@@ -41,11 +42,11 @@ export type LayerWmsOptions = {
41
42
  };
42
43
  declare class LayerWms extends Layer implements ILayerWithLegend, ILayerWithFilter, ILayerWithTime {
43
44
  /**
44
- * This class is a used in the state of the application, which will be accessed behind a javascript proxy.
45
+ * This class is used in the state of the application, which will be accessed behind a JavaScript proxy.
45
46
  * This means that each modification made to its properties must come from outside,
46
- * because they have to be made through the proxy, so that the modification can be listen.
47
- * Therefore, this class must not contain any method which is updating a value directly
48
- * For example, any method doing <this.xxx = value> is forbidden here, because the modification be known from the proxy
47
+ * because they have to be made through the proxy, so that the modification can be listened to.
48
+ * Therefore, this class must not contain any method which is updating a value directly.
49
+ * For example, any method doing <this.xxx = value> is forbidden here because the modification must be known from the proxy
49
50
  */
50
51
  ogcServer: ServerOgc;
51
52
  minResolution?: number;
@@ -67,6 +68,7 @@ declare class LayerWms extends Layer implements ILayerWithLegend, ILayerWithFilt
67
68
  maxResolution?: number;
68
69
  };
69
70
  };
71
+ wmsInfoFormat?: string;
70
72
  filter?: WfsFilter;
71
73
  timeOptions?: ITimeOptions;
72
74
  snapOptions?: ISnappingConfig;
@@ -89,5 +91,6 @@ declare class LayerWms extends Layer implements ILayerWithLegend, ILayerWithFilt
89
91
  get wmsQueryableOnly(): boolean;
90
92
  private static isGMFTreeItem;
91
93
  private static getOptionsFromGMFTreeItem;
94
+ private static getDefaultWmsInfoFormat;
92
95
  }
93
96
  export default LayerWms;
@@ -9,11 +9,11 @@ import Layer from './layer.js';
9
9
  import { BrainIgnore } from '../../tools/state/brain/decorators.js';
10
10
  class LayerWms extends Layer {
11
11
  /**
12
- * This class is a used in the state of the application, which will be accessed behind a javascript proxy.
12
+ * This class is used in the state of the application, which will be accessed behind a JavaScript proxy.
13
13
  * This means that each modification made to its properties must come from outside,
14
- * because they have to be made through the proxy, so that the modification can be listen.
15
- * Therefore, this class must not contain any method which is updating a value directly
16
- * For example, any method doing <this.xxx = value> is forbidden here, because the modification be known from the proxy
14
+ * because they have to be made through the proxy, so that the modification can be listened to.
15
+ * Therefore, this class must not contain any method which is updating a value directly.
16
+ * For example, any method doing <this.xxx = value> is forbidden here because the modification must be known from the proxy
17
17
  */
18
18
  // Base WMS attributes
19
19
  ogcServer;
@@ -33,6 +33,7 @@ class LayerWms extends Layer {
33
33
  queryable = false;
34
34
  queryLayers;
35
35
  queryLayersRanges;
36
+ wmsInfoFormat;
36
37
  filter;
37
38
  timeOptions;
38
39
  snapOptions;
@@ -59,6 +60,7 @@ class LayerWms extends Layer {
59
60
  this.hiDPILegendImages = opts?.hiDPILegendImages;
60
61
  this.printNativeAngle = opts?.printNativeAngle;
61
62
  this.queryable = opts?.queryable ?? false;
63
+ this.wmsInfoFormat = opts?.wmsInfoFormat ?? LayerWms.getDefaultWmsInfoFormat(this.ogcServer);
62
64
  this.queryLayers = opts?.queryLayers;
63
65
  this.queryLayersRanges = opts?.queryLayersRanges || {};
64
66
  this.timeOptions = opts?.time;
@@ -96,6 +98,7 @@ class LayerWms extends Layer {
96
98
  queryable: this.queryable,
97
99
  queryLayers: this.queryLayers,
98
100
  queryLayersRanges: this.queryLayersRanges,
101
+ wmsInfoFormat: this.wmsInfoFormat,
99
102
  time: this.timeOptions,
100
103
  snappingConfig: this.snapOptions,
101
104
  timeAttribute: this.timeAttribute,
@@ -198,6 +201,12 @@ class LayerWms extends Layer {
198
201
  }
199
202
  return opts;
200
203
  }
204
+ static getDefaultWmsInfoFormat(serverOgc) {
205
+ if (serverOgc.type === 'arcgis') {
206
+ return 'application/geo+json';
207
+ }
208
+ return 'application/vnd.ogc.gml';
209
+ }
201
210
  }
202
211
  __decorate([
203
212
  BrainIgnore
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "name": "GeoGirafe PSC",
6
6
  "url": "https://doc.geogirafe.org"
7
7
  },
8
- "version": "1.1.0-dev.2636580374",
8
+ "version": "1.1.0-dev.2640738406",
9
9
  "type": "module",
10
10
  "engines": {
11
11
  "node": ">=20.19.0"
@@ -1 +1 @@
1
- {"version":"1.1.0-dev.2636580374", "build":"2636580374", "date":"29/06/2026"}
1
+ {"version":"1.1.0-dev.2640738406", "build":"2640738406", "date":"30/06/2026"}
@@ -103,6 +103,7 @@ declare class GirafeConfig {
103
103
  preferNames: boolean;
104
104
  createUrl: string;
105
105
  getUrl?: string;
106
+ iframeBaseUrl?: string;
106
107
  };
107
108
  projections: {
108
109
  [key: string]: string;
@@ -185,7 +185,8 @@ class GirafeConfig {
185
185
  service: config.share?.service ?? 'gmf',
186
186
  preferNames: config.share?.preferNames ?? false,
187
187
  createUrl: config.share?.createUrl,
188
- getUrl: config.share?.getUrl
188
+ getUrl: config.share?.getUrl,
189
+ iframeBaseUrl: config.share?.iframeBaseUrl
189
190
  };
190
191
  }
191
192
  initConfigSelection(config) {
@@ -1,4 +1,5 @@
1
1
  import { Image as ImageLayer } from 'ol/layer.js';
2
+ import Feature from 'ol/Feature.js';
2
3
  import ImageWMS from 'ol/source/ImageWMS.js';
3
4
  import { Map } from 'ol';
4
5
  import LayerWms from '../../models/layers/layerwms.js';
@@ -11,6 +12,8 @@ export default abstract class WmsClient {
11
12
  private readonly ogcServer;
12
13
  private readonly context;
13
14
  private readonly resolutionTolerance;
15
+ private readonly geoJson;
16
+ private readonly wmsGetFeatureInfo;
14
17
  private capabilityPromise;
15
18
  private capabilities;
16
19
  private get state();
@@ -46,7 +49,7 @@ export default abstract class WmsClient {
46
49
  * Selects features based on the specified query and prepares selection parameters.
47
50
  */
48
51
  selectFeaturesByQuery(query: WfsFilter): void;
49
- getFeatureInfo(selectionParam: SelectionParam): Promise<import("ol").Feature<import("ol/geom.js").Geometry, {
52
+ getFeatureInfo(selectionParam: SelectionParam): Promise<Feature<import("ol/geom.js").Geometry, {
50
53
  [x: string]: any;
51
54
  }>[]>;
52
55
  private getFeatureInfoUrl;
@@ -3,6 +3,7 @@ import { Image as ImageLayer } from 'ol/layer.js';
3
3
  import ImageWMS from 'ol/source/ImageWMS.js';
4
4
  import WMSCapabilities from 'ol/format/WMSCapabilities.js';
5
5
  import WMSGetFeatureInfo from 'ol/format/WMSGetFeatureInfo.js';
6
+ import GeoJSON from 'ol/format/GeoJSON.js';
6
7
  import SelectionParam from '../../models/selectionparam.js';
7
8
  import Exception from 'jsts/java/lang/Exception.js';
8
9
  export default class WmsClient {
@@ -10,6 +11,8 @@ export default class WmsClient {
10
11
  ogcServer;
11
12
  context;
12
13
  resolutionTolerance = 5;
14
+ geoJson = new GeoJSON();
15
+ wmsGetFeatureInfo = new WMSGetFeatureInfo();
13
16
  capabilityPromise = null;
14
17
  capabilities = null;
15
18
  get state() {
@@ -314,7 +317,7 @@ export default class WmsClient {
314
317
  const url = olLayer
315
318
  .getSource()
316
319
  ?.getFeatureInfoUrl(coordinate, (olLayer.getMapInternal()?.getView().getResolution() ?? currentResolution) + this.resolutionTolerance, this.state.projection, {
317
- INFO_FORMAT: 'application/vnd.ogc.gml',
320
+ INFO_FORMAT: layer.wmsInfoFormat,
318
321
  FEATURE_COUNT: 300
319
322
  });
320
323
  if (url !== undefined) {
@@ -326,17 +329,27 @@ export default class WmsClient {
326
329
  return urlsAndLayerNames;
327
330
  }
328
331
  handleGetFeatureInfoResponse(response, url, urlsAndLayerNames) {
329
- const gmlFeatures = new WMSGetFeatureInfo().readFeatures(response, {
330
- dataProjection: this.state.projection,
331
- featureProjection: this.state.projection
332
- });
332
+ const infoFormat = URL.parse(url)?.searchParams.get('INFO_FORMAT');
333
+ let features;
334
+ if (infoFormat && (infoFormat.includes('application/geo+json') || infoFormat.includes('application/geojson'))) {
335
+ features = this.geoJson.readFeatures(response, {
336
+ dataProjection: this.state.projection,
337
+ featureProjection: this.state.projection
338
+ });
339
+ }
340
+ else {
341
+ features = this.wmsGetFeatureInfo.readFeatures(response, {
342
+ dataProjection: this.state.projection,
343
+ featureProjection: this.state.projection
344
+ });
345
+ }
333
346
  // Set the feature id with the layer name.
334
- gmlFeatures.forEach((feature) => {
347
+ features.forEach((feature) => {
335
348
  if (!feature.getId()) {
336
349
  feature.setId(urlsAndLayerNames[url]);
337
350
  }
338
351
  });
339
- return gmlFeatures;
352
+ return features;
340
353
  }
341
354
  refreshZIndexes() {
342
355
  // Recalculate source for Layers