@eodash/eodash 5.0.0-alpha.2.9 → 5.0.0-processing

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 (137) hide show
  1. package/README.md +1 -1
  2. package/core/client/App.vue +13 -1
  3. package/core/client/asWebComponent.js +13 -3
  4. package/core/client/components/DashboardLayout.vue +6 -2
  5. package/core/client/composables/DefineEodash.js +1 -1
  6. package/core/client/composables/EodashMap.js +349 -0
  7. package/core/client/composables/EodashProcess.js +575 -0
  8. package/core/client/composables/index.js +107 -24
  9. package/core/client/eodash.js +83 -10
  10. package/core/client/plugins/axios.js +8 -0
  11. package/core/client/plugins/index.js +2 -1
  12. package/core/client/store/Actions.js +63 -12
  13. package/core/client/store/States.js +19 -0
  14. package/core/client/store/stac.js +98 -8
  15. package/core/client/types.d.ts +25 -18
  16. package/core/client/utils/createLayers.js +313 -0
  17. package/core/client/utils/eodashSTAC.js +320 -170
  18. package/core/client/utils/helpers.js +369 -9
  19. package/core/client/utils/keys.js +2 -0
  20. package/core/client/utils/states.js +17 -0
  21. package/core/client/views/Dashboard.vue +17 -46
  22. package/core/client/vite-env.d.ts +1 -9
  23. package/dist/client/DashboardLayout-CVMJ4l8M.js +87 -0
  24. package/dist/client/DynamicWebComponent-Cv8n457T.js +88 -0
  25. package/dist/client/EodashDatePicker-VVkiPmpc.js +394 -0
  26. package/dist/client/EodashItemFilter-CugWNQ86.js +194 -0
  27. package/dist/client/EodashLayerControl-53WghA8G.js +110 -0
  28. package/dist/client/EodashMap-CQnOePpy.js +486 -0
  29. package/dist/client/EodashMapBtns-uaRwFtfB.js +66 -0
  30. package/dist/client/EodashProcess-cF0unIy8.js +1477 -0
  31. package/dist/client/ExportState-BT8MLAW7.js +644 -0
  32. package/dist/client/Footer-C6GUG84G.js +141 -0
  33. package/dist/client/Header-D2dtCWp8.js +437 -0
  34. package/dist/client/IframeWrapper-BgM9aU8f.js +28 -0
  35. package/dist/client/MobileLayout-BAo8Wr8T.js +1210 -0
  36. package/dist/client/PopUp-Bm01q7Ko.js +389 -0
  37. package/dist/client/VImg-B8AbetCE.js +384 -0
  38. package/dist/client/VMain-DnGlQUyr.js +43 -0
  39. package/dist/client/VOverlay-B8Qj7LRG.js +1453 -0
  40. package/dist/client/WidgetsContainer-CwXRRLS1.js +83 -0
  41. package/dist/client/asWebComponent-DUUoR7MZ.js +11621 -0
  42. package/dist/client/eo-dash.js +2 -6
  43. package/dist/client/forwardRefs-CZJhEAKW.js +245 -0
  44. package/dist/client/index-DlIO7sJ3.js +199 -0
  45. package/dist/client/ssrBoot-BP7SYRyC.js +22 -0
  46. package/dist/client/style.css +2 -2
  47. package/dist/client/transition-BiR8wMn1.js +37 -0
  48. package/dist/node/cli.js +4 -4
  49. package/dist/node/types.d.ts +2 -0
  50. package/dist/types/core/client/App.vue.d.ts +7 -0
  51. package/dist/types/core/client/asWebComponent.d.ts +9 -0
  52. package/dist/types/core/client/components/DashboardLayout.vue.d.ts +2 -0
  53. package/dist/types/core/client/components/DynamicWebComponent.vue.d.ts +18 -0
  54. package/dist/types/core/client/components/ErrorAlert.vue.d.ts +2 -0
  55. package/dist/types/core/client/components/Footer.vue.d.ts +2 -0
  56. package/dist/types/core/client/components/Header.vue.d.ts +2 -0
  57. package/dist/types/core/client/components/IframeWrapper.vue.d.ts +7 -0
  58. package/dist/types/core/client/components/Loading.vue.d.ts +2 -0
  59. package/dist/types/core/client/components/MobileLayout.vue.d.ts +2 -0
  60. package/dist/types/core/client/composables/DefineEodash.d.ts +2 -0
  61. package/dist/types/core/client/composables/DefineTemplate.d.ts +15 -0
  62. package/dist/types/core/client/composables/DefineWidgets.d.ts +14 -0
  63. package/dist/types/core/client/composables/EodashMap.d.ts +5 -0
  64. package/dist/types/core/client/composables/index.d.ts +30 -0
  65. package/dist/types/core/client/eodash.d.ts +8 -0
  66. package/dist/types/core/client/main.d.ts +2 -0
  67. package/dist/types/core/client/plugins/axios.d.ts +2 -0
  68. package/dist/types/core/client/plugins/index.d.ts +3 -0
  69. package/dist/types/core/client/plugins/vuetify.d.ts +82 -0
  70. package/dist/types/core/client/render.d.ts +1 -0
  71. package/dist/types/core/client/store/Actions.d.ts +12 -0
  72. package/dist/types/core/client/store/States.d.ts +22 -0
  73. package/dist/types/core/client/store/index.d.ts +2 -0
  74. package/dist/types/core/client/store/stac.d.ts +25 -0
  75. package/dist/types/core/client/types.d.ts +279 -0
  76. package/dist/types/core/client/utils/createLayers.d.ts +45 -0
  77. package/dist/types/core/client/utils/eodashSTAC.d.ts +82 -0
  78. package/dist/types/core/client/utils/helpers.d.ts +84 -0
  79. package/dist/types/core/client/utils/index.d.ts +2 -0
  80. package/dist/types/core/client/utils/keys.d.ts +6 -0
  81. package/dist/types/core/client/utils/states.d.ts +14 -0
  82. package/dist/types/core/client/views/Dashboard.vue.d.ts +9 -0
  83. package/dist/types/widgets/EodashDatePicker.vue.d.ts +7 -0
  84. package/dist/types/widgets/EodashItemFilter.vue.d.ts +42 -0
  85. package/dist/types/widgets/EodashLayerControl.vue.d.ts +11 -0
  86. package/dist/types/widgets/EodashLayoutSwitcher.vue.d.ts +9 -0
  87. package/dist/types/widgets/EodashMap.vue.d.ts +7 -0
  88. package/dist/types/widgets/EodashMapBtns.vue.d.ts +11 -0
  89. package/dist/types/widgets/EodashStacInfo.vue.d.ts +21 -0
  90. package/dist/types/widgets/EodashTools.vue.d.ts +15 -0
  91. package/dist/types/widgets/ExportState.vue.d.ts +7 -0
  92. package/dist/types/widgets/PopUp.vue.d.ts +22 -0
  93. package/dist/types/widgets/WidgetsContainer.vue.d.ts +7 -0
  94. package/package.json +58 -37
  95. package/widgets/EodashDatePicker.vue +128 -100
  96. package/widgets/EodashItemFilter.vue +100 -14
  97. package/widgets/EodashLayerControl.vue +98 -0
  98. package/widgets/EodashMap.vue +98 -122
  99. package/widgets/EodashMapBtns.vue +24 -7
  100. package/widgets/EodashProcess.vue +151 -0
  101. package/widgets/ExportState.vue +15 -11
  102. package/core/client/SuspensedDashboard.ce.vue +0 -105
  103. package/dist/client/DashboardLayout-D0ZF6V2S.js +0 -156
  104. package/dist/client/DynamicWebComponent-CPsMSBHi.js +0 -57
  105. package/dist/client/EodashDatePicker-CBQP7u2X.js +0 -252
  106. package/dist/client/EodashItemFilter-DL2ScI-5.js +0 -7671
  107. package/dist/client/EodashMap-CkKoQlmR.js +0 -86917
  108. package/dist/client/EodashMapBtns-yuO2QmiR.js +0 -36
  109. package/dist/client/ExportState-CCzOhppU.js +0 -558
  110. package/dist/client/Footer-BPAND0yG.js +0 -115
  111. package/dist/client/Header-DLhebNvG.js +0 -350
  112. package/dist/client/IframeWrapper-1GEMHlsW.js +0 -19
  113. package/dist/client/MobileLayout-mGkOYRhu.js +0 -945
  114. package/dist/client/PopUp-1d2bBFjw.js +0 -300
  115. package/dist/client/VImg-DxHcztfM.js +0 -291
  116. package/dist/client/VMain-BLX5vRRn.js +0 -39
  117. package/dist/client/VOverlay-CvrYEmLu.js +0 -967
  118. package/dist/client/WidgetsContainer-CmYjvGm7.js +0 -129
  119. package/dist/client/_commonjsHelpers-DaMA6jEr.js +0 -8
  120. package/dist/client/asWebComponent-B91uK0U7.js +0 -20361
  121. package/dist/client/basedecoder-DHcBySSe-BmCFNFnw.js +0 -88
  122. package/dist/client/decoder-CP4lv0Kb-B6yqkcfC.js +0 -10
  123. package/dist/client/deflate-BXt-9JA_-CWfClgpK.js +0 -10
  124. package/dist/client/eodashSTAC-DBjqe_Ho.js +0 -2788
  125. package/dist/client/eox-stacinfo-l7ALSV90.js +0 -13969
  126. package/dist/client/forwardRefs-BJJiadQP.js +0 -185
  127. package/dist/client/index-Q-bHLjxx.js +0 -153
  128. package/dist/client/jpeg-BAgeD1d3-oeHbFPUL.js +0 -514
  129. package/dist/client/lerc-DzVumYtB-P-KXC0TO.js +0 -1027
  130. package/dist/client/lzw-LAGDNbSC-DkP96qO9.js +0 -84
  131. package/dist/client/packbits-BlDR4Kj5-C66n1-zr.js +0 -24
  132. package/dist/client/pako.esm-CB1uQYY0-DB0PYm1P.js +0 -1081
  133. package/dist/client/raw-CMGvRjfu-BRi6E4i1.js +0 -9
  134. package/dist/client/ssrBoot-yo11mybw.js +0 -17
  135. package/dist/client/transition-CSJhuYGK.js +0 -34
  136. package/dist/client/webfontloader-qotgY98I.js +0 -435
  137. package/dist/client/webimage-BM_pbLN3-L2cGWK5l.js +0 -19
@@ -32,7 +32,7 @@ export interface WebComponentProps<T extends ExecutionTime = "compiletime"> {
32
32
  */
33
33
  onMounted?: (
34
34
  el: Element | null,
35
- store: ReturnType<typeof import("./store/stac").useSTAcStore>,
35
+ store: ReturnType<typeof import("./store/stac.js").useSTAcStore>,
36
36
  ) => Promise<void> | void;
37
37
  /**
38
38
  * Triggered when the web component is unmounted from the DOM.
@@ -43,7 +43,7 @@ export interface WebComponentProps<T extends ExecutionTime = "compiletime"> {
43
43
  */
44
44
  onUnmounted?: (
45
45
  el: Element | null,
46
- store: ReturnType<typeof import("./store/stac").useSTAcStore>,
46
+ store: ReturnType<typeof import("./store/stac.js").useSTAcStore>,
47
47
  ) => Promise<void> | void;
48
48
  }
49
49
 
@@ -244,29 +244,36 @@ export interface EodashStore {
244
244
  datetime: import("vue").Ref<string>;
245
245
  /** Currently selected indicator */
246
246
  indicator: import("vue").Ref<string>;
247
+
248
+ registeredProjections: `EPSG${number}`[];
249
+
250
+ /** available projection to be rendered by the Map */
251
+ availableMapProjection: import("vue").Ref<string>;
247
252
  };
248
253
  actions: {
249
- /** returns the layers of the `eox-map`
250
- * @param `eox-map` element selector
254
+ /**
255
+ * returns the layers of the `eox-map`
256
+ * @param [el] - `eox-map` element selector
251
257
  */
252
- getLayers: (el: string) => object[];
258
+ getLayers: (el?: string) => object[];
259
+
260
+ /**
261
+ * Register EPSG projection in `eox-map` and adds it to `availableMapProjection`
262
+ * */
263
+ registerProjection: (
264
+ code?: number | string | { name: string; def: string },
265
+ ) => Promise<void>;
266
+
267
+ /** Change `eox-map` projection from an `EPSG` code */
268
+ changeMapProjection: (
269
+ code?: number | string | { name: string; def: string },
270
+ ) => Promise<void>;
253
271
  };
272
+
254
273
  /** Pinia store definition used to navigate the root STAC catalog. */
255
274
  stac: {
256
275
  useSTAcStore: typeof import("./store/stac.js").useSTAcStore;
257
276
  };
258
277
  }
259
278
  ///////
260
- /**
261
- * The project's entry point should export this function as a default to
262
- * instantiate eodash
263
- *
264
- * @param config
265
- * @group Eodash
266
- */
267
- export declare const createEodash: (
268
- config: ((store: EodashStore) => Eodash | Promise<Eodash>) | Eodash,
269
- ) => Eodash | Promise<Eodash>;
270
-
271
- /** @group EodashStore */
272
- export declare const store: EodashStore;
279
+ export { createEodash, store } from "./main.js";
@@ -0,0 +1,313 @@
1
+ import { registerProjection } from "@/store/Actions";
2
+ import { mapEl } from "@/store/States";
3
+ import {
4
+ extractRoles,
5
+ getProjectionCode,
6
+ createLayerID,
7
+ createAssetID,
8
+ } from "./helpers";
9
+ import log from "loglevel";
10
+
11
+ /**
12
+ * @param {string} collectionId
13
+ * @param {string} title
14
+ * @param {Record<string,import("stac-ts").StacAsset>} assets
15
+ * @param {import("stac-ts").StacItem } item
16
+ * @param {import("ol/layer/WebGLTile").Style} [style]
17
+ * @param {Record<string, unknown>} [layerConfig]
18
+ * @param {Record<string, unknown>} [layerDatetime]
19
+ * @param {object | null} [extraProperties]
20
+ **/
21
+ export async function createLayersFromAssets(
22
+ collectionId,
23
+ title,
24
+ assets,
25
+ item,
26
+ style,
27
+ layerConfig,
28
+ layerDatetime,
29
+ extraProperties,
30
+ ) {
31
+ log.debug("Creating layers from assets");
32
+ let jsonArray = [];
33
+ let geoTIFFSources = [];
34
+ /** @type {number|null} */
35
+ let geoTIFFIdx = null;
36
+
37
+ for (const [idx, ast] of Object.keys(assets).entries()) {
38
+ // register projection if exists
39
+ const assetProjection =
40
+ /** @type {string | number | {name: string, def: string, extent?:number[]} | undefined} */ (
41
+ assets[ast]?.["proj:epsg"] || assets[ast]?.["eodash:proj4_def"]
42
+ );
43
+ await registerProjection(assetProjection);
44
+
45
+ if (assets[ast]?.type === "application/geo+json") {
46
+ const assetId = createAssetID(collectionId, item.id, idx);
47
+ log.debug("Creating Vector layer from GeoJSON", assetId);
48
+ const layer = {
49
+ type: "Vector",
50
+ source: {
51
+ type: "Vector",
52
+ url: assets[ast].href,
53
+ format: "GeoJSON",
54
+ },
55
+ properties: {
56
+ id: assetId,
57
+ title,
58
+ layerDatetime,
59
+ ...(layerConfig && {
60
+ layerConfig: {
61
+ ...layerConfig,
62
+ style,
63
+ },
64
+ }),
65
+ },
66
+ ...(!style?.variables && { style }),
67
+ };
68
+ extractRoles(layer.properties, assets[ast]);
69
+ if (extraProperties !== null) {
70
+ layer.properties = { ...layer.properties, ...extraProperties };
71
+ }
72
+ jsonArray.push(layer);
73
+ } else if (assets[ast]?.type === "image/tiff") {
74
+ geoTIFFIdx = idx;
75
+ geoTIFFSources.push({ url: assets[ast].href });
76
+ }
77
+ }
78
+
79
+ if (geoTIFFSources.length && typeof geoTIFFIdx === "number") {
80
+ const geotiffSourceID = collectionId + ";:;GeoTIFF";
81
+ log.debug("Creating WebGLTile layer from GeoTIFF", geotiffSourceID);
82
+ log.debug("Configured Sources", geoTIFFSources);
83
+ const layer = {
84
+ type: "WebGLTile",
85
+ source: {
86
+ type: "GeoTIFF",
87
+ normalize: !style,
88
+ interpolate: false,
89
+ sources: geoTIFFSources,
90
+ },
91
+ properties: {
92
+ id: createAssetID(collectionId, item.id, geoTIFFIdx),
93
+ title,
94
+ layerConfig,
95
+ layerDatetime,
96
+ },
97
+ style,
98
+ };
99
+ if (extraProperties !== null) {
100
+ layer.properties = { ...layer.properties, ...extraProperties };
101
+ }
102
+ jsonArray.push(layer);
103
+ }
104
+
105
+ return jsonArray;
106
+ }
107
+
108
+ /**
109
+ * @param {string} collectionId
110
+ * @param {import('stac-ts').StacItem} item
111
+ * @param {string} title
112
+ * @param {Record<string,any>} [layerDatetime]
113
+ * @param {object | null} [extraProperties]
114
+ */
115
+ export const createLayersFromLinks = async (
116
+ collectionId,
117
+ title,
118
+ item,
119
+ layerDatetime,
120
+ extraProperties,
121
+ ) => {
122
+ log.debug("Creating layers from links");
123
+ /** @type {Record<string,any>[]} */
124
+ const jsonArray = [];
125
+ const wmsArray = item.links.filter((l) => l.rel === "wms");
126
+ const wmtsArray = item.links.filter((l) => l.rel === "wmts");
127
+ const xyzArray = item.links.filter((l) => l.rel === "xyz") ?? [];
128
+
129
+ // Taking projection code from main map view, as main view defines
130
+ // projection for comparison map
131
+ const viewProjectionCode = mapEl?.value?.projection || "EPSG:3857";
132
+
133
+ for (const wmsLink of wmsArray ?? []) {
134
+ // Registering setting sub wms link projection
135
+
136
+ const wmsLinkProjection =
137
+ /** @type {number | string | {name: string, def: string} | undefined} */
138
+ (wmsLink?.["proj:epsg"] || wmsLink?.["eodash:proj4_def"]);
139
+
140
+ await registerProjection(wmsLinkProjection);
141
+
142
+ const linkProjectionCode =
143
+ getProjectionCode(wmsLinkProjection) || "EPSG:4326";
144
+ // Projection code need to be based on map view projection to make sure
145
+ // tiles are reloaded when changing projection
146
+ const linkId = createLayerID(
147
+ collectionId,
148
+ item.id,
149
+ wmsLink,
150
+ viewProjectionCode,
151
+ );
152
+ log.debug("WMS Layer added", linkId);
153
+ const tileSize =
154
+ "wms:tilesize" in wmsLink
155
+ ? [wmsLink["wms:tilesize"], wmsLink["wms:tilesize"]]
156
+ : [512, 512];
157
+ let json = {
158
+ type: "Tile",
159
+ properties: {
160
+ id: linkId,
161
+ title: wmsLink.title || title || item.id,
162
+ layerDatetime,
163
+ },
164
+ source: {
165
+ type: "TileWMS",
166
+ url: wmsLink.href,
167
+ projection: linkProjectionCode,
168
+ tileGrid: {
169
+ tileSize,
170
+ },
171
+ params: {
172
+ LAYERS: wmsLink["wms:layers"],
173
+ TILED: true,
174
+ },
175
+ },
176
+ };
177
+ if ("wms:version" in wmsLink) {
178
+ // @ts-expect-error no type for eox-map
179
+ json.source.params["VERSION"] = wmsLink["wms:version"];
180
+ }
181
+ extractRoles(json.properties, wmsLink);
182
+ if ("wms:dimensions" in wmsLink) {
183
+ // Expand all dimensions into the params attribute
184
+ Object.assign(json.source.params, wmsLink["wms:dimensions"]);
185
+ }
186
+ if (extraProperties !== null) {
187
+ json.properties = { ...json.properties, ...extraProperties };
188
+ }
189
+ jsonArray.push(json);
190
+ }
191
+
192
+ for (const wmtsLink of wmtsArray ?? []) {
193
+ // Registering setting sub wmts link projection
194
+
195
+ const wmtsLinkProjection =
196
+ /** @type {number | string | {name: string, def: string} | undefined} */
197
+ (wmtsLink?.["proj:epsg"] || wmtsLink?.["eodash:proj4_def"]);
198
+
199
+ await registerProjection(wmtsLinkProjection);
200
+ const projectionCode = getProjectionCode(wmtsLinkProjection || "EPSG:3857");
201
+ // TODO: WARNING! This is a temporary project specific implementation
202
+ // that needs to be removed once catalog and wmts creation from capabilities
203
+ // combined with custom view projections is solved
204
+ let json;
205
+ const linkId = createLayerID(
206
+ collectionId,
207
+ item.id,
208
+ wmtsLink,
209
+ viewProjectionCode,
210
+ );
211
+ const dimensions = /** @type { {style:any} & Record<string,any> } */ (
212
+ wmtsLink["wmts:dimensions"] || {}
213
+ );
214
+ let { style, ...dimensionsWithoutStyle } = { ...dimensions };
215
+ let extractedStyle = /** @type { string } */ (style || "default");
216
+
217
+ if (wmtsLink.title === "wmts capabilities") {
218
+ log.debug(
219
+ "Warning: WMTS Layer from capabilities added, function needs to be updated",
220
+ linkId,
221
+ );
222
+ json = {
223
+ type: "Tile",
224
+ properties: {
225
+ id: linkId,
226
+ title: title || item.id,
227
+ layerDatetime,
228
+ },
229
+ source: {
230
+ type: "WMTS",
231
+ // TODO: Hard coding url as the current one set is for capabilities
232
+ url: "https://wmts.marine.copernicus.eu/teroWmts",
233
+ layer: wmtsLink["wmts:layer"],
234
+ style: extractedStyle,
235
+ // TODO: Hard coding matrixSet until we find solution to wmts creation from capabilities
236
+ matrixSet: "EPSG:3857",
237
+ projection: projectionCode,
238
+ tileGrid: {
239
+ tileSize: [128, 128],
240
+ },
241
+ dimensions: dimensionsWithoutStyle,
242
+ },
243
+ };
244
+ } else {
245
+ log.debug(
246
+ "Warning: WMTS Layer from capabilities added, function needs to be updated",
247
+ linkId,
248
+ );
249
+ json = {
250
+ type: "Tile",
251
+ properties: {
252
+ id: linkId,
253
+ title: wmtsLink.title || title || item.id,
254
+ layerDatetime,
255
+ },
256
+ source: {
257
+ type: "WMTS",
258
+ url: wmtsLink.href,
259
+ layer: wmtsLink["wmts:layer"],
260
+ style: extractedStyle,
261
+ matrixSet: wmtsLink.matrixSet || "EPSG:3857",
262
+ projection: projectionCode,
263
+ tileGrid: {
264
+ tileSize: [512, 512],
265
+ },
266
+ dimensions: dimensionsWithoutStyle,
267
+ },
268
+ };
269
+ }
270
+ extractRoles(json.properties, wmtsLink);
271
+ if (extraProperties !== null) {
272
+ json.properties = { ...json.properties, ...extraProperties };
273
+ }
274
+ jsonArray.push(json);
275
+ }
276
+
277
+ for (const xyzLink of xyzArray ?? []) {
278
+ const xyzLinkProjection =
279
+ /** @type {number | string | {name: string, def: string} | undefined} */
280
+ (xyzLink?.["proj:epsg"] || xyzLink?.["eodash:proj4_def"]);
281
+
282
+ await registerProjection(xyzLinkProjection);
283
+ const projectionCode = getProjectionCode(xyzLinkProjection || "EPSG:3857");
284
+ const linkId = createLayerID(
285
+ collectionId,
286
+ item.id,
287
+ xyzLink,
288
+ viewProjectionCode,
289
+ );
290
+ log.debug("XYZ Layer added", linkId);
291
+ let json = {
292
+ type: "Tile",
293
+ properties: {
294
+ id: linkId,
295
+ title: xyzLink.title || title || item.id,
296
+ roles: xyzLink.roles,
297
+ layerDatetime,
298
+ },
299
+ source: {
300
+ type: "XYZ",
301
+ url: xyzLink.href,
302
+ projection: projectionCode,
303
+ },
304
+ };
305
+
306
+ extractRoles(json.properties, xyzLink);
307
+ if (extraProperties !== null) {
308
+ json.properties = { ...json.properties, ...extraProperties };
309
+ }
310
+ jsonArray.push(json);
311
+ }
312
+ return jsonArray;
313
+ };