Skip to content

Commit cda4475

Browse files
authored
Merge pull request #9255 from camptocamp/backport/9249-to-master
[Backport master] Support application/geo+json
2 parents 55dd7aa + 907f856 commit cda4475

File tree

5 files changed

+33
-2
lines changed

5 files changed

+33
-2
lines changed

src/datasource/ExternalDataSourcesManager.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,9 @@ export class ExternalDatSourcesManager {
374374
if (wmsInfoFormat === undefined) {
375375
wmsInfoFormat = infoFormats.includes(WMSInfoFormat.GEOJSON) ? WMSInfoFormat.GEOJSON : undefined;
376376
}
377+
if (wmsInfoFormat === undefined) {
378+
wmsInfoFormat = infoFormats.includes(WMSInfoFormat.GEO_JSON) ? WMSInfoFormat.GEO_JSON : undefined;
379+
}
377380

378381
// queryable
379382
const queryable = layer.queryable === true && wmsInfoFormat !== undefined;

src/datasource/Manager.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export class DatasourceManager {
7979
* @param {angular.IQService} $q Angular q service
8080
* @param {angular.IScope} $rootScope Angular rootScope.
8181
* @param {angular.ITimeoutService} $timeout Angular timeout service.
82+
* @param {angular.IInjectorService} $injector Main injector.
8283
* @param {import('gmf/theme/Themes').ThemesService} gmfThemes The gmf Themes service.
8384
* @param {import('gmf/layertree/TreeManager').LayertreeTreeManager} gmfTreeManager The gmf TreeManager
8485
* service.
@@ -99,6 +100,7 @@ export class DatasourceManager {
99100
$q,
100101
$rootScope,
101102
$timeout,
103+
$injector,
102104
gmfThemes,
103105
gmfTreeManager,
104106
ngeoBackgroundLayerMgr,
@@ -233,6 +235,13 @@ export class DatasourceManager {
233235
*/
234236
this.treeCtrlsUnregister_ = null;
235237

238+
/**
239+
* @type {{import('gmf/options').gmfDatasourceOptions}
240+
*/
241+
this.gmfDatasourceOptions = $injector.has('gmfDatasourceOptions')
242+
? $injector.get('gmfDatasourceOptions')
243+
: {};
244+
236245
// === Events ===
237246
listen(this.ngeoBackgroundLayerMgr_, 'change', this.handleNgeoBackgroundLayerChange_, this);
238247
listen(this.gmfThemes_, 'change', this.handleThemesChange_, this);
@@ -738,6 +747,9 @@ export class DatasourceManager {
738747
if (wmtsUrl) {
739748
options.wmtsUrl = wmtsUrl;
740749
}
750+
if (ogcServerType === ServerType.ARCGIS && this.gmfDatasourceOptions.arcgisWMSInfoFormat) {
751+
options.wmsInfoFormat = this.gmfDatasourceOptions.arcgisWMSInfoFormat;
752+
}
741753
// Create the data source and add it to the cache
742754
this.dataSourcesCache_[id] = new GmfDatasourceOGC(options);
743755
}

src/datasource/OGC.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// The MIT License (MIT)
22
//
3-
// Copyright (c) 2017-2022 Camptocamp SA
3+
// Copyright (c) 2017-2023 Camptocamp SA
44
//
55
// Permission is hereby granted, free of charge, to any person obtaining a copy of
66
// this software and associated documentation files (the "Software"), to deal in
@@ -89,6 +89,7 @@ export const WFSOutputFormat = {
8989
*/
9090
export const WMSInfoFormat = {
9191
GEOJSON: 'application/geojson',
92+
GEO_JSON: 'application/geo+json',
9293
GML: 'application/vnd.ogc.gml',
9394
};
9495

@@ -587,7 +588,10 @@ export class GmfDatasourceOGC extends ngeoDatasourceDataSource {
587588
wmsFormat = new olFormatWMSGetFeatureInfo({
588589
layers: wmsLayerNames,
589590
});
590-
} else if (this.wmsInfoFormat === WMSInfoFormat.GEOJSON) {
591+
} else if (
592+
this.wmsInfoFormat === WMSInfoFormat.GEOJSON ||
593+
this.wmsInfoFormat === WMSInfoFormat.GEO_JSON
594+
) {
591595
wmsFormat = new ngeoFormatArcGISGeoJSON({
592596
layers: wmsLayerNames,
593597
});

src/options.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -924,4 +924,9 @@ export function buildStyle(styleDescriptor) {
924924
* @property {number} [duration] The duration of the animation in milliseconds. By default, there is no animation to the target extent.
925925
*/
926926

927+
/**
928+
* @typedef {Object} gmfDatasourceOptions
929+
* @property {string} arcgisWMSInfoFormat The WMS info format to be used with Arcgis OGC server.
930+
*/
931+
927932
export default null;

srcapi/store/config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,6 +1386,12 @@ export type gmfCustomCSS = {
13861386
*/
13871387
export type pytreeLidarprofileJsonUrl = string;
13881388

1389+
export type gmfDatasourceOptions = {
1390+
/**
1391+
* The WMS info format to be used with Arcgis OGC server.
1392+
*/
1393+
arcgisWMSInfoFormat: string;
1394+
};
13891395
/**
13901396
* The full configuration
13911397
*/
@@ -1456,6 +1462,7 @@ export type Configuration = {
14561462
gmfCustomCSS: gmfCustomCSS;
14571463
gmfI18nextConfiguration: InitOptions;
14581464
pytreeLidarprofileJsonUrl: pytreeLidarprofileJsonUrl;
1465+
gmfDatasourceOptions: gmfDatasourceOptions;
14591466
};
14601467

14611468
export type APIConfig = {

0 commit comments

Comments
 (0)