@eodash/eodash 5.0.0-alpha.2.16 → 5.0.0-alpha.2.17
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/core/client/composables/EodashMap.js +158 -107
- package/core/client/composables/index.js +13 -2
- package/core/client/eodash.js +6 -0
- package/core/client/plugins/axios.js +8 -0
- package/core/client/store/Actions.js +2 -1
- package/core/client/store/States.js +4 -0
- package/core/client/store/stac.js +11 -8
- package/core/client/utils/createLayers.js +77 -46
- package/core/client/utils/eodashSTAC.js +60 -19
- package/core/client/utils/helpers.js +94 -26
- package/dist/client/{DashboardLayout-CCtyOil0.js → DashboardLayout-BR1lU9ER.js} +2 -2
- package/dist/client/{DynamicWebComponent-But2r1Sj.js → DynamicWebComponent-7z8VFsrZ.js} +2 -2
- package/dist/client/EodashDatePicker-o7ZOYIHL.js +259 -0
- package/dist/client/EodashItemFilter-lNjVkidr.js +7651 -0
- package/dist/client/{EodashLayerControl-BhZL4pYM.js → EodashLayerControl-B0N8_XmX.js} +5162 -5035
- package/dist/client/{EodashMap-C5tOgVOv.js → EodashMap-DFT2R2Rk.js} +3575 -3545
- package/dist/client/{EodashMapBtns-CdDfVQj0.js → EodashMapBtns-CoGjVl8Y.js} +2 -2
- package/dist/client/{ExportState-CKCCN_VI.js → ExportState-Dwv37MRw.js} +133 -126
- package/dist/client/{Footer-B9yVgyzx.js → Footer-DuScuHSx.js} +63 -63
- package/dist/client/{Header-CPIlUEOq.js → Header-C4Y0u0E5.js} +70 -70
- package/dist/client/{IframeWrapper-DRw1kHJm.js → IframeWrapper-D1TfK4xH.js} +1 -1
- package/dist/client/{MobileLayout-CPxVee5U.js → MobileLayout-C-b8DIFO.js} +43 -41
- package/dist/client/{PopUp-Dca-gx9a.js → PopUp-DBMZX3l3.js} +3 -3
- package/dist/client/{VImg-PHLA1nP1.js → VImg-bAMQHnMM.js} +33 -31
- package/dist/client/VMain-Df5VMG9r.js +38 -0
- package/dist/client/VOverlay-D5GzAYRY.js +973 -0
- package/dist/client/{WidgetsContainer-jxk3kw-d.js → WidgetsContainer-yZDmY6_u.js} +1 -1
- package/dist/client/{asWebComponent-3OsFQJVx.js → asWebComponent-DhR2_xlP.js} +9844 -8985
- package/dist/client/eo-dash.js +1 -1
- package/dist/client/{forwardRefs-BxZaq9ml.js → forwardRefs-C0MQxvur.js} +1 -1
- package/dist/client/{index-Vul961Xy.js → index-qNWeBhRh.js} +1 -1
- package/dist/client/{lerc-B4lXefGh-BESXOHWk.js → lerc-B4lXefGh-CsL-d8wY.js} +1 -1
- package/dist/client/{ssrBoot-BFMBrCqY.js → ssrBoot-Xmkz8T49.js} +1 -1
- package/dist/client/style.css +2 -2
- package/dist/client/{transition-U5aFjJtV.js → transition-DRzZPWIN.js} +1 -1
- package/dist/client/{webfontloader-D_JbBwHu.js → webfontloader-CqD-lAx-.js} +1 -1
- package/dist/node/cli.js +1 -1
- package/package.json +26 -23
- package/widgets/EodashDatePicker.vue +100 -88
- package/widgets/EodashMap.vue +20 -30
- package/widgets/ExportState.vue +4 -2
- package/dist/client/EodashDatePicker-jeYiWflv.js +0 -247
- package/dist/client/EodashItemFilter-BFlfWeE_.js +0 -10125
- package/dist/client/VMain-Ck81LJfb.js +0 -39
- package/dist/client/VOverlay-CL4hiJB8.js +0 -972
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EodashCollection } from "@/utils/eodashSTAC";
|
|
2
2
|
import { setMapProjFromCol } from "@/utils/helpers";
|
|
3
3
|
import { onMounted, onUnmounted, watch } from "vue";
|
|
4
|
-
|
|
4
|
+
import log from "loglevel";
|
|
5
5
|
/**
|
|
6
6
|
* Description placeholder
|
|
7
7
|
*
|
|
@@ -38,32 +38,25 @@ export const useHandleMapMoveEnd = (mapElement, mapPosition) => {
|
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
|
+
* Adds data layers extracted from eodash collections to Analysis Group
|
|
41
42
|
*
|
|
42
|
-
* @param {string}
|
|
43
|
-
* @param {
|
|
44
|
-
* @param {string} updatedTime
|
|
45
|
-
* @param {import("stac-ts").StacCatalog
|
|
46
|
-
* | import("stac-ts").StacCollection
|
|
47
|
-
* | import("stac-ts").StacItem
|
|
48
|
-
* | null
|
|
49
|
-
* } selectedIndicator
|
|
43
|
+
* @param { Record<string,any>[] | undefined} layersCollection
|
|
44
|
+
* @param {EodashCollection[]} eodashCols
|
|
45
|
+
* @param {string} [updatedTime]
|
|
50
46
|
*/
|
|
51
|
-
const
|
|
52
|
-
|
|
47
|
+
const updateLayersConfig = async (
|
|
48
|
+
layersCollection,
|
|
53
49
|
eodashCols,
|
|
54
50
|
updatedTime,
|
|
55
|
-
selectedIndicator,
|
|
56
51
|
) => {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
layers: /** @type {Record<string,any>[]}*/ ([]),
|
|
66
|
-
};
|
|
52
|
+
log.debug(
|
|
53
|
+
"Updating layer configuration",
|
|
54
|
+
layersCollection,
|
|
55
|
+
eodashCols,
|
|
56
|
+
updatedTime,
|
|
57
|
+
);
|
|
58
|
+
/** @type {Record<string,any>[]} */
|
|
59
|
+
const analysisLayers = [];
|
|
67
60
|
|
|
68
61
|
for (const ec of eodashCols) {
|
|
69
62
|
let layers;
|
|
@@ -72,26 +65,52 @@ const createLayersConfig = async (
|
|
|
72
65
|
} else {
|
|
73
66
|
layers = await ec.createLayersJson();
|
|
74
67
|
}
|
|
68
|
+
|
|
75
69
|
if (layers) {
|
|
76
|
-
|
|
70
|
+
analysisLayers.push(...layers);
|
|
77
71
|
}
|
|
78
72
|
}
|
|
79
73
|
// Add expand to all analysis layers
|
|
80
|
-
|
|
74
|
+
analysisLayers.forEach((dl) => {
|
|
81
75
|
dl.properties.layerControlExpand = true;
|
|
82
76
|
dl.properties.layerControlToolsExpand = true;
|
|
83
77
|
});
|
|
84
78
|
|
|
85
|
-
layersCollection
|
|
86
|
-
|
|
87
|
-
const indicator = new EodashCollection(indicatorUrl);
|
|
88
|
-
const indicatorLayers = await indicator.buildJsonArray(
|
|
89
|
-
//@ts-expect-error we use this function to generate collection level visualization
|
|
90
|
-
selectedIndicator,
|
|
91
|
-
indicatorUrl,
|
|
92
|
-
selectedIndicator?.title ?? "",
|
|
93
|
-
selectedIndicator?.endpointtype === "GeoDB",
|
|
79
|
+
const dataLayersGroup = layersCollection?.find(
|
|
80
|
+
(lyr) => lyr?.properties.id === "AnalysisGroup",
|
|
94
81
|
);
|
|
82
|
+
if (dataLayersGroup) {
|
|
83
|
+
dataLayersGroup.layers = analysisLayers;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return layersCollection;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @param {import("stac-ts").StacCatalog
|
|
91
|
+
* | import("stac-ts").StacCollection
|
|
92
|
+
* | import("stac-ts").StacItem
|
|
93
|
+
* | null
|
|
94
|
+
* } selectedIndicator
|
|
95
|
+
*/
|
|
96
|
+
|
|
97
|
+
const createLayersConfig = async (selectedIndicator) => {
|
|
98
|
+
log.debug("Creating layers config", selectedIndicator);
|
|
99
|
+
const layersCollection = [];
|
|
100
|
+
const dataLayers = {
|
|
101
|
+
type: "Group",
|
|
102
|
+
properties: {
|
|
103
|
+
id: "AnalysisGroup",
|
|
104
|
+
title: "Analysis Layers",
|
|
105
|
+
layerControlExpand: true,
|
|
106
|
+
},
|
|
107
|
+
layers: /** @type {Record<string,any>[]}*/ ([]),
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
layersCollection.push(dataLayers);
|
|
111
|
+
const indicatorLayers =
|
|
112
|
+
//@ts-expect-error indicator is collection
|
|
113
|
+
await EodashCollection.getIndicatorLayers(selectedIndicator);
|
|
95
114
|
|
|
96
115
|
const baseLayers = {
|
|
97
116
|
type: "Group",
|
|
@@ -105,34 +124,41 @@ const createLayersConfig = async (
|
|
|
105
124
|
const indicatorBaseLayers = indicatorLayers.filter(
|
|
106
125
|
(l) => l.properties.group === "baselayer",
|
|
107
126
|
);
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
counter++;
|
|
119
|
-
lastPos = indx;
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
// if none visible set the last one as visible
|
|
123
|
-
if (counter == 0 && indicatorBaseLayers.length > 0) {
|
|
124
|
-
indicatorBaseLayers[0].properties.visible = true;
|
|
125
|
-
}
|
|
126
|
-
// disable all apart from last
|
|
127
|
-
if (counter > 1) {
|
|
128
|
-
indicatorBaseLayers.forEach((bl, indx) => {
|
|
129
|
-
if (indx !== lastPos) {
|
|
127
|
+
|
|
128
|
+
if (indicatorBaseLayers.length) {
|
|
129
|
+
// Only one baselayer can be set to visible, let's first set all to
|
|
130
|
+
// false that have not a dedicated property visible, then check
|
|
131
|
+
// if there are more then one visible and only allow one
|
|
132
|
+
let counter = 0;
|
|
133
|
+
let lastPos = 0;
|
|
134
|
+
for (let indx = 0; indx < indicatorBaseLayers.length; indx++) {
|
|
135
|
+
const bl = indicatorBaseLayers[indx];
|
|
136
|
+
if (!("visible" in bl.properties)) {
|
|
130
137
|
bl.properties.visible = false;
|
|
131
138
|
}
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
139
|
|
|
135
|
-
|
|
140
|
+
if (bl.properties.visible) {
|
|
141
|
+
counter++;
|
|
142
|
+
lastPos = indx;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// if none visible set the last one as visible
|
|
147
|
+
if (counter === 0) {
|
|
148
|
+
indicatorBaseLayers[0].properties.visible = true;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// disable all apart from last
|
|
152
|
+
if (counter > 0) {
|
|
153
|
+
indicatorBaseLayers.forEach((bl, indx) => {
|
|
154
|
+
if (indx !== lastPos) {
|
|
155
|
+
bl.properties.visible = false;
|
|
156
|
+
} else {
|
|
157
|
+
bl.properties.visible = true;
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
136
162
|
baseLayers.layers.push(...indicatorBaseLayers);
|
|
137
163
|
|
|
138
164
|
// Add exclusive to baselayers and make sure only one is selected
|
|
@@ -170,6 +196,7 @@ const createLayersConfig = async (
|
|
|
170
196
|
const indicatorOverlays = indicatorLayers.filter(
|
|
171
197
|
(l) => l.properties.group === "overlay",
|
|
172
198
|
);
|
|
199
|
+
|
|
173
200
|
if (indicatorOverlays.length) {
|
|
174
201
|
overlayLayers.layers.push(...indicatorOverlays);
|
|
175
202
|
layersCollection.unshift(overlayLayers);
|
|
@@ -184,62 +211,86 @@ const createLayersConfig = async (
|
|
|
184
211
|
* @param {import("vue").Ref<HTMLElement & Record<string,any> | null>} mapElement
|
|
185
212
|
* @param {import("vue").Ref<import("stac-ts").StacCollection | null>} selectedIndicator
|
|
186
213
|
* @param {EodashCollection[]} eodashCols
|
|
187
|
-
* @param {import("vue").Ref<string>} indicatorUrl
|
|
188
214
|
* @param {import("vue").Ref<string>} datetime
|
|
189
215
|
*/
|
|
190
216
|
export const useInitMap = (
|
|
191
217
|
mapElement,
|
|
192
218
|
selectedIndicator,
|
|
193
219
|
eodashCols,
|
|
194
|
-
indicatorUrl,
|
|
195
220
|
datetime,
|
|
196
221
|
) => {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
222
|
+
log.debug(
|
|
223
|
+
"InitMap",
|
|
224
|
+
mapElement.value,
|
|
225
|
+
selectedIndicator.value,
|
|
226
|
+
eodashCols.values,
|
|
227
|
+
datetime.value,
|
|
228
|
+
);
|
|
229
|
+
|
|
230
|
+
const stopIndicatorWatcher = watch(
|
|
231
|
+
selectedIndicator,
|
|
232
|
+
async (updatedStac) => {
|
|
233
|
+
log.debug(
|
|
234
|
+
"SelectedIndicator watch triggered",
|
|
235
|
+
selectedIndicator,
|
|
236
|
+
updatedStac,
|
|
237
|
+
);
|
|
238
|
+
if (updatedStac) {
|
|
239
|
+
const layersCollection = await createLayersConfig(updatedStac);
|
|
240
|
+
|
|
241
|
+
// updates layersCollection in place
|
|
242
|
+
await updateLayersConfig(layersCollection, eodashCols, datetime.value);
|
|
243
|
+
|
|
244
|
+
// Set projection based on indicator level information
|
|
245
|
+
setMapProjFromCol(updatedStac);
|
|
246
|
+
|
|
247
|
+
// Try to move map view to extent
|
|
248
|
+
// Sanitize extent,
|
|
249
|
+
const b = updatedStac.extent?.spatial.bbox[0];
|
|
250
|
+
const sanitizedExtent = [
|
|
251
|
+
b[0] > -180 ? b[0] : -180,
|
|
252
|
+
b[1] > -90 ? b[1] : -90,
|
|
253
|
+
b[2] < 180 ? b[2] : 180,
|
|
254
|
+
b[3] < 90 ? b[3] : 90,
|
|
255
|
+
];
|
|
256
|
+
const reprojExtent = mapElement.value?.transformExtent(
|
|
257
|
+
sanitizedExtent,
|
|
258
|
+
"EPSG:4326",
|
|
259
|
+
mapElement.value?.map?.getView().getProjection(),
|
|
260
|
+
);
|
|
261
|
+
/** @type {any} */
|
|
262
|
+
(mapElement.value).zoomExtent = reprojExtent;
|
|
263
|
+
|
|
264
|
+
// TODO: resetting layers to empty array first because smart layer update has issues
|
|
265
|
+
log.debug(
|
|
266
|
+
"WARN: Map configuration being completely, should be changed once smart update of config is reworked",
|
|
267
|
+
);
|
|
268
|
+
/** @type {any} */
|
|
269
|
+
(mapElement.value).layers = [];
|
|
270
|
+
/** @type {any} */
|
|
271
|
+
(mapElement.value).layers = layersCollection;
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
{ immediate: true },
|
|
275
|
+
);
|
|
276
|
+
|
|
277
|
+
const stopDatetimeWatcher = watch(
|
|
278
|
+
datetime,
|
|
279
|
+
async (updatedTime, previousTime) => {
|
|
280
|
+
if (updatedTime && updatedTime !== previousTime) {
|
|
281
|
+
const layersCollection = await updateLayersConfig(
|
|
282
|
+
[...(mapElement.value?.layers ?? [])],
|
|
283
|
+
eodashCols,
|
|
284
|
+
updatedTime,
|
|
285
|
+
);
|
|
286
|
+
/** @type {any} */
|
|
287
|
+
(mapElement.value).layers = layersCollection?.reverse();
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
);
|
|
291
|
+
|
|
292
|
+
onUnmounted(() => {
|
|
293
|
+
stopIndicatorWatcher();
|
|
294
|
+
stopDatetimeWatcher();
|
|
244
295
|
});
|
|
245
296
|
};
|
|
@@ -12,6 +12,7 @@ import eodash from "@/eodash";
|
|
|
12
12
|
import { useTheme } from "vuetify/lib/framework.mjs";
|
|
13
13
|
import { onMounted, watch } from "vue";
|
|
14
14
|
import { useSTAcStore } from "@/store/stac";
|
|
15
|
+
import log from "loglevel";
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* Creates an absolute URL from a relative link and assignes it to `currentUrl`
|
|
@@ -102,12 +103,12 @@ export const useUpdateTheme = (themeName, themeDefinition = {}) => {
|
|
|
102
103
|
};
|
|
103
104
|
|
|
104
105
|
/** Composable that syncs store and URLSearchParameters */
|
|
105
|
-
|
|
106
106
|
export const useURLSearchParametersSync = () => {
|
|
107
107
|
onMounted(async () => {
|
|
108
108
|
// Analyze currently set url params when first loaded and set them in the store
|
|
109
109
|
if (window.location.search) {
|
|
110
110
|
const searchParams = new URLSearchParams(window.location.search);
|
|
111
|
+
|
|
111
112
|
/** @type {number | undefined} */
|
|
112
113
|
let x,
|
|
113
114
|
/** @type {number | undefined} */
|
|
@@ -117,35 +118,45 @@ export const useURLSearchParametersSync = () => {
|
|
|
117
118
|
for (const [key, value] of searchParams) {
|
|
118
119
|
switch (key) {
|
|
119
120
|
case "indicator": {
|
|
121
|
+
log.debug("Found indicator key in url");
|
|
120
122
|
const { loadSelectedSTAC, stac } = useSTAcStore();
|
|
121
123
|
const match = stac?.find((link) => link.id == value);
|
|
122
124
|
if (match) {
|
|
125
|
+
log.debug("Found match, loading stac item", match);
|
|
123
126
|
await loadSelectedSTAC(match.href);
|
|
124
127
|
}
|
|
125
128
|
break;
|
|
126
129
|
}
|
|
130
|
+
|
|
127
131
|
case "x":
|
|
128
132
|
x = Number(value);
|
|
129
133
|
break;
|
|
134
|
+
|
|
130
135
|
case "y":
|
|
131
136
|
y = Number(value);
|
|
132
137
|
break;
|
|
138
|
+
|
|
133
139
|
case "z":
|
|
134
140
|
z = Number(value);
|
|
135
141
|
break;
|
|
142
|
+
|
|
136
143
|
case "datetime":
|
|
137
144
|
try {
|
|
138
|
-
|
|
145
|
+
const datetimeiso = new Date(value).toISOString();
|
|
146
|
+
log.debug("Valid datetime found", datetimeiso);
|
|
147
|
+
datetime.value = datetimeiso;
|
|
139
148
|
} catch {
|
|
140
149
|
datetime.value = new Date().toISOString();
|
|
141
150
|
}
|
|
142
151
|
break;
|
|
152
|
+
|
|
143
153
|
default:
|
|
144
154
|
break;
|
|
145
155
|
}
|
|
146
156
|
}
|
|
147
157
|
|
|
148
158
|
if (x && y && z) {
|
|
159
|
+
log.debug("Coordinates found, applying map poisition", x, y, z);
|
|
149
160
|
mapPosition.value = [x, y, z];
|
|
150
161
|
}
|
|
151
162
|
}
|
package/core/client/eodash.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { reactive } from "vue";
|
|
2
2
|
import { currentUrl } from "./store/States";
|
|
3
|
+
import log from "loglevel";
|
|
4
|
+
|
|
5
|
+
/* set log level */
|
|
6
|
+
log.setLevel("debug", true);
|
|
3
7
|
|
|
4
8
|
/**
|
|
5
9
|
* Reactive Edoash Instance Object. provided globally in the app, and used as an
|
|
@@ -10,6 +14,8 @@ import { currentUrl } from "./store/States";
|
|
|
10
14
|
export const eodash = reactive({
|
|
11
15
|
id: "demo",
|
|
12
16
|
stacEndpoint: "https://gtif-cerulean.github.io/catalog/cerulean/catalog.json",
|
|
17
|
+
// stacEndpoint: "https://eodashcatalog.eox.at/test-style/trilateral/catalog.json",
|
|
18
|
+
//stacEndpoint: "https://eurodatacube.github.io/eodash-catalog/RACE/catalog.json",
|
|
13
19
|
brand: {
|
|
14
20
|
noLayout: true,
|
|
15
21
|
name: "Demo",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { mapEl, mapCompareEl, registeredProjections } from "@/store/States";
|
|
2
2
|
import { getProjectionCode } from "@/utils/helpers";
|
|
3
|
+
import log from "loglevel";
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Returns the current layers of {@link mapEl}
|
|
@@ -15,7 +16,7 @@ export const registerProjection = async (projection) => {
|
|
|
15
16
|
if (!code || registeredProjections.includes(code)) {
|
|
16
17
|
return;
|
|
17
18
|
}
|
|
18
|
-
|
|
19
|
+
log.debug("Unregistered projection found, registering it", code);
|
|
19
20
|
registeredProjections.push(code);
|
|
20
21
|
if (typeof projection === "object") {
|
|
21
22
|
// registering whole projection definition
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { defineStore } from "pinia";
|
|
2
2
|
import { inject, ref } from "vue";
|
|
3
|
-
import axios from "axios";
|
|
3
|
+
import axios from "@/plugins/axios";
|
|
4
4
|
import { useAbsoluteUrl, useCompareAbsoluteUrl } from "@/composables/index";
|
|
5
5
|
import { eodashKey } from "@/utils/keys";
|
|
6
6
|
import { indicator } from "@/store/States";
|
|
7
7
|
import { extractCollectionUrls } from "@/utils/helpers";
|
|
8
8
|
import { eodashCollections, eodashCompareCollections } from "@/utils/states";
|
|
9
9
|
import { EodashCollection } from "@/utils/eodashSTAC";
|
|
10
|
+
import log from "loglevel";
|
|
10
11
|
|
|
11
12
|
export const useSTAcStore = defineStore("stac", () => {
|
|
12
13
|
/**
|
|
@@ -52,6 +53,7 @@ export const useSTAcStore = defineStore("stac", () => {
|
|
|
52
53
|
* @see {@link stac}
|
|
53
54
|
*/
|
|
54
55
|
async function loadSTAC(url = eodash.stacEndpoint) {
|
|
56
|
+
log.debug("Loading STAC endpoint", url);
|
|
55
57
|
await axios
|
|
56
58
|
.get(url)
|
|
57
59
|
.then((resp) => {
|
|
@@ -63,6 +65,7 @@ export const useSTAcStore = defineStore("stac", () => {
|
|
|
63
65
|
}
|
|
64
66
|
return link;
|
|
65
67
|
});
|
|
68
|
+
log.debug("Setting selected STAC", links);
|
|
66
69
|
stac.value = links;
|
|
67
70
|
})
|
|
68
71
|
.catch((err) => {
|
|
@@ -98,13 +101,13 @@ export const useSTAcStore = defineStore("stac", () => {
|
|
|
98
101
|
}),
|
|
99
102
|
).then((collections) => {
|
|
100
103
|
// empty array from old collections
|
|
101
|
-
eodashCollections.length
|
|
104
|
+
eodashCollections.splice(0, eodashCollections.length);
|
|
102
105
|
// update eodashCollections
|
|
103
106
|
eodashCollections.push(...collections);
|
|
104
|
-
});
|
|
105
107
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
+
selectedStac.value = resp.data;
|
|
109
|
+
indicator.value = selectedStac.value?.id ?? "";
|
|
110
|
+
});
|
|
108
111
|
})
|
|
109
112
|
.catch((err) => {
|
|
110
113
|
throw new Error("error loading the selected STAC", err);
|
|
@@ -139,12 +142,12 @@ export const useSTAcStore = defineStore("stac", () => {
|
|
|
139
142
|
}),
|
|
140
143
|
).then((collections) => {
|
|
141
144
|
// empty array from old collections
|
|
142
|
-
eodashCompareCollections.length
|
|
145
|
+
eodashCompareCollections.splice(0, eodashCompareCollections.length);
|
|
143
146
|
// update eodashCompareCollections
|
|
144
147
|
eodashCompareCollections.push(...collections);
|
|
145
|
-
});
|
|
146
148
|
|
|
147
|
-
|
|
149
|
+
selectedCompareStac.value = resp.data;
|
|
150
|
+
});
|
|
148
151
|
})
|
|
149
152
|
.catch((err) => {
|
|
150
153
|
throw new Error("error loading the selected comparison STAC", err);
|