@eodash/eodash 5.0.0-alpha.2.10 → 5.0.0-alpha.2.12
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/index.js +37 -18
- package/core/client/eodash.js +3 -10
- package/core/client/store/Actions.js +9 -33
- package/core/client/store/States.js +3 -0
- package/core/client/utils/createLayers.js +131 -0
- package/core/client/utils/eodashSTAC.js +149 -227
- package/core/client/utils/helpers.js +49 -69
- package/dist/client/{DashboardLayout-C_3q8Y10.js → DashboardLayout-g4rqjeWc.js} +2 -2
- package/dist/client/{DynamicWebComponent-IiTTLBt-.js → DynamicWebComponent-BKV7nbud.js} +4 -4
- package/dist/client/{EodashDatePicker-DgC1lccp.js → EodashDatePicker-D4zsy9eq.js} +43 -43
- package/dist/client/EodashItemFilter-CRA5Ksjy.js +10067 -0
- package/dist/client/EodashLayerControl-CcFkORFA.js +31500 -0
- package/dist/client/{EodashMap-C96D3LLv.js → EodashMap-Bq6kJxfa.js} +8326 -8311
- package/dist/client/{EodashMapBtns-DDtzV94u.js → EodashMapBtns-Tzefzyf2.js} +5 -5
- package/dist/client/{ExportState-CduS2mFs.js → ExportState-CbK0FtDG.js} +37 -37
- package/dist/client/{Footer-DHQcutCv.js → Footer-BrNqLnRu.js} +1 -1
- package/dist/client/{Header-DC0y7rLK.js → Header-CbTE-BoI.js} +4 -4
- package/dist/client/{IframeWrapper-BK-10FbS.js → IframeWrapper-Ph5bZpJZ.js} +1 -1
- package/dist/client/{MobileLayout-BpLoMY4i.js → MobileLayout-kdgmpNhM.js} +6 -6
- package/dist/client/{PopUp-CNMCWL0z.js → PopUp-BWbFe1C1.js} +9 -9
- package/dist/client/{VImg-DT7eb8V-.js → VImg-CzQmrZjo.js} +2 -2
- package/dist/client/{VMain-OenWyy46.js → VMain-DfQqCpW9.js} +2 -2
- package/dist/client/{VOverlay-x3UXpKhr.js → VOverlay-sx4v7gXf.js} +71 -71
- package/dist/client/{WidgetsContainer-qMUwtN0W.js → WidgetsContainer-BrWo2pW8.js} +5 -5
- package/dist/client/{asWebComponent-DQrnLsI2.js → asWebComponent-CVFLR8Hh.js} +4117 -4117
- package/dist/client/{decoder-Cth6J7EK-CtUoHA6r.js → decoder-Cth6J7EK-DlG9ScOz.js} +1 -1
- package/dist/client/eo-dash.js +1 -1
- package/dist/client/{forwardRefs-CpNjL95t.js → forwardRefs-BOAfCdT0.js} +1 -1
- package/dist/client/{helpers-KCSgmfim.js → helpers-BjdrMtvO.js} +206 -232
- package/dist/client/{index-DopVrUzM.js → index-Ct9AYlRj.js} +5 -5
- package/dist/client/{lerc-BgbQqdFI-D986ErVw.js → lerc-BgbQqdFI-B1NkI4BO.js} +1 -1
- package/dist/client/{ssrBoot-DkjdOWvj.js → ssrBoot-BfIptj2L.js} +1 -1
- package/dist/client/style.css +1 -1
- package/dist/client/{transition-BtJHh7JK.js → transition-YJj28Lgx.js} +1 -1
- package/dist/node/cli.js +2 -2
- package/package.json +6 -3
- package/widgets/EodashDatePicker.vue +4 -3
- package/widgets/EodashItemFilter.vue +17 -12
- package/widgets/EodashLayerControl.vue +18 -0
- package/widgets/EodashMap.vue +46 -75
- package/widgets/ExportState.vue +3 -2
- package/dist/client/EodashItemFilter-DoWZGe6r.js +0 -7671
- package/dist/client/eox-jsonform-DCErgjhw.js +0 -17515
- package/dist/client/eox-layercontrol-D0Ht7Mag.js +0 -21298
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// functions of this folder can only be consumed inside setup stores,
|
|
2
2
|
// setup functions or vue composition api components
|
|
3
3
|
|
|
4
|
-
import { currentUrl, indicator, mapPosition } from "@/store/States";
|
|
4
|
+
import { currentUrl, datetime, indicator, mapPosition } from "@/store/States";
|
|
5
5
|
import eodash from "@/eodash";
|
|
6
6
|
import { useTheme } from "vuetify/lib/framework.mjs";
|
|
7
7
|
import { onMounted, watch } from "vue";
|
|
@@ -71,7 +71,7 @@ export const useUpdateTheme = (themeName, themeDefinition = {}) => {
|
|
|
71
71
|
export const useURLSearchParametersSync = () => {
|
|
72
72
|
onMounted(async () => {
|
|
73
73
|
// Analyze currently set url params when first loaded and set them in the store
|
|
74
|
-
if (
|
|
74
|
+
if (window.location.search) {
|
|
75
75
|
const searchParams = new URLSearchParams(window.location.search);
|
|
76
76
|
/** @type {number | undefined} */
|
|
77
77
|
let x,
|
|
@@ -80,40 +80,59 @@ export const useURLSearchParametersSync = () => {
|
|
|
80
80
|
/** @type {number | undefined} */
|
|
81
81
|
z;
|
|
82
82
|
searchParams.forEach(async (value, key) => {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
83
|
+
switch (key) {
|
|
84
|
+
case "indicator": {
|
|
85
|
+
const { loadSelectedSTAC, stac } = useSTAcStore();
|
|
86
|
+
const match = stac?.find((link) => link.id == value);
|
|
87
|
+
if (match) {
|
|
88
|
+
await loadSelectedSTAC(match.href);
|
|
89
|
+
}
|
|
90
|
+
break;
|
|
88
91
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
92
|
+
case "x":
|
|
93
|
+
x = Number(value);
|
|
94
|
+
break;
|
|
95
|
+
case "y":
|
|
96
|
+
y = Number(value);
|
|
97
|
+
break;
|
|
98
|
+
case "z":
|
|
99
|
+
z = Number(value);
|
|
100
|
+
break;
|
|
101
|
+
case "datetime":
|
|
102
|
+
try {
|
|
103
|
+
datetime.value = new Date(value).toISOString();
|
|
104
|
+
} catch {
|
|
105
|
+
datetime.value = new Date().toISOString();
|
|
106
|
+
}
|
|
107
|
+
break;
|
|
108
|
+
default:
|
|
109
|
+
break;
|
|
98
110
|
}
|
|
99
111
|
});
|
|
112
|
+
|
|
100
113
|
if (x && y && z) {
|
|
101
114
|
mapPosition.value = [x, y, z];
|
|
102
115
|
}
|
|
103
116
|
}
|
|
117
|
+
|
|
104
118
|
watch(
|
|
105
|
-
[indicator, mapPosition],
|
|
106
|
-
([updatedIndicator, updatedMapPosition]) => {
|
|
119
|
+
[indicator, mapPosition, datetime],
|
|
120
|
+
([updatedIndicator, updatedMapPosition, updatedDatetime]) => {
|
|
107
121
|
if ("URLSearchParams" in window) {
|
|
108
122
|
const searchParams = new URLSearchParams(window.location.search);
|
|
109
123
|
if (updatedIndicator !== "") {
|
|
110
124
|
searchParams.set("indicator", updatedIndicator);
|
|
111
125
|
}
|
|
126
|
+
|
|
112
127
|
if (updatedMapPosition && updatedMapPosition.length === 3) {
|
|
113
128
|
searchParams.set("x", updatedMapPosition[0]?.toFixed(4) ?? "");
|
|
114
129
|
searchParams.set("y", updatedMapPosition[1]?.toFixed(4) ?? "");
|
|
115
130
|
searchParams.set("z", updatedMapPosition[2]?.toFixed(4) ?? "");
|
|
116
131
|
}
|
|
132
|
+
|
|
133
|
+
if (updatedDatetime) {
|
|
134
|
+
searchParams.set("datetime", updatedDatetime.split("T")?.[0] ?? "");
|
|
135
|
+
}
|
|
117
136
|
const newRelativePathQuery =
|
|
118
137
|
window.location.pathname + "?" + searchParams.toString();
|
|
119
138
|
history.pushState(null, "", newRelativePathQuery);
|
package/core/client/eodash.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { reactive } from "vue";
|
|
2
2
|
import { currentUrl } from "./store/States";
|
|
3
|
+
|
|
3
4
|
/**
|
|
4
5
|
* Reactive Edoash Instance Object. provided globally in the app, and used as an
|
|
5
6
|
* intermediate object to make user defined instances config reactive.
|
|
@@ -57,19 +58,11 @@ export const eodash = reactive({
|
|
|
57
58
|
},
|
|
58
59
|
{
|
|
59
60
|
id: Symbol(),
|
|
60
|
-
type: "
|
|
61
|
+
type: "internal",
|
|
61
62
|
title: "Layer Control",
|
|
62
63
|
layout: { x: 0, y: 8, w: 3, h: 4 },
|
|
63
64
|
widget: {
|
|
64
|
-
|
|
65
|
-
await import("@eox/layercontrol");
|
|
66
|
-
await import("@eox/jsonform");
|
|
67
|
-
},
|
|
68
|
-
tagName: "eox-layercontrol",
|
|
69
|
-
properties: {
|
|
70
|
-
for: "eox-map",
|
|
71
|
-
class: "pa-4",
|
|
72
|
-
},
|
|
65
|
+
name: "EodashLayerControl",
|
|
73
66
|
},
|
|
74
67
|
},
|
|
75
68
|
{
|
|
@@ -1,19 +1,10 @@
|
|
|
1
|
-
import { registeredProjections } from "@/store/States";
|
|
1
|
+
import { mapEl, registeredProjections } from "@/store/States";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Returns the current layers of
|
|
5
|
-
* @
|
|
6
|
-
* @returns {object[]}
|
|
4
|
+
* Returns the current layers of {@link mapEl}
|
|
5
|
+
* @returns {Record<string,any>[]}
|
|
7
6
|
*/
|
|
8
|
-
export const getLayers = (
|
|
9
|
-
customElements.get("eo-dash")
|
|
10
|
-
? document
|
|
11
|
-
.querySelector("eo-dash")
|
|
12
|
-
?.shadowRoot?.querySelector(el)
|
|
13
|
-
//@ts-expect-error `layers` doesn't exist on type element
|
|
14
|
-
?.layers.toReversed()
|
|
15
|
-
: //@ts-expect-error `layers` doesn't exist on type element
|
|
16
|
-
document.querySelector(el)?.layers.toReversed();
|
|
7
|
+
export const getLayers = () => mapEl.value?.layers.toReversed();
|
|
17
8
|
|
|
18
9
|
/**
|
|
19
10
|
* Register EPSG projection in `eox-map`
|
|
@@ -23,33 +14,18 @@ export const registerProjection = async (code) => {
|
|
|
23
14
|
if (!code || registeredProjections.includes(code)) {
|
|
24
15
|
return;
|
|
25
16
|
}
|
|
26
|
-
const eoxMap =
|
|
27
|
-
/** @type {HTMLElement & Record<string,any> | null | undefined} */ (
|
|
28
|
-
customElements.get("eo-dash")
|
|
29
|
-
? document
|
|
30
|
-
.querySelector("eo-dash")
|
|
31
|
-
?.shadowRoot?.querySelector("eox-map")
|
|
32
|
-
: document.querySelector("eox-map")
|
|
33
|
-
);
|
|
34
17
|
|
|
35
18
|
registeredProjections.push(code);
|
|
36
|
-
await
|
|
19
|
+
await mapEl.value?.registerProjectionFromCode(code);
|
|
37
20
|
};
|
|
38
21
|
/**
|
|
39
22
|
* Change `eox-map` projection from an `EPSG` code
|
|
40
23
|
* @param {string|number} [code]*/
|
|
41
24
|
export const changeMapProjection = async (code) => {
|
|
42
25
|
code = typeof code === "number" ? `EPSG:${code}` : code;
|
|
43
|
-
|
|
44
|
-
/** @type {HTMLElement & Record<string,any> | null | undefined} */ (
|
|
45
|
-
customElements.get("eo-dash")
|
|
46
|
-
? document
|
|
47
|
-
.querySelector("eo-dash")
|
|
48
|
-
?.shadowRoot?.querySelector("eox-map")
|
|
49
|
-
: document.querySelector("eox-map")
|
|
50
|
-
);
|
|
26
|
+
|
|
51
27
|
if (!code) {
|
|
52
|
-
|
|
28
|
+
mapEl.value?.setAttribute("projection", "EPSG:3857");
|
|
53
29
|
return;
|
|
54
30
|
}
|
|
55
31
|
|
|
@@ -57,6 +33,6 @@ export const changeMapProjection = async (code) => {
|
|
|
57
33
|
await registerProjection(code);
|
|
58
34
|
}
|
|
59
35
|
|
|
60
|
-
code =
|
|
61
|
-
|
|
36
|
+
code = mapEl.value?.getAttribute("projection") === code ? "EPSG:3857" : code;
|
|
37
|
+
mapEl.value?.setAttribute("projection", code);
|
|
62
38
|
};
|
|
@@ -19,3 +19,6 @@ export const registeredProjections = ["EPSG:4326", "EPSG:3857"];
|
|
|
19
19
|
|
|
20
20
|
/** available projection to be rendered by `EodashMap` */
|
|
21
21
|
export const availableMapProjection = ref("");
|
|
22
|
+
|
|
23
|
+
/** @type {import("vue").Ref<HTMLElement & Record<string,any> | null>} */
|
|
24
|
+
export const mapEl = ref(null);
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { registerProjection } from "@/store/Actions";
|
|
2
|
+
import { extractRoles } from "./helpers";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @param {string} id
|
|
6
|
+
* @param {string} title
|
|
7
|
+
* @param {Record<string,import("stac-ts").StacAsset>} assets
|
|
8
|
+
* @param {import("ol/layer/WebGLTile").Style} [style]
|
|
9
|
+
* @param {Record<string, unknown>} [layerConfig]
|
|
10
|
+
**/
|
|
11
|
+
export async function createLayersFromDataAssets(
|
|
12
|
+
id,
|
|
13
|
+
title,
|
|
14
|
+
assets,
|
|
15
|
+
style,
|
|
16
|
+
layerConfig,
|
|
17
|
+
) {
|
|
18
|
+
let jsonArray = [];
|
|
19
|
+
let geoTIFFSources = [];
|
|
20
|
+
for (const ast in assets) {
|
|
21
|
+
// register projection if exists
|
|
22
|
+
await registerProjection(
|
|
23
|
+
/** @type {number | undefined} */ (assets[ast]?.["proj:epsg"]),
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
if (assets[ast]?.type === "application/geo+json") {
|
|
27
|
+
const layer = {
|
|
28
|
+
type: "Vector",
|
|
29
|
+
source: {
|
|
30
|
+
type: "Vector",
|
|
31
|
+
url: assets[ast].href,
|
|
32
|
+
format: "GeoJSON",
|
|
33
|
+
},
|
|
34
|
+
properties: {
|
|
35
|
+
id,
|
|
36
|
+
title,
|
|
37
|
+
...(layerConfig && {
|
|
38
|
+
layerConfig: {
|
|
39
|
+
...layerConfig,
|
|
40
|
+
style,
|
|
41
|
+
},
|
|
42
|
+
}),
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
extractRoles(layer.properties, assets[ast]?.roles ?? []);
|
|
46
|
+
jsonArray.push(layer);
|
|
47
|
+
} else if (assets[ast]?.type === "image/tiff") {
|
|
48
|
+
geoTIFFSources.push({ url: assets[ast].href });
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (geoTIFFSources.length) {
|
|
53
|
+
jsonArray.push({
|
|
54
|
+
type: "WebGLTile",
|
|
55
|
+
source: {
|
|
56
|
+
type: "GeoTIFF",
|
|
57
|
+
normalize: !style?.variables,
|
|
58
|
+
sources: geoTIFFSources,
|
|
59
|
+
},
|
|
60
|
+
properties: {
|
|
61
|
+
id,
|
|
62
|
+
title,
|
|
63
|
+
layerConfig,
|
|
64
|
+
},
|
|
65
|
+
style,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return jsonArray;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* @param {import('stac-ts').StacItem} item
|
|
74
|
+
* @param {string} id
|
|
75
|
+
* @param {string} title
|
|
76
|
+
*/
|
|
77
|
+
export const createLayersFromLinks = (id, title, item) => {
|
|
78
|
+
/** @type {Record<string,any>[]} */
|
|
79
|
+
const jsonArray = [];
|
|
80
|
+
const wmsArray = item.links.filter((l) => l.rel === "wms");
|
|
81
|
+
const xyzArray = item.links.filter((l) => l.rel === "xyz");
|
|
82
|
+
|
|
83
|
+
if (wmsArray.length) {
|
|
84
|
+
wmsArray.forEach((link) => {
|
|
85
|
+
let json = {
|
|
86
|
+
type: "Tile",
|
|
87
|
+
properties: {
|
|
88
|
+
id: id || link.id,
|
|
89
|
+
title: title || link.title || item.id,
|
|
90
|
+
},
|
|
91
|
+
source: {
|
|
92
|
+
type: "TileWMS",
|
|
93
|
+
url: link.href,
|
|
94
|
+
params: {
|
|
95
|
+
LAYERS: link["wms:layers"],
|
|
96
|
+
TILED: true,
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
extractRoles(json.properties, /** @type {string[]} */ (link.roles));
|
|
102
|
+
|
|
103
|
+
if ("wms:dimensions" in link) {
|
|
104
|
+
// Expand all dimensions into the params attribute
|
|
105
|
+
Object.assign(json.source.params, link["wms:dimensions"]);
|
|
106
|
+
}
|
|
107
|
+
jsonArray.push(json);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (xyzArray.length) {
|
|
112
|
+
xyzArray.forEach((link) => {
|
|
113
|
+
let json = {
|
|
114
|
+
type: "Tile",
|
|
115
|
+
properties: {
|
|
116
|
+
id: link.id || item.id,
|
|
117
|
+
title: title || link.title || item.id,
|
|
118
|
+
roles: link.roles,
|
|
119
|
+
},
|
|
120
|
+
source: {
|
|
121
|
+
type: "XYZ",
|
|
122
|
+
url: link.href,
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
extractRoles(json.properties, /** @type {string[]} */ (link.roles));
|
|
127
|
+
jsonArray.push(json);
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
return jsonArray;
|
|
131
|
+
};
|