@eodash/eodash 5.0.0-alpha.2.17 → 5.0.0-alpha.2.19
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/App.vue +2 -0
- package/core/client/composables/EodashMap.js +139 -100
- package/core/client/eodash.js +32 -12
- package/core/client/plugins/index.js +2 -1
- package/core/client/store/Actions.js +6 -0
- package/core/client/utils/createLayers.js +32 -11
- package/core/client/utils/eodashSTAC.js +22 -5
- package/core/client/utils/helpers.js +19 -14
- package/core/client/vite-env.d.ts +1 -0
- package/dist/client/{DashboardLayout-BR1lU9ER.js → DashboardLayout-CU4js3lr.js} +2 -2
- package/dist/client/{DynamicWebComponent-7z8VFsrZ.js → DynamicWebComponent-BsYZdIEB.js} +2 -2
- package/dist/client/EodashDatePicker-DZoH_gRX.js +276 -0
- package/dist/client/{EodashItemFilter-lNjVkidr.js → EodashItemFilter-CHBfsFSm.js} +1362 -1347
- package/dist/client/{EodashLayerControl-B0N8_XmX.js → EodashLayerControl-CuY-cAx8.js} +4773 -4593
- package/dist/client/{EodashMap-DFT2R2Rk.js → EodashMap-Ch43fWNv.js} +21032 -20669
- package/dist/client/{EodashMapBtns-CoGjVl8Y.js → EodashMapBtns-CFA2uti4.js} +2 -2
- package/dist/client/{ExportState-Dwv37MRw.js → ExportState-C6raDjTt.js} +68 -69
- package/dist/client/{Footer-DuScuHSx.js → Footer-D8T5ROhF.js} +1 -1
- package/dist/client/{Header-C4Y0u0E5.js → Header-B8B4Z5R9.js} +4 -4
- package/dist/client/{IframeWrapper-D1TfK4xH.js → IframeWrapper-BK2JxzSJ.js} +1 -1
- package/dist/client/{MobileLayout-C-b8DIFO.js → MobileLayout-aZaYvF8V.js} +51 -51
- package/dist/client/{PopUp-DBMZX3l3.js → PopUp-DdHXoNOP.js} +42 -42
- package/dist/client/{VImg-bAMQHnMM.js → VImg-yb8O1cb8.js} +2 -2
- package/dist/client/{VMain-Df5VMG9r.js → VMain-Dknnyxts.js} +2 -2
- package/dist/client/{VOverlay-D5GzAYRY.js → VOverlay-BCOn3hd6.js} +64 -64
- package/dist/client/{WidgetsContainer-yZDmY6_u.js → WidgetsContainer-BixUyr1e.js} +3 -3
- package/dist/client/{asWebComponent-DhR2_xlP.js → asWebComponent-CHqY8A1z.js} +7231 -7087
- package/dist/client/eo-dash.js +1 -1
- package/dist/client/{forwardRefs-C0MQxvur.js → forwardRefs-dcYA2XVU.js} +1 -1
- package/dist/client/{index-qNWeBhRh.js → index-BVuSHaVu.js} +23 -23
- package/dist/client/{lerc-B4lXefGh-CsL-d8wY.js → lerc-BPVtQnt3-08GHszVp.js} +1 -1
- package/dist/client/{ssrBoot-Xmkz8T49.js → ssrBoot-DU2S_nLc.js} +1 -1
- package/dist/client/style.css +1 -1
- package/dist/client/{transition-DRzZPWIN.js → transition-C_fi1aa6.js} +1 -1
- package/dist/client/{webfontloader-CqD-lAx-.js → webfontloader-Ofarvipf.js} +1 -1
- package/package.json +6 -7
- package/widgets/EodashDatePicker.vue +24 -12
- package/widgets/EodashLayerControl.vue +23 -4
- package/widgets/EodashMap.vue +43 -25
- package/dist/client/EodashDatePicker-o7ZOYIHL.js +0 -259
package/core/client/App.vue
CHANGED
|
@@ -15,6 +15,8 @@ import Dashboard from "@/views/Dashboard.vue";
|
|
|
15
15
|
import ErrorAlert from "./components/ErrorAlert.vue";
|
|
16
16
|
import { onErrorCaptured, ref } from "vue";
|
|
17
17
|
|
|
18
|
+
// window.setEodashLoglevel("DEBUG")
|
|
19
|
+
|
|
18
20
|
const error = ref("");
|
|
19
21
|
onErrorCaptured((e, inst, info) => {
|
|
20
22
|
error.value = `
|
|
@@ -2,6 +2,15 @@ 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
|
+
import { useSTAcStore } from "@/store/stac";
|
|
6
|
+
import { storeToRefs } from "pinia";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Holder for previous compare map view as it is overwritten by sync
|
|
10
|
+
* @type { {map:import("ol").View } | null} mapElement
|
|
11
|
+
*/
|
|
12
|
+
let viewHolder = null;
|
|
13
|
+
|
|
5
14
|
/**
|
|
6
15
|
* Description placeholder
|
|
7
16
|
*
|
|
@@ -38,64 +47,27 @@ export const useHandleMapMoveEnd = (mapElement, mapPosition) => {
|
|
|
38
47
|
};
|
|
39
48
|
|
|
40
49
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
50
|
+
* Creates full layer configuration from indicator and time information
|
|
51
|
+
* @param {import("stac-ts").StacCatalog
|
|
52
|
+
* | import("stac-ts").StacCollection
|
|
53
|
+
* | import("stac-ts").StacItem
|
|
54
|
+
* | null
|
|
55
|
+
* } selectedIndicator
|
|
44
56
|
* @param {EodashCollection[]} eodashCols
|
|
45
57
|
* @param {string} [updatedTime]
|
|
46
58
|
*/
|
|
47
|
-
|
|
48
|
-
|
|
59
|
+
|
|
60
|
+
const createLayersConfig = async (
|
|
61
|
+
selectedIndicator,
|
|
49
62
|
eodashCols,
|
|
50
63
|
updatedTime,
|
|
51
64
|
) => {
|
|
52
65
|
log.debug(
|
|
53
|
-
"
|
|
54
|
-
|
|
66
|
+
"Creating layers config",
|
|
67
|
+
selectedIndicator,
|
|
55
68
|
eodashCols,
|
|
56
69
|
updatedTime,
|
|
57
70
|
);
|
|
58
|
-
/** @type {Record<string,any>[]} */
|
|
59
|
-
const analysisLayers = [];
|
|
60
|
-
|
|
61
|
-
for (const ec of eodashCols) {
|
|
62
|
-
let layers;
|
|
63
|
-
if (updatedTime) {
|
|
64
|
-
layers = await ec.createLayersJson(new Date(updatedTime));
|
|
65
|
-
} else {
|
|
66
|
-
layers = await ec.createLayersJson();
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (layers) {
|
|
70
|
-
analysisLayers.push(...layers);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
// Add expand to all analysis layers
|
|
74
|
-
analysisLayers.forEach((dl) => {
|
|
75
|
-
dl.properties.layerControlExpand = true;
|
|
76
|
-
dl.properties.layerControlToolsExpand = true;
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
const dataLayersGroup = layersCollection?.find(
|
|
80
|
-
(lyr) => lyr?.properties.id === "AnalysisGroup",
|
|
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
71
|
const layersCollection = [];
|
|
100
72
|
const dataLayers = {
|
|
101
73
|
type: "Group",
|
|
@@ -107,6 +79,21 @@ const createLayersConfig = async (selectedIndicator) => {
|
|
|
107
79
|
layers: /** @type {Record<string,any>[]}*/ ([]),
|
|
108
80
|
};
|
|
109
81
|
|
|
82
|
+
for (const ec of eodashCols) {
|
|
83
|
+
let layers;
|
|
84
|
+
if (updatedTime) {
|
|
85
|
+
layers = await ec.createLayersJson(new Date(updatedTime));
|
|
86
|
+
} else {
|
|
87
|
+
layers = await ec.createLayersJson();
|
|
88
|
+
}
|
|
89
|
+
// Add expand to all analysis layers
|
|
90
|
+
layers.forEach((dl) => {
|
|
91
|
+
dl.properties.layerControlExpand = true;
|
|
92
|
+
dl.properties.layerControlToolsExpand = true;
|
|
93
|
+
});
|
|
94
|
+
dataLayers.layers.push(...layers);
|
|
95
|
+
}
|
|
96
|
+
|
|
110
97
|
layersCollection.push(dataLayers);
|
|
111
98
|
const indicatorLayers =
|
|
112
99
|
//@ts-expect-error indicator is collection
|
|
@@ -212,12 +199,16 @@ const createLayersConfig = async (selectedIndicator) => {
|
|
|
212
199
|
* @param {import("vue").Ref<import("stac-ts").StacCollection | null>} selectedIndicator
|
|
213
200
|
* @param {EodashCollection[]} eodashCols
|
|
214
201
|
* @param {import("vue").Ref<string>} datetime
|
|
202
|
+
* @param {import("vue").Ref<Record<string,any>[]>} mapLayers
|
|
203
|
+
* @param {import("vue").Ref<HTMLElement & Record<string,any> | null>} partnerMap
|
|
215
204
|
*/
|
|
216
205
|
export const useInitMap = (
|
|
217
206
|
mapElement,
|
|
218
207
|
selectedIndicator,
|
|
219
208
|
eodashCols,
|
|
220
209
|
datetime,
|
|
210
|
+
mapLayers,
|
|
211
|
+
partnerMap,
|
|
221
212
|
) => {
|
|
222
213
|
log.debug(
|
|
223
214
|
"InitMap",
|
|
@@ -228,69 +219,117 @@ export const useInitMap = (
|
|
|
228
219
|
);
|
|
229
220
|
|
|
230
221
|
const stopIndicatorWatcher = watch(
|
|
231
|
-
selectedIndicator,
|
|
232
|
-
async (updatedStac) => {
|
|
233
|
-
log.debug(
|
|
234
|
-
"SelectedIndicator watch triggered",
|
|
235
|
-
selectedIndicator,
|
|
236
|
-
updatedStac,
|
|
237
|
-
);
|
|
222
|
+
[selectedIndicator, datetime],
|
|
223
|
+
async ([updatedStac, updatedTime], [previousStac, previousTime]) => {
|
|
238
224
|
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
225
|
log.debug(
|
|
266
|
-
"
|
|
226
|
+
"Selected Indicator watch triggered",
|
|
227
|
+
updatedStac,
|
|
228
|
+
updatedTime,
|
|
267
229
|
);
|
|
268
|
-
/** @type {any} */
|
|
269
|
-
(mapElement.value).layers = [];
|
|
270
|
-
/** @type {any} */
|
|
271
|
-
(mapElement.value).layers = layersCollection;
|
|
272
|
-
}
|
|
273
|
-
},
|
|
274
|
-
{ immediate: true },
|
|
275
|
-
);
|
|
276
230
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
231
|
+
if (mapElement?.value?.id === "main") {
|
|
232
|
+
// Making sure main map gets the viewer that seems to be
|
|
233
|
+
// removed when the second map is no longer rendered
|
|
234
|
+
if (viewHolder !== null) {
|
|
235
|
+
// Set view to previous compare view
|
|
236
|
+
mapElement?.value?.map.setView(viewHolder);
|
|
237
|
+
viewHolder = null;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
let layersCollection = [];
|
|
241
|
+
|
|
242
|
+
const onlyTimeChanged =
|
|
243
|
+
updatedStac?.id === previousStac?.id && updatedTime !== previousTime;
|
|
244
|
+
|
|
245
|
+
const { selectedCompareStac } = storeToRefs(useSTAcStore());
|
|
246
|
+
if (mapElement?.value?.id === "main") {
|
|
247
|
+
// Main map being initialized
|
|
248
|
+
// Set projection based on indicator level information for both maps
|
|
249
|
+
await setMapProjFromCol(updatedStac);
|
|
250
|
+
} else {
|
|
251
|
+
// Compare map being initialized
|
|
252
|
+
if (selectedCompareStac.value !== null) {
|
|
253
|
+
// save view of compare map
|
|
254
|
+
viewHolder = mapElement?.value?.map.getView();
|
|
255
|
+
/** @type {any} */
|
|
256
|
+
(mapElement.value).sync = partnerMap.value;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// We re-crate the configuration if time changed
|
|
261
|
+
if (onlyTimeChanged) {
|
|
262
|
+
layersCollection = await createLayersConfig(
|
|
263
|
+
updatedStac,
|
|
264
|
+
eodashCols,
|
|
265
|
+
updatedTime,
|
|
266
|
+
);
|
|
267
|
+
log.debug(
|
|
268
|
+
"Assigned layers after changing time only",
|
|
269
|
+
JSON.parse(JSON.stringify(layersCollection)),
|
|
270
|
+
);
|
|
271
|
+
mapLayers.value = layersCollection;
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/** @type {Record<string,any>[]} */
|
|
276
|
+
layersCollection = await createLayersConfig(
|
|
277
|
+
updatedStac,
|
|
283
278
|
eodashCols,
|
|
284
|
-
|
|
279
|
+
datetime.value,
|
|
285
280
|
);
|
|
286
|
-
|
|
287
|
-
|
|
281
|
+
|
|
282
|
+
// We try to set the current time selection to latest extent date
|
|
283
|
+
let endInterval = null;
|
|
284
|
+
const interval = updatedStac?.extent?.temporal?.interval;
|
|
285
|
+
if (interval && interval.length > 0 && interval[0].length > 1) {
|
|
286
|
+
// @ts-expect-error this is the defined STAC structure
|
|
287
|
+
endInterval = new Date(interval[0][1]);
|
|
288
|
+
log.debug(
|
|
289
|
+
"Indicator load: found stac extent, setting time to latest value",
|
|
290
|
+
endInterval,
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
if (
|
|
294
|
+
endInterval !== null &&
|
|
295
|
+
endInterval.toISOString() !== datetime.value
|
|
296
|
+
) {
|
|
297
|
+
datetime.value = endInterval.toISOString();
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// Try to move map view to extent only when main
|
|
301
|
+
// indicator and map changes
|
|
302
|
+
if (mapElement?.value?.id === "main") {
|
|
303
|
+
// Sanitize extent,
|
|
304
|
+
const b = updatedStac.extent?.spatial.bbox[0];
|
|
305
|
+
const sanitizedExtent = [
|
|
306
|
+
b[0] > -180 ? b[0] : -180,
|
|
307
|
+
b[1] > -90 ? b[1] : -90,
|
|
308
|
+
b[2] < 180 ? b[2] : 180,
|
|
309
|
+
b[3] < 90 ? b[3] : 90,
|
|
310
|
+
];
|
|
311
|
+
|
|
312
|
+
const reprojExtent = mapElement.value?.transformExtent(
|
|
313
|
+
sanitizedExtent,
|
|
314
|
+
"EPSG:4326",
|
|
315
|
+
mapElement.value?.map?.getView().getProjection(),
|
|
316
|
+
);
|
|
317
|
+
/** @type {any} */
|
|
318
|
+
(mapElement.value).zoomExtent = reprojExtent;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
log.debug(
|
|
322
|
+
"Assigned layers",
|
|
323
|
+
JSON.parse(JSON.stringify(layersCollection)),
|
|
324
|
+
);
|
|
325
|
+
|
|
326
|
+
mapLayers.value = layersCollection;
|
|
288
327
|
}
|
|
289
328
|
},
|
|
329
|
+
{ immediate: true },
|
|
290
330
|
);
|
|
291
331
|
|
|
292
332
|
onUnmounted(() => {
|
|
293
333
|
stopIndicatorWatcher();
|
|
294
|
-
stopDatetimeWatcher();
|
|
295
334
|
});
|
|
296
335
|
};
|
package/core/client/eodash.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
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);
|
|
7
3
|
|
|
8
4
|
/**
|
|
9
5
|
* Reactive Edoash Instance Object. provided globally in the app, and used as an
|
|
@@ -13,9 +9,9 @@ log.setLevel("debug", true);
|
|
|
13
9
|
*/
|
|
14
10
|
export const eodash = reactive({
|
|
15
11
|
id: "demo",
|
|
16
|
-
stacEndpoint:
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
stacEndpoint:
|
|
13
|
+
// "https://eodashcatalog.eox.at/test-style/trilateral/catalog.json",
|
|
14
|
+
"https://gtif-cerulean.github.io/catalog/cerulean/catalog.json",
|
|
19
15
|
brand: {
|
|
20
16
|
noLayout: true,
|
|
21
17
|
name: "Demo",
|
|
@@ -50,7 +46,7 @@ export const eodash = reactive({
|
|
|
50
46
|
widget: {
|
|
51
47
|
name: "EodashMap",
|
|
52
48
|
properties: {
|
|
53
|
-
|
|
49
|
+
enableCompare: true,
|
|
54
50
|
},
|
|
55
51
|
},
|
|
56
52
|
},
|
|
@@ -59,11 +55,11 @@ export const eodash = reactive({
|
|
|
59
55
|
id: Symbol(),
|
|
60
56
|
type: "internal",
|
|
61
57
|
title: "Indicators",
|
|
62
|
-
layout: { x: 0, y: 0, w: 3, h:
|
|
58
|
+
layout: { x: 0, y: 0, w: 3, h: 6 },
|
|
63
59
|
widget: {
|
|
64
60
|
name: "EodashItemFilter",
|
|
65
61
|
properties: {
|
|
66
|
-
|
|
62
|
+
enableCompare: true,
|
|
67
63
|
aggregateResults: "collection_group",
|
|
68
64
|
},
|
|
69
65
|
},
|
|
@@ -72,18 +68,38 @@ export const eodash = reactive({
|
|
|
72
68
|
id: Symbol(),
|
|
73
69
|
type: "internal",
|
|
74
70
|
title: "Layer Control",
|
|
75
|
-
layout: { x: 0, y:
|
|
71
|
+
layout: { x: 0, y: 6, w: 3, h: 6 },
|
|
76
72
|
widget: {
|
|
77
73
|
name: "EodashLayerControl",
|
|
78
74
|
},
|
|
79
75
|
},
|
|
76
|
+
/*
|
|
77
|
+
{
|
|
78
|
+
defineWidget: (selectedCompareStac) => {
|
|
79
|
+
return selectedCompareStac
|
|
80
|
+
? {
|
|
81
|
+
id: Symbol(),
|
|
82
|
+
title: "Layer Control Comparison",
|
|
83
|
+
layout: { x: 9, y: 6, w: 3, h: 6 },
|
|
84
|
+
type: "internal",
|
|
85
|
+
widget: {
|
|
86
|
+
name: "EodashLayerControl",
|
|
87
|
+
properties: {
|
|
88
|
+
map: "second",
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
}
|
|
92
|
+
: null;
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
*/
|
|
80
96
|
{
|
|
81
97
|
defineWidget: (selectedSTAC) => {
|
|
82
98
|
return selectedSTAC
|
|
83
99
|
? {
|
|
84
100
|
id: "Information",
|
|
85
101
|
title: "Information",
|
|
86
|
-
layout: { x: 9, y: 0, w: 3, h:
|
|
102
|
+
layout: { x: 9, y: 0, w: 3, h: 6 },
|
|
87
103
|
type: "web-component",
|
|
88
104
|
widget: {
|
|
89
105
|
link: async () => await import("@eox/stacinfo"),
|
|
@@ -128,6 +144,10 @@ export const eodash = reactive({
|
|
|
128
144
|
title: "Datepicker",
|
|
129
145
|
widget: {
|
|
130
146
|
name: "EodashDatePicker",
|
|
147
|
+
properties: {
|
|
148
|
+
hintText: `<b>Hint:</b> closest available date is displayed <br />
|
|
149
|
+
on map (see Analysis Layers)`,
|
|
150
|
+
},
|
|
131
151
|
},
|
|
132
152
|
}
|
|
133
153
|
: null;
|
|
@@ -4,13 +4,14 @@ import eodash from "@/eodash";
|
|
|
4
4
|
import VCalendar from "v-calendar";
|
|
5
5
|
import { eodashKey } from "@/utils/keys";
|
|
6
6
|
import store from "../store";
|
|
7
|
+
import log from "loglevel";
|
|
7
8
|
|
|
8
9
|
export const pinia = createPinia();
|
|
9
10
|
|
|
10
11
|
/** @param {import("vue").App} app */
|
|
11
12
|
export function registerPlugins(app) {
|
|
12
13
|
window.eodashStore = store;
|
|
13
|
-
|
|
14
|
+
window.setEodashLoglevel = log.setLevel;
|
|
14
15
|
app
|
|
15
16
|
.use(vuetify)
|
|
16
17
|
.use(pinia)
|
|
@@ -8,6 +8,12 @@ import log from "loglevel";
|
|
|
8
8
|
*/
|
|
9
9
|
export const getLayers = () => mapEl.value?.layers.toReversed();
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Returns the current layers of {@link mapCompareEl}
|
|
13
|
+
* @returns {Record<string,any>[]}
|
|
14
|
+
*/
|
|
15
|
+
export const getCompareLayers = () => mapCompareEl.value?.layers.toReversed();
|
|
16
|
+
|
|
11
17
|
/**
|
|
12
18
|
* Register EPSG projection in `eox-map`
|
|
13
19
|
* @param {string|number|{name: string, def: string, extent?:number[]}} [projection]*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { registerProjection } from "@/store/Actions";
|
|
2
|
+
import { mapEl } from "@/store/States";
|
|
2
3
|
import {
|
|
3
4
|
extractRoles,
|
|
4
5
|
getProjectionCode,
|
|
@@ -72,7 +73,7 @@ export async function createLayersFromAssets(
|
|
|
72
73
|
|
|
73
74
|
if (geoTIFFSources.length && typeof geoTIFFIdx === "number") {
|
|
74
75
|
const geotiffSourceID = collectionId + ";:;GeoTIFF";
|
|
75
|
-
log.debug("Creating
|
|
76
|
+
log.debug("Creating WebGLTile layer from GeoTIFF", geotiffSourceID);
|
|
76
77
|
log.debug("Configured Sources", geoTIFFSources);
|
|
77
78
|
const layer = {
|
|
78
79
|
type: "WebGLTile",
|
|
@@ -100,12 +101,14 @@ export async function createLayersFromAssets(
|
|
|
100
101
|
* @param {import('stac-ts').StacItem} item
|
|
101
102
|
* @param {string} title
|
|
102
103
|
* @param {Record<string,any>} [layerDatetime]
|
|
104
|
+
* @param {string | null} [legendInfo]
|
|
103
105
|
*/
|
|
104
106
|
export const createLayersFromLinks = async (
|
|
105
107
|
collectionId,
|
|
106
108
|
title,
|
|
107
109
|
item,
|
|
108
110
|
layerDatetime,
|
|
111
|
+
legendInfo,
|
|
109
112
|
) => {
|
|
110
113
|
log.debug("Creating layers from links");
|
|
111
114
|
/** @type {Record<string,any>[]} */
|
|
@@ -114,6 +117,10 @@ export const createLayersFromLinks = async (
|
|
|
114
117
|
const wmtsArray = item.links.filter((l) => l.rel === "wmts");
|
|
115
118
|
const xyzArray = item.links.filter((l) => l.rel === "xyz") ?? [];
|
|
116
119
|
|
|
120
|
+
// Taking projection code from main map view, as main view defines
|
|
121
|
+
// projection for comparison map
|
|
122
|
+
const viewProjectionCode = mapEl?.value?.projection || "EPSG:3857";
|
|
123
|
+
|
|
117
124
|
for (const wmsLink of wmsArray ?? []) {
|
|
118
125
|
// Registering setting sub wms link projection
|
|
119
126
|
|
|
@@ -122,12 +129,16 @@ export const createLayersFromLinks = async (
|
|
|
122
129
|
(wmsLink?.["proj:epsg"] || wmsLink?.["eodash:proj4_def"]);
|
|
123
130
|
|
|
124
131
|
await registerProjection(wmsLinkProjection);
|
|
125
|
-
|
|
132
|
+
|
|
133
|
+
const linkProjectionCode =
|
|
134
|
+
getProjectionCode(wmsLinkProjection) || "EPSG:4326";
|
|
135
|
+
// Projection code need to be based on map view projection to make sure
|
|
136
|
+
// tiles are reloaded when changing projection
|
|
126
137
|
const linkId = createLayerID(
|
|
127
138
|
collectionId,
|
|
128
139
|
item.id,
|
|
129
140
|
wmsLink,
|
|
130
|
-
|
|
141
|
+
viewProjectionCode,
|
|
131
142
|
);
|
|
132
143
|
log.debug("WMS Layer added", linkId);
|
|
133
144
|
let json = {
|
|
@@ -140,7 +151,7 @@ export const createLayersFromLinks = async (
|
|
|
140
151
|
source: {
|
|
141
152
|
type: "TileWMS",
|
|
142
153
|
url: wmsLink.href,
|
|
143
|
-
projection:
|
|
154
|
+
projection: linkProjectionCode,
|
|
144
155
|
tileGrid: {
|
|
145
156
|
tileSize: [512, 512],
|
|
146
157
|
},
|
|
@@ -155,6 +166,10 @@ export const createLayersFromLinks = async (
|
|
|
155
166
|
// Expand all dimensions into the params attribute
|
|
156
167
|
Object.assign(json.source.params, wmsLink["wms:dimensions"]);
|
|
157
168
|
}
|
|
169
|
+
if (legendInfo !== null) {
|
|
170
|
+
// @ts-expect-error once we have a eox-map config type we can remove this
|
|
171
|
+
json.properties.description = legendInfo;
|
|
172
|
+
}
|
|
158
173
|
jsonArray.push(json);
|
|
159
174
|
}
|
|
160
175
|
|
|
@@ -175,8 +190,14 @@ export const createLayersFromLinks = async (
|
|
|
175
190
|
collectionId,
|
|
176
191
|
item.id,
|
|
177
192
|
wmtsLink,
|
|
178
|
-
|
|
193
|
+
viewProjectionCode,
|
|
194
|
+
);
|
|
195
|
+
const dimensions = /** @type { {style:any} & Record<string,any> } */ (
|
|
196
|
+
wmtsLink["wmts:dimensions"] || {}
|
|
179
197
|
);
|
|
198
|
+
let { style, ...dimensionsWithoutStyle } = { ...dimensions };
|
|
199
|
+
let extractedStyle = /** @type { string } */ (style || "default");
|
|
200
|
+
|
|
180
201
|
if (wmtsLink.title === "wmts capabilities") {
|
|
181
202
|
log.debug(
|
|
182
203
|
"Warning: WMTS Layer from capabilities added, function needs to be updated",
|
|
@@ -194,14 +215,14 @@ export const createLayersFromLinks = async (
|
|
|
194
215
|
// TODO: Hard coding url as the current one set is for capabilities
|
|
195
216
|
url: "https://wmts.marine.copernicus.eu/teroWmts",
|
|
196
217
|
layer: wmtsLink["wmts:layer"],
|
|
197
|
-
style:
|
|
218
|
+
style: extractedStyle,
|
|
198
219
|
// TODO: Hard coding matrixSet until we find solution to wmts creation from capabilities
|
|
199
220
|
matrixSet: "EPSG:3857",
|
|
200
221
|
projection: projectionCode,
|
|
201
222
|
tileGrid: {
|
|
202
223
|
tileSize: [128, 128],
|
|
203
224
|
},
|
|
204
|
-
dimensions:
|
|
225
|
+
dimensions: dimensionsWithoutStyle,
|
|
205
226
|
},
|
|
206
227
|
};
|
|
207
228
|
} else {
|
|
@@ -218,15 +239,15 @@ export const createLayersFromLinks = async (
|
|
|
218
239
|
},
|
|
219
240
|
source: {
|
|
220
241
|
type: "WMTS",
|
|
221
|
-
url: wmtsLink,
|
|
242
|
+
url: wmtsLink.href,
|
|
222
243
|
layer: wmtsLink["wmts:layer"],
|
|
223
|
-
style:
|
|
244
|
+
style: extractedStyle,
|
|
224
245
|
matrixSet: wmtsLink.matrixSet || "EPSG:3857",
|
|
225
246
|
projection: projectionCode,
|
|
226
247
|
tileGrid: {
|
|
227
248
|
tileSize: [512, 512],
|
|
228
249
|
},
|
|
229
|
-
dimensions:
|
|
250
|
+
dimensions: dimensionsWithoutStyle,
|
|
230
251
|
},
|
|
231
252
|
};
|
|
232
253
|
}
|
|
@@ -245,7 +266,7 @@ export const createLayersFromLinks = async (
|
|
|
245
266
|
collectionId,
|
|
246
267
|
item.id,
|
|
247
268
|
xyzLink,
|
|
248
|
-
|
|
269
|
+
viewProjectionCode,
|
|
249
270
|
);
|
|
250
271
|
log.debug("XYZ Layer added", linkId);
|
|
251
272
|
let json = {
|
|
@@ -9,7 +9,11 @@ import {
|
|
|
9
9
|
generateFeatures,
|
|
10
10
|
replaceLayer,
|
|
11
11
|
} from "./helpers";
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
getLayers,
|
|
14
|
+
getCompareLayers,
|
|
15
|
+
registerProjection,
|
|
16
|
+
} from "@/store/Actions";
|
|
13
17
|
import { createLayersFromAssets, createLayersFromLinks } from "./createLayers";
|
|
14
18
|
import axios from "@/plugins/axios";
|
|
15
19
|
import log from "loglevel";
|
|
@@ -183,11 +187,20 @@ export class EodashCollection {
|
|
|
183
187
|
Object.keys(dataAssets).length;
|
|
184
188
|
|
|
185
189
|
if (isSupported) {
|
|
190
|
+
// Checking for potential legend asset
|
|
191
|
+
let legendInfo = null;
|
|
192
|
+
if (this.#collectionStac?.assets?.legend?.href) {
|
|
193
|
+
legendInfo = `
|
|
194
|
+
<div style="text-align:center; width: 100%">
|
|
195
|
+
<img src="${this.#collectionStac.assets.legend.href}" style="max-height:70px; margin-top:-15px; margin-bottom:-20px;" />
|
|
196
|
+
</div>`;
|
|
197
|
+
}
|
|
186
198
|
const links = await createLayersFromLinks(
|
|
187
199
|
this.#collectionStac?.id ?? "",
|
|
188
200
|
title,
|
|
189
201
|
item,
|
|
190
202
|
layerDatetime,
|
|
203
|
+
legendInfo,
|
|
191
204
|
);
|
|
192
205
|
jsonArray.push(
|
|
193
206
|
...links,
|
|
@@ -296,8 +309,9 @@ export class EodashCollection {
|
|
|
296
309
|
*
|
|
297
310
|
* @param {string} datetime
|
|
298
311
|
* @param {string} layer
|
|
312
|
+
* @param {string} map
|
|
299
313
|
*/
|
|
300
|
-
async updateLayerJson(datetime, layer) {
|
|
314
|
+
async updateLayerJson(datetime, layer, map) {
|
|
301
315
|
await this.fetchCollection();
|
|
302
316
|
|
|
303
317
|
// get the link of the specified date
|
|
@@ -318,12 +332,15 @@ export class EodashCollection {
|
|
|
318
332
|
// create json layers from the item
|
|
319
333
|
const newLayers = await this.createLayersJson(specifiedLink);
|
|
320
334
|
|
|
321
|
-
|
|
335
|
+
let currentLayers = getLayers();
|
|
336
|
+
if (map === "second") {
|
|
337
|
+
currentLayers = getCompareLayers();
|
|
338
|
+
}
|
|
322
339
|
|
|
323
|
-
const oldLayer = findLayer(
|
|
340
|
+
const oldLayer = findLayer(currentLayers, layer);
|
|
324
341
|
|
|
325
342
|
const updatedLayers = replaceLayer(
|
|
326
|
-
|
|
343
|
+
currentLayers,
|
|
327
344
|
/** @type {Record<string,any> & { properties:{ id:string; title:string } } } */
|
|
328
345
|
(oldLayer),
|
|
329
346
|
newLayers,
|