Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 2.8] Support application/geo+json #9256

Merged
merged 1 commit into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/datasource/ExternalDataSourcesManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 12 additions & 0 deletions src/datasource/Manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -99,6 +100,7 @@ export class DatasourceManager {
$q,
$rootScope,
$timeout,
$injector,
gmfThemes,
gmfTreeManager,
ngeoBackgroundLayerMgr,
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
Expand Down
8 changes: 6 additions & 2 deletions src/datasource/OGC.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -89,6 +89,7 @@ export const WFSOutputFormat = {
*/
export const WMSInfoFormat = {
GEOJSON: 'application/geojson',
GEO_JSON: 'application/geo+json',
GML: 'application/vnd.ogc.gml',
};

Expand Down Expand Up @@ -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,
});
Expand Down
5 changes: 5 additions & 0 deletions src/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
7 changes: 7 additions & 0 deletions srcapi/store/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -1456,6 +1462,7 @@ export type Configuration = {
gmfCustomCSS: gmfCustomCSS;
gmfI18nextConfiguration: InitOptions;
pytreeLidarprofileJsonUrl: pytreeLidarprofileJsonUrl;
gmfDatasourceOptions: gmfDatasourceOptions;
};

export type APIConfig = {
Expand Down