@geogirafe/lib-geoportal 1.3.0-dev.3046054236 → 1.3.0-dev.3060317043

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.
Files changed (111) hide show
  1. package/LICENSE +1 -0
  2. package/README.md +3 -2
  3. package/api/apigeogirafeapp.js +3 -1
  4. package/assets/i18n/de.json +34 -3
  5. package/assets/i18n/en.json +33 -2
  6. package/assets/i18n/fr.json +35 -4
  7. package/assets/i18n/it.json +37 -6
  8. package/assets/icons/edit.svg +1 -1
  9. package/assets/icons/lock.svg +1 -0
  10. package/assets/icons/streetview-marker-mapillary.svg +1 -0
  11. package/components/cross-section/cross-section-settings/component.js +1 -1
  12. package/components/edit/component.d.ts +52 -36
  13. package/components/edit/component.js +340 -292
  14. package/components/edit/editcomponentstate.d.ts +1 -0
  15. package/components/edit/editcomponentstate.js +1 -0
  16. package/components/edit/editform/component.d.ts +34 -4
  17. package/components/edit/editform/component.js +224 -37
  18. package/components/edit/editform/style.css +51 -16
  19. package/components/edit/geometryedithelper.d.ts +47 -0
  20. package/components/edit/geometryedithelper.js +324 -0
  21. package/components/edit/style.css +71 -28
  22. package/components/layout/component.d.ts +5 -0
  23. package/components/main.d.ts +1 -1
  24. package/components/main.js +1 -1
  25. package/components/map-grid/component.d.ts +4 -0
  26. package/components/map-grid/component.js +6 -0
  27. package/components/print/component.d.ts +1 -1
  28. package/components/streetview/component.d.ts +9 -2
  29. package/components/streetview/component.js +20 -8
  30. package/components/streetview/google.js +1 -1
  31. package/components/streetview/mapillary.d.ts +8 -0
  32. package/components/streetview/mapillary.js +20 -0
  33. package/components/streetview/style.css +16 -0
  34. package/components/streetview/tools/googleprovider.js +9 -2
  35. package/components/streetview/tools/mapillaryprovider.d.ts +70 -0
  36. package/components/streetview/tools/mapillaryprovider.js +150 -0
  37. package/components/treeview/tools/treeviewelement.d.ts +1 -0
  38. package/components/treeview/tools/treeviewelement.js +22 -0
  39. package/components/treeview/treeviewitem/component.js +7 -1
  40. package/models/gmf.d.ts +18 -2
  41. package/models/gmf.js +3 -1
  42. package/models/layers/editablelayer.d.ts +7 -0
  43. package/models/layers/editablelayer.js +7 -0
  44. package/models/layers/layerwms.d.ts +1 -2
  45. package/models/layers/layerwms.js +4 -8
  46. package/models/main.d.ts +9 -4
  47. package/models/main.js +6 -2
  48. package/models/oapiflayer.d.ts +25 -0
  49. package/models/oapiflayer.js +36 -0
  50. package/models/oapiftypes.d.ts +71 -0
  51. package/models/oapiftypes.js +29 -0
  52. package/models/serverogc.d.ts +5 -3
  53. package/models/serverogc.js +19 -6
  54. package/models/serverogcapi.d.ts +2 -0
  55. package/models/serverogcapi.js +2 -0
  56. package/models/serverogcapifeatures.d.ts +5 -62
  57. package/models/serverogcapifeatures.js +8 -4
  58. package/package.json +1 -1
  59. package/templates/iframe.html +1 -0
  60. package/templates/index.html +2 -0
  61. package/templates/mobile.html +1 -0
  62. package/templates/public/about.json +1 -1
  63. package/tools/app/geogirafeapp-mobile.js +2 -0
  64. package/tools/app/geogirafeapp.js +4 -2
  65. package/tools/configuration/girafeconfig.js +1 -8
  66. package/tools/configuration/streetviewconfig.d.ts +12 -1
  67. package/tools/configuration/streetviewconfig.js +26 -4
  68. package/tools/drawing/olDrawing.js +2 -22
  69. package/tools/drawing/shapeConstraints.d.ts +2 -1
  70. package/tools/drawing/shapeConstraints.js +18 -2
  71. package/tools/main.d.ts +9 -7
  72. package/tools/main.js +8 -6
  73. package/tools/ogcapi/ogcapiclient.d.ts +7 -3
  74. package/tools/ogcapi/ogcapiclient.js +49 -4
  75. package/tools/ogcapi/ogcapiconformance.d.ts +2 -2
  76. package/tools/ogcapi/ogcapiconformance.js +7 -13
  77. package/tools/ogcapi/ogcapifeaturesclient.d.ts +65 -30
  78. package/tools/ogcapi/ogcapifeaturesclient.js +265 -139
  79. package/tools/ogcapi/ogcapifeaturesclientgeorama.d.ts +0 -5
  80. package/tools/ogcapi/ogcapifeaturesclientgeorama.js +0 -11
  81. package/tools/ogcapi/ogcapifeaturesclientqgis.d.ts +8 -0
  82. package/tools/ogcapi/ogcapifeaturesclientqgis.js +13 -0
  83. package/tools/ogcapi/ogcapifeaturesmanager.d.ts +61 -8
  84. package/tools/ogcapi/ogcapifeaturesmanager.js +179 -30
  85. package/tools/ogcapi/ogcapifeaturesschema.d.ts +31 -13
  86. package/tools/ogcapi/ogcapifeaturesschema.js +69 -39
  87. package/tools/ogcapi/ogcapifeaturesschemaproperty.d.ts +44 -0
  88. package/tools/ogcapi/ogcapifeaturesschemaproperty.js +137 -0
  89. package/tools/ogcapi/ogcapifeaturesschemavalidator.d.ts +22 -0
  90. package/tools/ogcapi/ogcapifeaturesschemavalidator.js +121 -0
  91. package/tools/state/layout.d.ts +5 -0
  92. package/tools/state/layout.js +2 -1
  93. package/tools/state/state.d.ts +6 -0
  94. package/tools/state/state.js +4 -0
  95. package/tools/state/streetview.d.ts +1 -1
  96. package/tools/state/streetview.js +1 -1
  97. package/tools/themes/themesmanager.d.ts +10 -3
  98. package/tools/themes/themesmanager.js +29 -9
  99. package/tools/time/layertimeformatter.d.ts +0 -5
  100. package/tools/time/layertimeformatter.js +10 -19
  101. package/tools/utils/dateutils.d.ts +40 -0
  102. package/tools/utils/dateutils.js +111 -0
  103. package/tools/utils/utils.d.ts +4 -0
  104. package/tools/utils/utils.js +12 -0
  105. package/tools/wfs/wfsmanager.js +3 -0
  106. package/tools/wms/wmsclient.d.ts +1 -0
  107. package/tools/wms/wmsclient.js +4 -0
  108. package/tools/ogcapi/demolayers.d.ts +0 -1
  109. package/tools/ogcapi/demolayers.js +0 -99
  110. package/tools/ogcapi/ogcapifeaturesclientgmf.d.ts +0 -13
  111. package/tools/ogcapi/ogcapifeaturesclientgmf.js +0 -30
package/tools/main.d.ts CHANGED
@@ -13,8 +13,8 @@ export { default as ConfigManager } from './configuration/configmanager.js';
13
13
  export type { HighlightMode, UserDataConfig } from './configuration/girafeconfig.js';
14
14
  export { default as GirafeConfig } from './configuration/girafeconfig.js';
15
15
  export { defaultNewsSanitizeConfig, defaultPermalinkSanitizeConfig, defaultQuerySanitizeConfig } from './configuration/sanitizeconfig-defaults.js';
16
- export type { StreetViewConfig } from './configuration/streetviewconfig.js';
17
- export { DEFAULT_STREETVIEW_SEARCH_RADIUS, initConfigStreetView, isStreetViewProviderConfigured } from './configuration/streetviewconfig.js';
16
+ export type { MapillaryConfig, StreetViewConfig } from './configuration/streetviewconfig.js';
17
+ export { DEFAULT_STREETVIEW_SEARCH_RADIUS, MAPILLARY_MAX_SEARCH_RADIUS, initConfigStreetView, isStreetViewProviderConfigured } from './configuration/streetviewconfig.js';
18
18
  export { default as GirafeContext } from './context/context.js';
19
19
  export { default as ContextInitializationHelper } from './context/contexthelper.js';
20
20
  export type { default as IGirafeContext } from './context/icontext.js';
@@ -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 OgcApiFeaturesClientGmf } from './ogcapi/ogcapifeaturesclientgmf.js';
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
@@ -12,7 +12,7 @@ export { default as PluginManager } from './auth/pluginmanager.js';
12
12
  export { default as ConfigManager } from './configuration/configmanager.js';
13
13
  export { default as GirafeConfig } from './configuration/girafeconfig.js';
14
14
  export { defaultNewsSanitizeConfig, defaultPermalinkSanitizeConfig, defaultQuerySanitizeConfig } from './configuration/sanitizeconfig-defaults.js';
15
- export { DEFAULT_STREETVIEW_SEARCH_RADIUS, initConfigStreetView, isStreetViewProviderConfigured } from './configuration/streetviewconfig.js';
15
+ export { DEFAULT_STREETVIEW_SEARCH_RADIUS, MAPILLARY_MAX_SEARCH_RADIUS, initConfigStreetView, isStreetViewProviderConfigured } from './configuration/streetviewconfig.js';
16
16
  export { default as GirafeContext } from './context/context.js';
17
17
  export { default as ContextInitializationHelper } from './context/contexthelper.js';
18
18
  export { ContextMenu } from './drawing/contextmenu.js';
@@ -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 OgcApiFeaturesClientGmf } from './ogcapi/ogcapifeaturesclientgmf.js';
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<string>;
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://12345-example.com:8080/mapserv_proxy/api/
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 response = await fetch(`${this.url}/conformance?f=json`, this.getFetchOptions());
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
- fetchOptions.headers = new Headers();
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://12345-example.com:8080/mapserv_proxy/api/
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
- ogcapi_features_simple_write: ("features-p1-core" | "features-p1-geojson" | "features-p2-crs" | "features-p4-create-replace-delete" | "features-p5-schemas")[];
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 ogcapi_features_simple_write = [
31
+ const ogcapi_features_write = [
31
32
  ...ogcapi_features_read,
32
- ...ogcapi_features_crs,
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
- ogcapi_features_simple_write,
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
- ogcapi_features_simple_write: satisfiesConformanceLevel(conformanceList, 'ogcapi_features_simple_write'),
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, { OapifCollection, OapifSchemaResponse } from '../../models/serverogcapifeatures.js';
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 that interacts with a server implementing
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 fetches it from the remote resource,
23
- * sanitizes its links, and stores it locally.
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 schema associated with a specified collection.
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 the related resource for a specified collection and relation type (e.g. `schema`, `self`, `parent`, etc.)
57
+ * Retrieves a resource link of a specified collection, relation type (e.g. `schema`, `self`, `parent`, etc.)
58
+ * and encoding type.
33
59
  */
34
- getCollectionRelation(collectionId: string, relation: string, encodingType?: string): Promise<any>;
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, crsCode?: string, extent?: number[], limit?: number): Promise<Feature<Geometry>[]>;
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
- * Updates an existing item in the specified collection.
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
- updateItem(collectionId: string, itemId: string, item: Feature<Geometry>, crsCode: string): Promise<boolean>;
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
- * Retrieves the CRS (Coordinate Reference System) identifier for a specific collection based on the provided CRS code.
59
- * This is necessary because CRS identifiers can vary slightly (e.g. http vs https) between servers,
60
- * and it's best to use the identifiers provided by the server.
61
- */
62
- private getCrsIdentifier;
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 reprojectExtentToSupportedCrs;
96
+ private itemReprojectionHandler;
69
97
  /**
70
- * Retrieves the storage coordinate reference system (CRS) for a specified collection.
71
- * The storageCrs information is only available if the server supports part 2 of the OGC API Features specification.
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 getStorageCrs;
104
+ private getCrsUriFromEpsgCode;
105
+ private reprojectExtentToDefaultCrs;
74
106
  /**
75
- * When performing a write operation, reproject the feature geometry to match the storage coordinate reference system
76
- * (CRS) of the server. If no storage CRS is specified, geometries are reprojected to WGS84 lon / lat,
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 reprojectItemToStorageCrs;
110
+ private reprojectItem;
80
111
  /**
81
- * Expands the method from OgcApiClient by customizing headers to support GeoJson content and optional CRS identifier.
112
+ * Expands the method from OgcApiClient by customizing headers to support GeoJson content.
82
113
  */
83
- protected getFetchOptions(method?: HttpMethod, crsIdentifier?: string): RequestInit;
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;