Skip to content

Commit

Permalink
Support application/geo+json
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Nov 10, 2023
1 parent 7722cfe commit 87c60d5
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/datasource/ExternalDataSourcesManager.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 @@ -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 @@ -908,4 +908,9 @@ export function buildStyle(styleDescriptor) {
* @typedef {string} gmfCustomStylesheetUrl
*/

/**
* @typedef {Object} gmfDatasourceOptions
* @property {string} arcgisWMSInfoFormat The WMS info format to be use with Argis 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 @@ -1382,6 +1382,12 @@ export type gmfCustomCSS = {
*/
export type pytreeLidarprofileJsonUrl = string;

export type gmfDatasourceOptions = {
/**
* The WMS info format to be use with Argis OGC server.
*/
arcgisWMSInfoFormat: string;
};
/**
* The full configuration
*/
Expand Down Expand Up @@ -1452,6 +1458,7 @@ export type Configuration = {
gmfCustomCSS: gmfCustomCSS;
gmfI18nextConfiguration: InitOptions;
pytreeLidarprofileJsonUrl: pytreeLidarprofileJsonUrl;
gmfDatasourceOptions: gmfDatasourceOptions;
};

export type APIConfig = {
Expand Down

0 comments on commit 87c60d5

Please sign in to comment.