@geogirafe/lib-geoportal 1.3.0-dev.3053452205 → 1.3.0-dev.3079206142
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.
- package/LICENSE +1 -0
- package/assets/i18n/de.json +33 -3
- package/assets/i18n/en.json +32 -2
- package/assets/i18n/fr.json +34 -4
- package/assets/i18n/it.json +36 -6
- package/assets/icons/edit.svg +1 -1
- package/assets/icons/lock.svg +1 -0
- package/components/cross-section/cross-section-settings/component.js +1 -1
- package/components/edit/component.d.ts +52 -36
- package/components/edit/component.js +340 -292
- package/components/edit/editcomponentstate.d.ts +1 -0
- package/components/edit/editcomponentstate.js +1 -0
- package/components/edit/editform/component.d.ts +33 -4
- package/components/edit/editform/component.js +218 -37
- package/components/edit/editform/style.css +51 -16
- package/components/edit/geometryedithelper.d.ts +47 -0
- package/components/edit/geometryedithelper.js +324 -0
- package/components/edit/style.css +71 -28
- package/components/main.d.ts +1 -1
- package/components/main.js +1 -1
- package/components/print/component.d.ts +1 -1
- package/components/treeview/tools/treeviewelement.d.ts +1 -0
- package/components/treeview/tools/treeviewelement.js +22 -0
- package/components/treeview/treeviewitem/component.js +7 -1
- package/models/gmf.d.ts +18 -2
- package/models/gmf.js +3 -1
- package/models/layers/editablelayer.d.ts +7 -0
- package/models/layers/editablelayer.js +7 -0
- package/models/layers/layerwms.d.ts +1 -2
- package/models/layers/layerwms.js +4 -8
- package/models/main.d.ts +9 -4
- package/models/main.js +6 -2
- package/models/oapiflayer.d.ts +29 -0
- package/models/oapiflayer.js +40 -0
- package/models/oapiftypes.d.ts +71 -0
- package/models/oapiftypes.js +29 -0
- package/models/serverogc.d.ts +5 -3
- package/models/serverogc.js +19 -6
- package/models/serverogcapi.d.ts +2 -0
- package/models/serverogcapi.js +2 -0
- package/models/serverogcapifeatures.d.ts +5 -62
- package/models/serverogcapifeatures.js +8 -4
- package/package.json +1 -1
- package/templates/index.html +1 -0
- package/templates/public/about.json +1 -1
- package/tools/app/geogirafeapp.js +2 -2
- package/tools/drawing/olDrawing.js +2 -22
- package/tools/drawing/shapeConstraints.d.ts +2 -1
- package/tools/drawing/shapeConstraints.js +18 -2
- package/tools/main.d.ts +7 -5
- package/tools/main.js +7 -5
- package/tools/ogcapi/ogcapiclient.d.ts +7 -3
- package/tools/ogcapi/ogcapiclient.js +49 -4
- package/tools/ogcapi/ogcapiconformance.d.ts +2 -2
- package/tools/ogcapi/ogcapiconformance.js +7 -13
- package/tools/ogcapi/ogcapifeaturesclient.d.ts +65 -30
- package/tools/ogcapi/ogcapifeaturesclient.js +265 -139
- package/tools/ogcapi/ogcapifeaturesclientgeorama.d.ts +0 -5
- package/tools/ogcapi/ogcapifeaturesclientgeorama.js +0 -11
- package/tools/ogcapi/ogcapifeaturesclientqgis.d.ts +8 -0
- package/tools/ogcapi/ogcapifeaturesclientqgis.js +13 -0
- package/tools/ogcapi/ogcapifeaturesmanager.d.ts +61 -8
- package/tools/ogcapi/ogcapifeaturesmanager.js +179 -30
- package/tools/ogcapi/ogcapifeaturesschema.d.ts +31 -13
- package/tools/ogcapi/ogcapifeaturesschema.js +69 -39
- package/tools/ogcapi/ogcapifeaturesschemaproperty.d.ts +44 -0
- package/tools/ogcapi/ogcapifeaturesschemaproperty.js +137 -0
- package/tools/ogcapi/ogcapifeaturesschemavalidator.d.ts +22 -0
- package/tools/ogcapi/ogcapifeaturesschemavalidator.js +121 -0
- package/tools/state/state.d.ts +6 -0
- package/tools/state/state.js +4 -0
- package/tools/themes/themesmanager.d.ts +10 -3
- package/tools/themes/themesmanager.js +29 -9
- package/tools/time/layertimeformatter.d.ts +0 -5
- package/tools/time/layertimeformatter.js +10 -19
- package/tools/utils/dateutils.d.ts +40 -0
- package/tools/utils/dateutils.js +111 -0
- package/tools/utils/utils.d.ts +4 -0
- package/tools/utils/utils.js +12 -0
- package/tools/wfs/wfsmanager.js +3 -0
- package/tools/wms/wmsclient.d.ts +1 -0
- package/tools/wms/wmsclient.js +4 -0
- package/tools/ogcapi/demolayers.d.ts +0 -1
- package/tools/ogcapi/demolayers.js +0 -99
- package/tools/ogcapi/ogcapifeaturesclientgmf.d.ts +0 -13
- package/tools/ogcapi/ogcapifeaturesclientgmf.js +0 -30
package/tools/main.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export { default as DrawingState } from './drawing/drawingState.js';
|
|
|
27
27
|
export type { default as ICesiumComponent } from './drawing/icesiumcomponent.js';
|
|
28
28
|
export type { default as IOlComponent } from './drawing/iolcomponent.js';
|
|
29
29
|
export { default as OlDrawing } from './drawing/olDrawing.js';
|
|
30
|
-
export { calculateCenterAndMinRadius, createScaledAndRotatedGeometry, getGeometryForRendering, shouldAllowVertexInsertionForShape } from './drawing/shapeConstraints.js';
|
|
30
|
+
export { calculateCenterAndMinRadius, createScaledAndRotatedGeometry, getGeometryForRendering, shouldAllowVertexInsertionForShape, extractVerticesFromGeometry } from './drawing/shapeConstraints.js';
|
|
31
31
|
export { default as ErrorManager } from './error/errormanager.js';
|
|
32
32
|
export { default as CsvManager } from './export/csvmanager.js';
|
|
33
33
|
export { download } from './export/download.js';
|
|
@@ -53,16 +53,17 @@ export { default as LocalFileManager } from './localfile/localfilemanager.js';
|
|
|
53
53
|
export { default as DefaultConsole } from './logging/defaultconsole.js';
|
|
54
54
|
export { default as LogManager } from './logging/logmanager.js';
|
|
55
55
|
export { default as OfflineManager } from './offline/offlinemanager.js';
|
|
56
|
-
export { DEMO_LAYERS } from './ogcapi/demolayers.js';
|
|
57
56
|
export type { OgcApiClientOptions } from './ogcapi/ogcapiclient.js';
|
|
58
57
|
export { default as OgcApiClient } from './ogcapi/ogcapiclient.js';
|
|
59
58
|
export type { ConformanceLevel } from './ogcapi/ogcapiconformance.js';
|
|
60
59
|
export { getConformanceClass, serverConformsTo } from './ogcapi/ogcapiconformance.js';
|
|
61
|
-
export { default as OgcApiFeaturesClient } from './ogcapi/ogcapifeaturesclient.js';
|
|
60
|
+
export { default as OgcApiFeaturesClient, getEpsgCodeFromCrsUri } from './ogcapi/ogcapifeaturesclient.js';
|
|
62
61
|
export { default as OgcApiFeaturesClientGeorama } from './ogcapi/ogcapifeaturesclientgeorama.js';
|
|
63
|
-
export { default as
|
|
62
|
+
export { default as OgcApiFeaturesClientQgis } from './ogcapi/ogcapifeaturesclientqgis.js';
|
|
64
63
|
export { default as OgcApiFeaturesManager } from './ogcapi/ogcapifeaturesmanager.js';
|
|
65
64
|
export { default as OgcApiFeaturesSchema } from './ogcapi/ogcapifeaturesschema.js';
|
|
65
|
+
export { OgcApiFeaturesSchemaProperty } from './ogcapi/ogcapifeaturesschemaproperty.js';
|
|
66
|
+
export { default as OgcApiFeaturesSchemaValidator } from './ogcapi/ogcapifeaturesschemavalidator.js';
|
|
66
67
|
export { default as OnBoardingManager } from './onboarding/onboardingmanager.js';
|
|
67
68
|
export { default as OrderingManager, LayerTreeStartOrder } from './ordering/orderingmanager.js';
|
|
68
69
|
export type { GeoTransform } from './raster/rasterutils.js';
|
|
@@ -150,6 +151,7 @@ export { default as UrlManager } from './url/urlmanager.js';
|
|
|
150
151
|
export { default as UserDataManager } from './userdata/userdatamanager.js';
|
|
151
152
|
export { default as ColumnAliasHelper } from './utils/aliases.js';
|
|
152
153
|
export { noop } from './utils/async.js';
|
|
154
|
+
export { default as DateUtils } from './utils/dateutils.js';
|
|
153
155
|
export { debounce } from './utils/debounce.js';
|
|
154
156
|
export { default as GirafeColorPicker } from './utils/girafecolorpicker.js';
|
|
155
157
|
export { unByKeyAll, getOlayerByName, removeUnwantedOlParams, polygonFromCircle, getDistance, getAreaOfPolygon, getAreaOfCircle, isCoordinateInDegrees, getSelectionBoxFromMapClick, reprojectGeometry, ensurePolygonIsProperlyClosed, getHalfPoint, getLabelStyle, getRadiusDataForCircle, getLengthAsMetricText, getAreaAsMetricText, getAzimuthAsText } from './utils/olutils.js';
|
|
@@ -157,7 +159,7 @@ export { getPropertyByPath, setPropertyByPath, createObjectFromPath, deletePrope
|
|
|
157
159
|
export { generateQrCode } from './utils/qrcode.js';
|
|
158
160
|
export { sanitize } from './utils/sanitize.js';
|
|
159
161
|
export { default as ServiceWorkerHelper } from './utils/swhelper.js';
|
|
160
|
-
export { systemIsInDarkMode, isSafari, isFirefox, getValidIndex, minMax, hexToRgbaArray, rgbStrToRgbaArray, colorToRgbaArray, isValidEmail, applyOpacityToLayers, applyFeaturesToSelection, linkify, applyDefaultPrefixToUrl, splitTrimAndConvertToNumber } from './utils/utils.js';
|
|
162
|
+
export { systemIsInDarkMode, isSafari, isFirefox, getValidIndex, minMax, hexToRgbaArray, rgbStrToRgbaArray, colorToRgbaArray, rgbaArrayToString, isValidEmail, applyOpacityToLayers, applyFeaturesToSelection, linkify, applyDefaultPrefixToUrl, splitTrimAndConvertToNumber } from './utils/utils.js';
|
|
161
163
|
export { default as VendorSpecificOgcServerManager } from './vendorspecificogcservermanager.js';
|
|
162
164
|
export { CompositeCurveGML3, CompositeCurveGML32 } from './wfs/compositecurvegml.js';
|
|
163
165
|
export type { WfsClientOptions, WfsClientOptionalOptions, QueryableLayerWms, GetFeatureOptionsPartial } from './wfs/wfsclient.js';
|
package/tools/main.js
CHANGED
|
@@ -20,7 +20,7 @@ export { default as DrawingFeature } from './drawing/drawingFeature.js';
|
|
|
20
20
|
export { default as DrawingSerializer } from './drawing/drawingSerializer.js';
|
|
21
21
|
export { default as DrawingState } from './drawing/drawingState.js';
|
|
22
22
|
export { default as OlDrawing } from './drawing/olDrawing.js';
|
|
23
|
-
export { calculateCenterAndMinRadius, createScaledAndRotatedGeometry, getGeometryForRendering, shouldAllowVertexInsertionForShape } from './drawing/shapeConstraints.js';
|
|
23
|
+
export { calculateCenterAndMinRadius, createScaledAndRotatedGeometry, getGeometryForRendering, shouldAllowVertexInsertionForShape, extractVerticesFromGeometry } from './drawing/shapeConstraints.js';
|
|
24
24
|
export { default as ErrorManager } from './error/errormanager.js';
|
|
25
25
|
export { default as CsvManager } from './export/csvmanager.js';
|
|
26
26
|
export { download } from './export/download.js';
|
|
@@ -42,14 +42,15 @@ export { default as LocalFileManager } from './localfile/localfilemanager.js';
|
|
|
42
42
|
export { default as DefaultConsole } from './logging/defaultconsole.js';
|
|
43
43
|
export { default as LogManager } from './logging/logmanager.js';
|
|
44
44
|
export { default as OfflineManager } from './offline/offlinemanager.js';
|
|
45
|
-
export { DEMO_LAYERS } from './ogcapi/demolayers.js';
|
|
46
45
|
export { default as OgcApiClient } from './ogcapi/ogcapiclient.js';
|
|
47
46
|
export { getConformanceClass, serverConformsTo } from './ogcapi/ogcapiconformance.js';
|
|
48
|
-
export { default as OgcApiFeaturesClient } from './ogcapi/ogcapifeaturesclient.js';
|
|
47
|
+
export { default as OgcApiFeaturesClient, getEpsgCodeFromCrsUri } from './ogcapi/ogcapifeaturesclient.js';
|
|
49
48
|
export { default as OgcApiFeaturesClientGeorama } from './ogcapi/ogcapifeaturesclientgeorama.js';
|
|
50
|
-
export { default as
|
|
49
|
+
export { default as OgcApiFeaturesClientQgis } from './ogcapi/ogcapifeaturesclientqgis.js';
|
|
51
50
|
export { default as OgcApiFeaturesManager } from './ogcapi/ogcapifeaturesmanager.js';
|
|
52
51
|
export { default as OgcApiFeaturesSchema } from './ogcapi/ogcapifeaturesschema.js';
|
|
52
|
+
export { OgcApiFeaturesSchemaProperty } from './ogcapi/ogcapifeaturesschemaproperty.js';
|
|
53
|
+
export { default as OgcApiFeaturesSchemaValidator } from './ogcapi/ogcapifeaturesschemavalidator.js';
|
|
53
54
|
export { default as OnBoardingManager } from './onboarding/onboardingmanager.js';
|
|
54
55
|
export { default as OrderingManager, LayerTreeStartOrder } from './ordering/orderingmanager.js';
|
|
55
56
|
export { extractGeoTransform, mapToPixel, pixelToMap, getImage, getPixelValue } from './raster/rasterutils.js';
|
|
@@ -109,6 +110,7 @@ export { default as UrlManager } from './url/urlmanager.js';
|
|
|
109
110
|
export { default as UserDataManager } from './userdata/userdatamanager.js';
|
|
110
111
|
export { default as ColumnAliasHelper } from './utils/aliases.js';
|
|
111
112
|
export { noop } from './utils/async.js';
|
|
113
|
+
export { default as DateUtils } from './utils/dateutils.js';
|
|
112
114
|
export { debounce } from './utils/debounce.js';
|
|
113
115
|
export { default as GirafeColorPicker } from './utils/girafecolorpicker.js';
|
|
114
116
|
export { unByKeyAll, getOlayerByName, removeUnwantedOlParams, polygonFromCircle, getDistance, getAreaOfPolygon, getAreaOfCircle, isCoordinateInDegrees, getSelectionBoxFromMapClick, reprojectGeometry, ensurePolygonIsProperlyClosed, getHalfPoint, getLabelStyle, getRadiusDataForCircle, getLengthAsMetricText, getAreaAsMetricText, getAzimuthAsText } from './utils/olutils.js';
|
|
@@ -116,7 +118,7 @@ export { getPropertyByPath, setPropertyByPath, createObjectFromPath, deletePrope
|
|
|
116
118
|
export { generateQrCode } from './utils/qrcode.js';
|
|
117
119
|
export { sanitize } from './utils/sanitize.js';
|
|
118
120
|
export { default as ServiceWorkerHelper } from './utils/swhelper.js';
|
|
119
|
-
export { systemIsInDarkMode, isSafari, isFirefox, getValidIndex, minMax, hexToRgbaArray, rgbStrToRgbaArray, colorToRgbaArray, isValidEmail, applyOpacityToLayers, applyFeaturesToSelection, linkify, applyDefaultPrefixToUrl, splitTrimAndConvertToNumber } from './utils/utils.js';
|
|
121
|
+
export { systemIsInDarkMode, isSafari, isFirefox, getValidIndex, minMax, hexToRgbaArray, rgbStrToRgbaArray, colorToRgbaArray, rgbaArrayToString, isValidEmail, applyOpacityToLayers, applyFeaturesToSelection, linkify, applyDefaultPrefixToUrl, splitTrimAndConvertToNumber } from './utils/utils.js';
|
|
120
122
|
export { default as VendorSpecificOgcServerManager } from './vendorspecificogcservermanager.js';
|
|
121
123
|
export { CompositeCurveGML3, CompositeCurveGML32 } from './wfs/compositecurvegml.js';
|
|
122
124
|
export { default as WfsClient, WfsClientMapServer, WfsClientQgis, WfsClientGeorama, WfsClientDefault, WfsClientGeoServer } from './wfs/wfsclient.js';
|
|
@@ -15,13 +15,17 @@ export default abstract class OgcApiClient<Server = ServerOgcApi> {
|
|
|
15
15
|
private readonly stateManager;
|
|
16
16
|
protected readonly options: OgcApiClientOptions;
|
|
17
17
|
initialized: boolean;
|
|
18
|
+
protected mainRelations: Map<string, URL>;
|
|
19
|
+
protected defaultPathForRelation: Map<string, string>;
|
|
18
20
|
protected get state(): import("../main.js").State;
|
|
19
21
|
get url(): string;
|
|
20
|
-
constructor(serverOgc: ServerOgc, opt: OgcApiClientOptions, stateManager: StateManager);
|
|
22
|
+
protected constructor(serverOgc: ServerOgc, opt: OgcApiClientOptions, stateManager: StateManager);
|
|
21
23
|
getServer(): Promise<Server>;
|
|
22
24
|
protected describeServer(): Promise<Server>;
|
|
23
25
|
protected abstract getUrl(): string;
|
|
24
26
|
protected abstract loadDescribeServer(): Promise<Server>;
|
|
27
|
+
protected registerMainRelations(relations?: string[]): Promise<void>;
|
|
28
|
+
protected buildUrlManually(baseUrl: URL, relation: string): URL;
|
|
25
29
|
/**
|
|
26
30
|
* Load the list of conformance classes, which describe what kind of functionality the server provides.
|
|
27
31
|
*/
|
|
@@ -33,7 +37,7 @@ export default abstract class OgcApiClient<Server = ServerOgcApi> {
|
|
|
33
37
|
/**
|
|
34
38
|
* Retrieves a specific link from the OGC API resource based on the given relation and encoding type.
|
|
35
39
|
*/
|
|
36
|
-
getLink(relation: string, path?: string | URL, encodingType?: string): Promise<
|
|
40
|
+
getLink(relation: string, path?: string | URL, encodingType?: string): Promise<URL>;
|
|
37
41
|
/**
|
|
38
42
|
* Fetches all paginated resources from the specified URL until the entire dataset is retrieved.
|
|
39
43
|
* `dataListName` is the attribute name that holds the list of data items in the response JSON.
|
|
@@ -45,7 +49,7 @@ export default abstract class OgcApiClient<Server = ServerOgcApi> {
|
|
|
45
49
|
* Sanitizes a list of links by ensuring that their URLs are consistent with the original request URL.
|
|
46
50
|
* Sanitizes if the original URL does not match the link in the `self` href.
|
|
47
51
|
* Limitation: Only works if the original URL and the faulty link share at least one common URL path element, e.g.:
|
|
48
|
-
* '/api/' in (original) https://example.com/api/ and (faulty) https://
|
|
52
|
+
* '/api/' in (original) https://example.com/api/ and (faulty) https://localhost:8080/mapserv_proxy/api/
|
|
49
53
|
*
|
|
50
54
|
* @param {string} originalPath - The URL of the original request.
|
|
51
55
|
* @param {OgcApiLinksResponse[] | undefined} links - The array of links to sanitize.
|
|
@@ -10,6 +10,9 @@ export default class OgcApiClient {
|
|
|
10
10
|
stateManager;
|
|
11
11
|
options;
|
|
12
12
|
initialized;
|
|
13
|
+
// Relations are a collection of URLs linking to the main resources of the server
|
|
14
|
+
mainRelations = new Map();
|
|
15
|
+
defaultPathForRelation = new Map();
|
|
13
16
|
get state() {
|
|
14
17
|
return this.stateManager.state;
|
|
15
18
|
}
|
|
@@ -38,11 +41,51 @@ export default class OgcApiClient {
|
|
|
38
41
|
}
|
|
39
42
|
return this.server;
|
|
40
43
|
}
|
|
44
|
+
async registerMainRelations(relations) {
|
|
45
|
+
relations ??= ['conformance'];
|
|
46
|
+
this.mainRelations = new Map();
|
|
47
|
+
const baseUrl = new URL(this.url);
|
|
48
|
+
const failed = [];
|
|
49
|
+
if (!this.url.includes('json')) {
|
|
50
|
+
baseUrl.searchParams.set('f', 'json');
|
|
51
|
+
}
|
|
52
|
+
let links = [];
|
|
53
|
+
try {
|
|
54
|
+
links = await this.getLinks(baseUrl);
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
// If fetching landing page fails, links stays empty and all relations fall back to manual URLs
|
|
58
|
+
}
|
|
59
|
+
for (const relation of relations) {
|
|
60
|
+
const link = links.find((entry) => entry.rel === relation && (!('type' in entry) || entry.type === OgcApiDefaultEncoding))?.href;
|
|
61
|
+
if (link) {
|
|
62
|
+
this.mainRelations.set(relation, new URL(link));
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
failed.push(relation);
|
|
66
|
+
this.mainRelations.set(relation, this.buildUrlManually(baseUrl, relation));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (failed.length > 0) {
|
|
70
|
+
console.warn(`Failed to retrieve URL for ${failed.join(', ')} from landing page, building URL manually`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
buildUrlManually(baseUrl, relation) {
|
|
74
|
+
const manualUrl = new URL(baseUrl);
|
|
75
|
+
// Remove last slash and add the partial path from default paths
|
|
76
|
+
manualUrl.pathname =
|
|
77
|
+
manualUrl.pathname.replace(/\/$/, '') + `/${this.defaultPathForRelation.get(relation) ?? relation}`;
|
|
78
|
+
return manualUrl;
|
|
79
|
+
}
|
|
41
80
|
/**
|
|
42
81
|
* Load the list of conformance classes, which describe what kind of functionality the server provides.
|
|
43
82
|
*/
|
|
44
83
|
async loadConformance() {
|
|
45
|
-
const
|
|
84
|
+
const url = this.mainRelations.get('conformance');
|
|
85
|
+
if (!url) {
|
|
86
|
+
throw new Error("OGC API Features 'conformance' end point not known");
|
|
87
|
+
}
|
|
88
|
+
const response = await fetch(url, this.getFetchOptions());
|
|
46
89
|
if (!response?.ok) {
|
|
47
90
|
throw new Error(`Failed to get conformance: ${response?.status} - ${response?.statusText}`);
|
|
48
91
|
}
|
|
@@ -69,7 +112,7 @@ export default class OgcApiClient {
|
|
|
69
112
|
if (!link) {
|
|
70
113
|
throw new Error(`OGC API resource at '${path}' does not support '${relation}'}`);
|
|
71
114
|
}
|
|
72
|
-
return link;
|
|
115
|
+
return new URL(link);
|
|
73
116
|
}
|
|
74
117
|
/**
|
|
75
118
|
* Fetches all paginated resources from the specified URL until the entire dataset is retrieved.
|
|
@@ -104,14 +147,16 @@ export default class OgcApiClient {
|
|
|
104
147
|
const fetchOptions = {
|
|
105
148
|
method: method
|
|
106
149
|
};
|
|
107
|
-
|
|
150
|
+
const headers = new Headers(fetchOptions?.headers);
|
|
151
|
+
headers.set('Accept', OgcApiDefaultEncoding);
|
|
152
|
+
fetchOptions.headers = headers;
|
|
108
153
|
return fetchOptions;
|
|
109
154
|
}
|
|
110
155
|
/**
|
|
111
156
|
* Sanitizes a list of links by ensuring that their URLs are consistent with the original request URL.
|
|
112
157
|
* Sanitizes if the original URL does not match the link in the `self` href.
|
|
113
158
|
* Limitation: Only works if the original URL and the faulty link share at least one common URL path element, e.g.:
|
|
114
|
-
* '/api/' in (original) https://example.com/api/ and (faulty) https://
|
|
159
|
+
* '/api/' in (original) https://example.com/api/ and (faulty) https://localhost:8080/mapserv_proxy/api/
|
|
115
160
|
*
|
|
116
161
|
* @param {string} originalPath - The URL of the original request.
|
|
117
162
|
* @param {OgcApiLinksResponse[] | undefined} links - The array of links to sanitize.
|
|
@@ -22,9 +22,9 @@ type ConformanceClass = keyof typeof OgcApiConformanceClasses;
|
|
|
22
22
|
declare const conformanceLevels: {
|
|
23
23
|
ogcapi_features_read: ("features-p1-core" | "features-p1-geojson")[];
|
|
24
24
|
ogcapi_features_crs: "features-p2-crs"[];
|
|
25
|
+
ogcapi_features_schema: ("features-p1-core" | "features-p1-geojson" | "features-p5-schemas")[];
|
|
25
26
|
ogcapi_features_query: ("features-p1-core" | "features-p1-geojson" | "features-p3-queryables" | "features-p3-queryables-query-parameters")[];
|
|
26
|
-
|
|
27
|
-
ogcapi_features_advanced_write: ("features-p1-core" | "features-p1-geojson" | "features-p2-crs" | "features-p4-create-replace-delete" | "features-p5-schemas" | "features-p5-core-roles-features" | "features-p5-feature-references")[];
|
|
27
|
+
ogcapi_features_write: ("features-p1-core" | "features-p1-geojson" | "features-p4-create-replace-delete")[];
|
|
28
28
|
};
|
|
29
29
|
export type ConformanceLevel = keyof typeof conformanceLevels;
|
|
30
30
|
export declare const getConformanceClass: (className: ConformanceClass) => string;
|
|
@@ -22,28 +22,22 @@ const OgcApiConformanceClasses = {
|
|
|
22
22
|
};
|
|
23
23
|
const ogcapi_features_read = ['features-p1-core', 'features-p1-geojson'];
|
|
24
24
|
const ogcapi_features_crs = ['features-p2-crs'];
|
|
25
|
+
const ogcapi_features_schema = [...ogcapi_features_read, 'features-p5-schemas'];
|
|
25
26
|
const ogcapi_features_query = [
|
|
26
27
|
...ogcapi_features_read,
|
|
27
28
|
'features-p3-queryables',
|
|
28
29
|
'features-p3-queryables-query-parameters'
|
|
29
30
|
];
|
|
30
|
-
const
|
|
31
|
+
const ogcapi_features_write = [
|
|
31
32
|
...ogcapi_features_read,
|
|
32
|
-
|
|
33
|
-
'features-p4-create-replace-delete',
|
|
34
|
-
'features-p5-schemas'
|
|
35
|
-
];
|
|
36
|
-
const ogcapi_features_advanced_write = [
|
|
37
|
-
...ogcapi_features_simple_write,
|
|
38
|
-
'features-p5-core-roles-features',
|
|
39
|
-
'features-p5-feature-references'
|
|
33
|
+
'features-p4-create-replace-delete'
|
|
40
34
|
];
|
|
41
35
|
const conformanceLevels = {
|
|
42
36
|
ogcapi_features_read,
|
|
43
37
|
ogcapi_features_crs,
|
|
38
|
+
ogcapi_features_schema,
|
|
44
39
|
ogcapi_features_query,
|
|
45
|
-
|
|
46
|
-
ogcapi_features_advanced_write
|
|
40
|
+
ogcapi_features_write
|
|
47
41
|
};
|
|
48
42
|
const satisfiesConformanceLevel = (conformanceList, level) => {
|
|
49
43
|
return conformanceLevels[level].map(getConformanceClass).every((item) => conformanceList.includes(item));
|
|
@@ -55,8 +49,8 @@ export const serverConformsTo = (conformanceList) => {
|
|
|
55
49
|
return {
|
|
56
50
|
ogcapi_features_read: satisfiesConformanceLevel(conformanceList, 'ogcapi_features_read'),
|
|
57
51
|
ogcapi_features_crs: satisfiesConformanceLevel(conformanceList, 'ogcapi_features_crs'),
|
|
52
|
+
ogcapi_features_schema: satisfiesConformanceLevel(conformanceList, 'ogcapi_features_schema'),
|
|
58
53
|
ogcapi_features_query: satisfiesConformanceLevel(conformanceList, 'ogcapi_features_query'),
|
|
59
|
-
|
|
60
|
-
ogcapi_features_advanced_write: satisfiesConformanceLevel(conformanceList, 'ogcapi_features_advanced_write')
|
|
54
|
+
ogcapi_features_write: satisfiesConformanceLevel(conformanceList, 'ogcapi_features_write')
|
|
61
55
|
};
|
|
62
56
|
};
|
|
@@ -1,42 +1,73 @@
|
|
|
1
1
|
import { Feature } from 'ol';
|
|
2
2
|
import { Geometry } from 'ol/geom.js';
|
|
3
3
|
import OgcApiClient, { OgcApiClientOptions } from './ogcapiclient.js';
|
|
4
|
-
import ServerOgcApiFeatures
|
|
4
|
+
import ServerOgcApiFeatures from '../../models/serverogcapifeatures.js';
|
|
5
5
|
import ServerOgc from '../../models/serverogc.js';
|
|
6
6
|
import { HttpMethod } from '../../models/serverogcapi.js';
|
|
7
|
+
import { GeometryLayout as olGeometryLayout } from 'ol/geom/Geometry.js';
|
|
7
8
|
import IGirafeContext from '../context/icontext.js';
|
|
9
|
+
import { EditingPermission, OapifCollection, OapifSchemaResponse } from '../../models/oapiftypes.js';
|
|
8
10
|
/**
|
|
9
|
-
* Class representing an OGC API Features (OAPIF) client
|
|
10
|
-
* the OGC API - Features standard. This class provides functionality to fetch, manage, and
|
|
11
|
+
* Class representing an OGC API Features (OAPIF) client. This client provides functionality to fetch, manage, and
|
|
11
12
|
* manipulate collections and their spatial data from the server.
|
|
12
13
|
*
|
|
13
14
|
* Extends `OgcApiClient<ServerOgcApiFeatures>`: Provides base client functionalities.
|
|
14
15
|
*/
|
|
15
16
|
export default class OgcApiFeaturesClient extends OgcApiClient<ServerOgcApiFeatures> {
|
|
17
|
+
readonly defaultCrsCode = "EPSG:4326";
|
|
16
18
|
private collections;
|
|
17
19
|
constructor(serverConfig: ServerOgc, opt: OgcApiClientOptions, context: IGirafeContext);
|
|
18
20
|
protected getUrl(): string;
|
|
19
21
|
protected loadDescribeServer(): Promise<ServerOgcApiFeatures>;
|
|
22
|
+
protected registerMainRelations(relations?: string[]): Promise<void>;
|
|
20
23
|
getCollections(): Promise<OapifCollection[]>;
|
|
21
24
|
/**
|
|
22
|
-
* Retrieves a collection by its ID. If the collection is not already cached, it
|
|
23
|
-
*
|
|
25
|
+
* Retrieves a collection by its ID. If the collection is not already cached, it is fetched, its link object is
|
|
26
|
+
* sanitized, and it is stored locally.
|
|
24
27
|
*/
|
|
25
28
|
getCollection(collectionId: string): Promise<OapifCollection>;
|
|
26
29
|
/**
|
|
27
|
-
* Retrieves the
|
|
30
|
+
* Retrieves the storage coordinate reference system for a specified collection.
|
|
31
|
+
* The storageCrs information is only available if the server supports part 2 of the OGC API Features specification,
|
|
32
|
+
* otherwise the default CRS is the only supported CRS.
|
|
33
|
+
*/
|
|
34
|
+
getCollectionStorageCrsCode(collectionId: string): Promise<string>;
|
|
35
|
+
/**
|
|
36
|
+
* Retrieves the schema (data description) associated with a specified collection.
|
|
28
37
|
*/
|
|
29
38
|
getSchema(collectionId: string): Promise<OapifSchemaResponse>;
|
|
39
|
+
/**
|
|
40
|
+
* Describes the layout of the geometry in the collection by analysing the collections' extent.
|
|
41
|
+
* If the extent has 6 entries, it's 3D geometries, otherwise it's 2D. Possible values are: 'XY' or 'XYZ'.
|
|
42
|
+
* Measure values (e.g. `XYZM`) aren't detected yet.
|
|
43
|
+
*/
|
|
44
|
+
getGeometryLayout(collectionId: string): Promise<olGeometryLayout | null>;
|
|
45
|
+
/**
|
|
46
|
+
* Checks the allowed CRUD permissions for a collection by sending an OPTIONS request to the `/items` endpoint.
|
|
47
|
+
* Note: Due to CORS, the `Allow` header is only accessible from JS if the server config exposes it via
|
|
48
|
+
* `Access-Control-Expose-Headers: Allow`.
|
|
49
|
+
* If the response does not contain the `Allow` header, editing is still possible, but the permissions are unknown.
|
|
50
|
+
*/
|
|
51
|
+
checkCRUDPermissions(collectionId: string): Promise<EditingPermission[] | undefined>;
|
|
52
|
+
/**
|
|
53
|
+
* Retrieves the attributes that are available for usage in queries.
|
|
54
|
+
*/
|
|
30
55
|
getQueryables(collectionId: string): Promise<OapifSchemaResponse>;
|
|
31
56
|
/**
|
|
32
|
-
* Retrieves
|
|
57
|
+
* Retrieves a resource link of a specified collection, relation type (e.g. `schema`, `self`, `parent`, etc.)
|
|
58
|
+
* and encoding type.
|
|
33
59
|
*/
|
|
34
|
-
|
|
60
|
+
getCollectionRelationLink(collectionId: string, relation: string, encodingType?: string): Promise<URL>;
|
|
35
61
|
/**
|
|
36
62
|
* Retrieves items from a specified collection, optionally applying filters like CRS (Coordinate Reference System),
|
|
37
63
|
* spatial extent, and limit.
|
|
38
64
|
*/
|
|
39
|
-
getItems(collectionId: string,
|
|
65
|
+
getItems(collectionId: string, options?: {
|
|
66
|
+
crsCode?: string;
|
|
67
|
+
bbox?: number[];
|
|
68
|
+
limit?: number;
|
|
69
|
+
}): Promise<Feature<Geometry>[]>;
|
|
70
|
+
protected buildItemUrl(baseItemsUrl: URL, itemId: string): URL;
|
|
40
71
|
/**
|
|
41
72
|
* Retrieves a single item from the specified collection by its ID.
|
|
42
73
|
*/
|
|
@@ -47,38 +78,42 @@ export default class OgcApiFeaturesClient extends OgcApiClient<ServerOgcApiFeatu
|
|
|
47
78
|
*/
|
|
48
79
|
createItem(collectionId: string, item: Feature<Geometry>, crsCode: string): Promise<boolean>;
|
|
49
80
|
/**
|
|
50
|
-
*
|
|
81
|
+
* Replaces an existing item in the specified collection.
|
|
82
|
+
* Geometries are reprojected if the server does not support the items current CRS.
|
|
51
83
|
*/
|
|
52
|
-
|
|
84
|
+
replaceItem(collectionId: string, itemId: string, item: Feature<Geometry>, crsCode: string): Promise<boolean>;
|
|
53
85
|
/**
|
|
54
86
|
* Deletes an item from a specific collection.
|
|
55
87
|
*/
|
|
56
88
|
deleteItem(collectionId: string, itemId: string): Promise<boolean>;
|
|
57
89
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
private getEpsgCodeFromCrsIdentifier;
|
|
64
|
-
/**
|
|
65
|
-
* Checks if the provided extent's coordinate reference system (CRS) is supported by a given collection
|
|
66
|
-
* and reprojects the extent if necessary.
|
|
90
|
+
* Handles reprojection of an item to a CRS supported by the server. No transformation happens if the item's CRS is
|
|
91
|
+
* already supported. CRS fallbacks are:
|
|
92
|
+
* 1. transform item to the collections storage CRS
|
|
93
|
+
* 2. transform item to the OAPIF default CRS
|
|
94
|
+
* Precision loss may occur when reprojecting.
|
|
67
95
|
*/
|
|
68
|
-
private
|
|
96
|
+
private itemReprojectionHandler;
|
|
69
97
|
/**
|
|
70
|
-
* Retrieves the
|
|
71
|
-
*
|
|
98
|
+
* Retrieves the CRS URI identifier based on the provided CRS code. Getting the identifier from the server is more
|
|
99
|
+
* reliable because CRS URIs can vary slightly (e.g. http vs. https) between servers.
|
|
100
|
+
* Note: EPSG:4326 and OGC:CRS84 technically differ in their coordinate order: CRS84 is lon / lat (east / north),
|
|
101
|
+
* while EPSG:4326 is lat / lon (north / east). However, since Openlayers uses EPSG:4326 with lon / lat
|
|
102
|
+
* coordinate order, we can use EPSG:4326 as the default CRS code.
|
|
72
103
|
*/
|
|
73
|
-
private
|
|
104
|
+
private getCrsUriFromEpsgCode;
|
|
105
|
+
private reprojectExtentToDefaultCrs;
|
|
74
106
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* which is the default CRS for OAPIF and GeoJson.
|
|
107
|
+
* Reproject the item geometry to a coordinate reference system supported by the server to allow write operations.
|
|
108
|
+
* Will throw an error if the reprojection fails.
|
|
78
109
|
*/
|
|
79
|
-
private
|
|
110
|
+
private reprojectItem;
|
|
80
111
|
/**
|
|
81
|
-
* Expands the method from OgcApiClient by customizing headers to support GeoJson content
|
|
112
|
+
* Expands the method from OgcApiClient by customizing headers to support GeoJson content.
|
|
82
113
|
*/
|
|
83
|
-
protected getFetchOptions(method?: HttpMethod,
|
|
114
|
+
protected getFetchOptions(method?: HttpMethod, acceptType?: string): RequestInit;
|
|
115
|
+
private checkConformanceForSchemaHandling;
|
|
116
|
+
private checkConformanceForQuerying;
|
|
117
|
+
protected checkConformsForCrudOperations(): Promise<void>;
|
|
84
118
|
}
|
|
119
|
+
export declare const getEpsgCodeFromCrsUri: (crsUri: string) => string | undefined;
|