diff --git a/src/datasource/ExternalDataSourcesManager.js b/src/datasource/ExternalDataSourcesManager.js index e58fb8a1835e..d58b621098e7 100644 --- a/src/datasource/ExternalDataSourcesManager.js +++ b/src/datasource/ExternalDataSourcesManager.js @@ -374,6 +374,9 @@ export class ExternalDatSourcesManager { if (wmsInfoFormat === undefined) { wmsInfoFormat = infoFormats.includes(WMSInfoFormat.GEOJSON) ? WMSInfoFormat.GEOJSON : undefined; } + if (wmsInfoFormat === undefined) { + wmsInfoFormat = infoFormats.includes(WMSInfoFormat.GEO_JSON) ? WMSInfoFormat.GEO_JSON : undefined; + } // queryable const queryable = layer.queryable === true && wmsInfoFormat !== undefined; diff --git a/src/datasource/Manager.js b/src/datasource/Manager.js index 481523f176da..d5bf0868d1c9 100644 --- a/src/datasource/Manager.js +++ b/src/datasource/Manager.js @@ -79,6 +79,7 @@ export class DatasourceManager { * @param {angular.IQService} $q Angular q service * @param {angular.IScope} $rootScope Angular rootScope. * @param {angular.ITimeoutService} $timeout Angular timeout service. + * @param {angular.IInjectorService} $injector Main injector. * @param {import('gmf/theme/Themes').ThemesService} gmfThemes The gmf Themes service. * @param {import('gmf/layertree/TreeManager').LayertreeTreeManager} gmfTreeManager The gmf TreeManager * service. @@ -99,6 +100,7 @@ export class DatasourceManager { $q, $rootScope, $timeout, + $injector, gmfThemes, gmfTreeManager, ngeoBackgroundLayerMgr, @@ -233,6 +235,13 @@ export class DatasourceManager { */ this.treeCtrlsUnregister_ = null; + /** + * @type {{import('gmf/options').gmfDatasourceOptions} + */ + this.gmfDatasourceOptions = $injector.has('gmfDatasourceOptions') + ? $injector.get('gmfDatasourceOptions') + : {}; + // === Events === listen(this.ngeoBackgroundLayerMgr_, 'change', this.handleNgeoBackgroundLayerChange_, this); listen(this.gmfThemes_, 'change', this.handleThemesChange_, this); @@ -738,6 +747,9 @@ export class DatasourceManager { if (wmtsUrl) { options.wmtsUrl = wmtsUrl; } + if (ogcServerType === ServerType.ARCGIS && this.gmfDatasourceOptions.arcgisWMSInfoFormat) { + options.wmsInfoFormat = this.gmfDatasourceOptions.arcgisWMSInfoFormat; + } // Create the data source and add it to the cache this.dataSourcesCache_[id] = new GmfDatasourceOGC(options); } diff --git a/src/datasource/OGC.js b/src/datasource/OGC.js index c4858beeb2e6..842b1674946e 100644 --- a/src/datasource/OGC.js +++ b/src/datasource/OGC.js @@ -1,6 +1,6 @@ // The MIT License (MIT) // -// Copyright (c) 2017-2022 Camptocamp SA +// Copyright (c) 2017-2023 Camptocamp SA // // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in @@ -89,6 +89,7 @@ export const WFSOutputFormat = { */ export const WMSInfoFormat = { GEOJSON: 'application/geojson', + GEO_JSON: 'application/geo+json', GML: 'application/vnd.ogc.gml', }; @@ -587,7 +588,10 @@ export class GmfDatasourceOGC extends ngeoDatasourceDataSource { wmsFormat = new olFormatWMSGetFeatureInfo({ layers: wmsLayerNames, }); - } else if (this.wmsInfoFormat === WMSInfoFormat.GEOJSON) { + } else if ( + this.wmsInfoFormat === WMSInfoFormat.GEOJSON || + this.wmsInfoFormat === WMSInfoFormat.GEO_JSON + ) { wmsFormat = new ngeoFormatArcGISGeoJSON({ layers: wmsLayerNames, }); diff --git a/src/options.js b/src/options.js index 78523bff2222..e62a645959be 100644 --- a/src/options.js +++ b/src/options.js @@ -924,4 +924,9 @@ export function buildStyle(styleDescriptor) { * @property {number} [duration] The duration of the animation in milliseconds. By default, there is no animation to the target extent. */ +/** + * @typedef {Object} gmfDatasourceOptions + * @property {string} arcgisWMSInfoFormat The WMS info format to be used with Arcgis OGC server. + */ + export default null; diff --git a/srcapi/store/config.ts b/srcapi/store/config.ts index 6e10cade1705..8cff5a9d2ea6 100644 --- a/srcapi/store/config.ts +++ b/srcapi/store/config.ts @@ -1386,6 +1386,12 @@ export type gmfCustomCSS = { */ export type pytreeLidarprofileJsonUrl = string; +export type gmfDatasourceOptions = { + /** + * The WMS info format to be used with Arcgis OGC server. + */ + arcgisWMSInfoFormat: string; +}; /** * The full configuration */ @@ -1456,6 +1462,7 @@ export type Configuration = { gmfCustomCSS: gmfCustomCSS; gmfI18nextConfiguration: InitOptions; pytreeLidarprofileJsonUrl: pytreeLidarprofileJsonUrl; + gmfDatasourceOptions: gmfDatasourceOptions; }; export type APIConfig = {