@eodash/eodash 5.0.0-alpha.2.8 → 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 (138) 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 +149 -47
  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-CKOExc7r.js +0 -156
  104. package/dist/client/DynamicWebComponent-m1Zbbw6n.js +0 -57
  105. package/dist/client/EodashDatePicker-CGdJRGZJ.js +0 -252
  106. package/dist/client/EodashItemFilter-BjM_LHaE.js +0 -63
  107. package/dist/client/EodashMap-61UMC8sv.js +0 -86917
  108. package/dist/client/EodashMapBtns-DVITfAFx.js +0 -36
  109. package/dist/client/ExportState-DhpK09GR.js +0 -558
  110. package/dist/client/Footer-CIwjaddz.js +0 -115
  111. package/dist/client/Header-BcM-pZFi.js +0 -350
  112. package/dist/client/IframeWrapper-CAe6HPqe.js +0 -19
  113. package/dist/client/MobileLayout-DcZOQX8r.js +0 -945
  114. package/dist/client/PopUp-DCaITceG.js +0 -300
  115. package/dist/client/VImg-C-I_7puM.js +0 -291
  116. package/dist/client/VMain-Cd3P0YTG.js +0 -39
  117. package/dist/client/VOverlay-AcvFgk39.js +0 -967
  118. package/dist/client/WidgetsContainer-B0-q0EMO.js +0 -129
  119. package/dist/client/_commonjsHelpers-DaMA6jEr.js +0 -8
  120. package/dist/client/asWebComponent-zuKR9I1w.js +0 -20361
  121. package/dist/client/basedecoder-DHcBySSe-BmCFNFnw.js +0 -88
  122. package/dist/client/decoder-CP4lv0Kb-DdKalImK.js +0 -10
  123. package/dist/client/deflate-BXt-9JA_-CWfClgpK.js +0 -10
  124. package/dist/client/eodashSTAC-DGB50vNk.js +0 -2788
  125. package/dist/client/eox-itemfilter-TaBxgqq_.js +0 -7565
  126. package/dist/client/eox-stacinfo-l7ALSV90.js +0 -13969
  127. package/dist/client/forwardRefs-BnxE4iKQ.js +0 -185
  128. package/dist/client/index-hSIi5Ygk.js +0 -153
  129. package/dist/client/jpeg-BAgeD1d3-oeHbFPUL.js +0 -514
  130. package/dist/client/lerc-DzVumYtB-cTUap6k_.js +0 -1027
  131. package/dist/client/lzw-LAGDNbSC-DkP96qO9.js +0 -84
  132. package/dist/client/packbits-BlDR4Kj5-C66n1-zr.js +0 -24
  133. package/dist/client/pako.esm-CB1uQYY0-DB0PYm1P.js +0 -1081
  134. package/dist/client/raw-CMGvRjfu-BRi6E4i1.js +0 -9
  135. package/dist/client/ssrBoot-D3KF5Thc.js +0 -17
  136. package/dist/client/transition-D3a4tiJv.js +0 -34
  137. package/dist/client/webfontloader-qotgY98I.js +0 -435
  138. package/dist/client/webimage-BM_pbLN3-L2cGWK5l.js +0 -19
package/README.md CHANGED
@@ -4,7 +4,7 @@ A package for creating earth observation dashboards. To learn more about eodash
4
4
 
5
5
  ## Usage
6
6
 
7
- Checkout the [documentation](https://eodash.github.io/eodash/get-started.html) for a detailed guide.
7
+ Checkout the [documentation](https://eodash.github.io/eodash/) for a detailed guide.
8
8
 
9
9
  ## Get Started
10
10
 
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <v-app>
3
3
  <Suspense>
4
- <Dashboard />
4
+ <Dashboard :is-web-component="isWebComponent" :config="config" />
5
5
 
6
6
  <template #fallback>
7
7
  <ErrorAlert v-model="error" />
@@ -15,7 +15,19 @@ import Dashboard from "@/views/Dashboard.vue";
15
15
  import ErrorAlert from "./components/ErrorAlert.vue";
16
16
  import { onErrorCaptured, ref } from "vue";
17
17
 
18
+ defineProps({
19
+ config: {
20
+ type: String,
21
+ required: false,
22
+ default: undefined,
23
+ },
24
+ });
25
+
26
+ // window.setEodashLoglevel("DEBUG")
27
+
18
28
  const error = ref("");
29
+ const isWebComponent = !!document.querySelector("eo-dash");
30
+
19
31
  onErrorCaptured((e, inst, info) => {
20
32
  error.value = `
21
33
  ${e}.
@@ -1,7 +1,17 @@
1
- import SuspensedDashboard from "./SuspensedDashboard.ce.vue";
1
+ import App from "./App.vue";
2
2
  import { defineCustomElement } from "vue";
3
- /** @type {import("./asWebComponent").EodashConstructor} */
4
- export const Eodash = defineCustomElement(SuspensedDashboard);
3
+ import { registerPlugins } from "./plugins";
4
+
5
+ /**
6
+ * @type {import("vue").VueElementConstructor<
7
+ * import("vue").ExtractPropTypes<{ config: string }>>}
8
+ * */
9
+ export const Eodash = defineCustomElement(App, {
10
+ shadowRoot: false,
11
+ configureApp(app) {
12
+ registerPlugins(app);
13
+ },
14
+ });
5
15
 
6
16
  export function register() {
7
17
  customElements.define("eo-dash", Eodash);
@@ -1,9 +1,13 @@
1
1
  <template>
2
2
  <v-main>
3
- <eox-layout :gap="eodash.template.gap ?? 2">
3
+ <eox-layout
4
+ :gap="eodash.template.gap ?? 16"
5
+ :style="`padding: ${eodash.template.gap || 16}px`"
6
+ >
4
7
  <eox-layout-item
5
8
  v-if="bgWidget.component"
6
- class="bg-panel"
9
+ class="bg-panel bg-surface"
10
+ :style="`margin: -${eodash.template.gap ?? 16}px;`"
7
11
  x="0"
8
12
  y="0"
9
13
  h="12"
@@ -55,7 +55,7 @@ export const useEodashRuntime = async (runtimeConfig) => {
55
55
  /**
56
56
  * @param {((
57
57
  * store: import("@/types").EodashStore,
58
- * ) => Promise<import("@/types").Eodash>)
58
+ * ) => (Promise<import("@/types").Eodash> | import("@/types").Eodash))
59
59
  * | import("@/types").Eodash} config
60
60
  */
61
61
  export const createEodash = async (config) => {
@@ -0,0 +1,349 @@
1
+ import { EodashCollection } from "@/utils/eodashSTAC";
2
+ import { setMapProjFromCol } from "@/utils/helpers";
3
+ import { nextTick, onMounted, onUnmounted, watch } from "vue";
4
+ import log from "loglevel";
5
+ import { useSTAcStore } from "@/store/stac";
6
+ import { storeToRefs } from "pinia";
7
+ import { useEventBus } from "@vueuse/core";
8
+ import { eoxLayersKey } from "@/utils/keys";
9
+ /**
10
+ * Holder for previous compare map view as it is overwritten by sync
11
+ * @type { {map:import("ol").View } | null} mapElement
12
+ */
13
+ let viewHolder = null;
14
+
15
+ /**
16
+ * Description placeholder
17
+ *
18
+ * @param {import("vue").Ref<HTMLElement & Record<string,any> & {map:import("ol").Map } | null>} mapElement
19
+ * @param {import("vue").Ref<(number | undefined)[]>} mapPosition
20
+ */
21
+ export const useHandleMapMoveEnd = (mapElement, mapPosition) => {
22
+ /** @type {import("openlayers").EventsListenerFunctionType} */
23
+ const handleMoveEnd = (evt) => {
24
+ const map = /** @type {import("openlayers").Map | undefined} */ (
25
+ /** @type {any} */ (evt).map
26
+ );
27
+ const lonlat = mapElement.value?.lonLatCenter;
28
+ const z = map?.getView().getZoom();
29
+ if (
30
+ lonlat &&
31
+ !Number.isNaN(lonlat[0]) &&
32
+ !Number.isNaN(lonlat[1]) &&
33
+ !Number.isNaN(z)
34
+ ) {
35
+ mapPosition.value = [lonlat[0], lonlat[1], z];
36
+ }
37
+ };
38
+
39
+ onMounted(() => {
40
+ /** @type {import('ol/Map').default} */
41
+ (mapElement.value?.map)?.on("moveend", handleMoveEnd);
42
+ });
43
+
44
+ onUnmounted(() => {
45
+ /** @type {import('ol/Map').default} */
46
+ (mapElement.value?.map)?.un("moveend", handleMoveEnd);
47
+ });
48
+ };
49
+
50
+ /**
51
+ * Creates full layer configuration from indicator and time information
52
+ * @param {import("stac-ts").StacCatalog
53
+ * | import("stac-ts").StacCollection
54
+ * | import("stac-ts").StacItem
55
+ * | null
56
+ * } selectedIndicator
57
+ * @param {EodashCollection[]} eodashCols
58
+ * @param {string} [updatedTime]
59
+ */
60
+
61
+ const createLayersConfig = async (
62
+ selectedIndicator,
63
+ eodashCols,
64
+ updatedTime,
65
+ ) => {
66
+ log.debug(
67
+ "Creating layers config",
68
+ selectedIndicator,
69
+ eodashCols,
70
+ updatedTime,
71
+ );
72
+ const layersCollection = [];
73
+ const dataLayers = {
74
+ type: "Group",
75
+ properties: {
76
+ id: "AnalysisGroup",
77
+ title: "Analysis Layers",
78
+ layerControlExpand: true,
79
+ },
80
+ layers: /** @type {Record<string,any>[]}*/ ([]),
81
+ };
82
+
83
+ for (const ec of eodashCols) {
84
+ let layers;
85
+ if (updatedTime) {
86
+ layers = await ec.createLayersJson(new Date(updatedTime));
87
+ } else {
88
+ layers = await ec.createLayersJson();
89
+ }
90
+ // Add expand to all analysis layers
91
+ layers.forEach((dl) => {
92
+ dl.properties.layerControlExpand = true;
93
+ dl.properties.layerControlToolsExpand = true;
94
+ });
95
+ dataLayers.layers.push(...layers);
96
+ }
97
+
98
+ layersCollection.push(dataLayers);
99
+ const indicatorLayers =
100
+ //@ts-expect-error indicator is collection
101
+ await EodashCollection.getIndicatorLayers(selectedIndicator);
102
+
103
+ const baseLayers = {
104
+ type: "Group",
105
+ properties: {
106
+ id: "BaseLayersGroup",
107
+ title: "Base Layers",
108
+ },
109
+ layers: /** @type {Record<string,any>[]}*/ ([]),
110
+ };
111
+
112
+ const indicatorBaseLayers = indicatorLayers.filter(
113
+ (l) => l.properties.group === "baselayer",
114
+ );
115
+
116
+ if (indicatorBaseLayers.length) {
117
+ // Only one baselayer can be set to visible, let's first set all to
118
+ // false that have not a dedicated property visible, then check
119
+ // if there are more then one visible and only allow one
120
+ let counter = 0;
121
+ let lastPos = 0;
122
+ for (let indx = 0; indx < indicatorBaseLayers.length; indx++) {
123
+ const bl = indicatorBaseLayers[indx];
124
+ if (!("visible" in bl.properties)) {
125
+ bl.properties.visible = false;
126
+ }
127
+
128
+ if (bl.properties.visible) {
129
+ counter++;
130
+ lastPos = indx;
131
+ }
132
+ }
133
+
134
+ // if none visible set the last one as visible
135
+ if (counter === 0) {
136
+ indicatorBaseLayers[0].properties.visible = true;
137
+ }
138
+
139
+ // disable all apart from last
140
+ if (counter > 0) {
141
+ indicatorBaseLayers.forEach((bl, indx) => {
142
+ if (indx !== lastPos) {
143
+ bl.properties.visible = false;
144
+ } else {
145
+ bl.properties.visible = true;
146
+ }
147
+ });
148
+ }
149
+
150
+ baseLayers.layers.push(...indicatorBaseLayers);
151
+
152
+ // Add exclusive to baselayers and make sure only one is selected
153
+ baseLayers.layers.forEach((bl) => {
154
+ bl.properties.layerControlExclusive = true;
155
+ });
156
+ } else {
157
+ // Default to some baselayer
158
+ baseLayers.layers.push({
159
+ type: "Tile",
160
+ properties: {
161
+ id: "osm",
162
+ title: "Background",
163
+ layerControlExclusive: true,
164
+ },
165
+ source: {
166
+ type: "OSM",
167
+ },
168
+ });
169
+ }
170
+
171
+ if (baseLayers.layers.length) {
172
+ layersCollection.push(baseLayers);
173
+ }
174
+
175
+ const overlayLayers = {
176
+ type: "Group",
177
+ properties: {
178
+ id: "OverlayGroup",
179
+ title: "Overlay Layers",
180
+ },
181
+ layers: /** @type {Record<string,any>[]}*/ ([]),
182
+ };
183
+
184
+ const indicatorOverlays = indicatorLayers.filter(
185
+ (l) => l.properties.group === "overlay",
186
+ );
187
+
188
+ if (indicatorOverlays.length) {
189
+ overlayLayers.layers.push(...indicatorOverlays);
190
+ layersCollection.unshift(overlayLayers);
191
+ }
192
+
193
+ return layersCollection;
194
+ };
195
+
196
+ /**
197
+ * Description placeholder
198
+ *
199
+ * @param {import("vue").Ref<HTMLElement & Record<string,any> | null>} mapElement
200
+ * @param {import("vue").Ref<import("stac-ts").StacCollection | null>} selectedIndicator
201
+ * @param {EodashCollection[]} eodashCols
202
+ * @param {import("vue").Ref<string>} datetime
203
+ * @param {import("vue").Ref<Record<string,any>[]>} mapLayers
204
+ * @param {import("vue").Ref<HTMLElement & Record<string,any> | null>} partnerMap
205
+ */
206
+ export const useInitMap = (
207
+ mapElement,
208
+ selectedIndicator,
209
+ eodashCols,
210
+ datetime,
211
+ mapLayers,
212
+ partnerMap,
213
+ ) => {
214
+ log.debug(
215
+ "InitMap",
216
+ mapElement.value,
217
+ selectedIndicator.value,
218
+ eodashCols.values,
219
+ datetime.value,
220
+ );
221
+ const layersEvent = useEventBus(eoxLayersKey);
222
+
223
+ const stopIndicatorWatcher = watch(
224
+ [selectedIndicator, datetime],
225
+ async ([updatedStac, updatedTime], [previousStac, previousTime]) => {
226
+ if (updatedStac) {
227
+ log.debug(
228
+ "Selected Indicator watch triggered",
229
+ updatedStac,
230
+ updatedTime,
231
+ );
232
+
233
+ if (mapElement?.value?.id === "main") {
234
+ // Making sure main map gets the viewer that seems to be
235
+ // removed when the second map is no longer rendered
236
+ if (viewHolder !== null) {
237
+ // Set view to previous compare view
238
+ mapElement?.value?.map.setView(viewHolder);
239
+ viewHolder = null;
240
+ }
241
+ }
242
+ let layersCollection = [];
243
+
244
+ const onlyTimeChanged =
245
+ updatedStac?.id === previousStac?.id && updatedTime !== previousTime;
246
+
247
+ const { selectedCompareStac } = storeToRefs(useSTAcStore());
248
+ if (mapElement?.value?.id === "main") {
249
+ // Main map being initialized
250
+ // Set projection based on indicator level information for both maps
251
+ await setMapProjFromCol(updatedStac);
252
+ } else {
253
+ // Compare map being initialized
254
+ if (selectedCompareStac.value !== null) {
255
+ // save view of compare map
256
+ viewHolder = mapElement?.value?.map.getView();
257
+ /** @type {any} */
258
+ (mapElement.value).sync = partnerMap.value;
259
+ }
260
+ }
261
+
262
+ // We re-crate the configuration if time changed
263
+ if (onlyTimeChanged) {
264
+ layersCollection = await createLayersConfig(
265
+ updatedStac,
266
+ eodashCols,
267
+ updatedTime,
268
+ );
269
+ log.debug(
270
+ "Assigned layers after changing time only",
271
+ JSON.parse(JSON.stringify(layersCollection)),
272
+ );
273
+ mapLayers.value = layersCollection;
274
+ await nextTick(() => {
275
+ layersEvent.emit("time:updated", mapLayers.value);
276
+ });
277
+ return;
278
+ }
279
+
280
+ /** @type {Record<string,any>[]} */
281
+ layersCollection = await createLayersConfig(
282
+ updatedStac,
283
+ eodashCols,
284
+ datetime.value,
285
+ );
286
+
287
+ // We try to set the current time selection to latest extent date
288
+ let endInterval = null;
289
+ const interval = updatedStac?.extent?.temporal?.interval;
290
+ if (interval && interval.length > 0 && interval[0].length > 1) {
291
+ // @ts-expect-error this is the defined STAC structure
292
+ endInterval = new Date(interval[0][1]);
293
+ log.debug(
294
+ "Indicator load: found stac extent, setting time to latest value",
295
+ endInterval,
296
+ );
297
+ }
298
+ if (
299
+ endInterval !== null &&
300
+ endInterval.toISOString() !== datetime.value
301
+ ) {
302
+ datetime.value = endInterval.toISOString();
303
+ }
304
+
305
+ // Try to move map view to extent only when main
306
+ // indicator and map changes
307
+ if (
308
+ mapElement?.value?.id === "main" &&
309
+ updatedStac.extent?.spatial.bbox
310
+ ) {
311
+ // Sanitize extent,
312
+ const b = updatedStac.extent?.spatial.bbox[0];
313
+ const sanitizedExtent = [
314
+ b[0] > -180 ? b[0] : -180,
315
+ b[1] > -90 ? b[1] : -90,
316
+ b[2] < 180 ? b[2] : 180,
317
+ b[3] < 90 ? b[3] : 90,
318
+ ];
319
+
320
+ const reprojExtent = mapElement.value?.transformExtent(
321
+ sanitizedExtent,
322
+ "EPSG:4326",
323
+ mapElement.value?.map?.getView().getProjection(),
324
+ );
325
+ /** @type {any} */
326
+ (mapElement.value).zoomExtent = reprojExtent;
327
+ }
328
+
329
+ log.debug(
330
+ "Assigned layers",
331
+ JSON.parse(JSON.stringify(layersCollection)),
332
+ );
333
+
334
+ mapLayers.value = layersCollection;
335
+ // Emit event to update layers
336
+ await nextTick(() => {
337
+ mapElement.value?.updateComplete.then(() => {
338
+ layersEvent.emit("layers:updated", mapLayers.value);
339
+ });
340
+ });
341
+ }
342
+ },
343
+ { immediate: true },
344
+ );
345
+
346
+ onUnmounted(() => {
347
+ stopIndicatorWatcher();
348
+ });
349
+ };