@eodash/eodash 5.3.3 → 5.5.0
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/asWebComponent.js +1 -1
- package/core/client/composables/DefineEodash.js +3 -1
- package/core/client/composables/DefineWidgets.js +12 -2
- package/core/client/eodashSTAC/EodashCollection.js +20 -37
- package/core/client/eodashSTAC/createLayers.js +306 -136
- package/core/client/eodashSTAC/helpers.js +60 -40
- package/core/client/eodashSTAC/parquet.js +2 -0
- package/core/client/eodashSTAC/triggers.js +5 -5
- package/core/client/store/actions.js +17 -17
- package/core/client/store/states.js +26 -4
- package/core/client/types.ts +12 -1
- package/core/client/utils/index.js +18 -1
- package/dist/client/{DashboardLayout-Cp8Rv3Ef.js → DashboardLayout-CkSgvaFF.js} +2 -2
- package/dist/client/{DynamicWebComponent-CBsxC82P.js → DynamicWebComponent-Ncsg6fb9.js} +1 -1
- package/dist/client/EodashChart-5v7adDpG.js +144 -0
- package/dist/client/{EodashDatePicker-Dewym-cx.js → EodashDatePicker-RoQJe6ss.js} +4 -4
- package/dist/client/{EodashItemFilter-CAsZpOoQ.js → EodashItemFilter-CCoVC5BE.js} +2 -2
- package/dist/client/{EodashLayerControl-fn-rt8Ac.js → EodashLayerControl-weVj7aQA.js} +2 -2
- package/dist/client/{EodashLayoutSwitcher-B9XqQXCS.js → EodashLayoutSwitcher-CL-Z9d5_.js} +3 -3
- package/dist/client/EodashMapBtns-CXU8IuPO.js +433 -0
- package/dist/client/{EodashStacInfo-lxBKoav9.js → EodashStacInfo-BbMnjf-n.js} +11 -15
- package/dist/client/{EodashTimeSlider-DI97QkNT.js → EodashTimeSlider-BZXnqfax.js} +2 -2
- package/dist/client/{EodashTools-D5ShUT1g.js → EodashTools-DUJlkkgx.js} +4 -4
- package/dist/client/{ExportState-ruNyRS2E.js → ExportState-CT3FQOHW.js} +46 -21
- package/dist/client/{Footer-IQNyfd78.js → Footer-D_iqP-1K.js} +1 -1
- package/dist/client/{Header-BBdi_-Lp.js → Header-Dzhnvsy-.js} +127 -17
- package/dist/client/MobileLayout-6Rg_PSO8.js +118 -0
- package/dist/client/{PopUp-DRgOmD7-.js → PopUp-DPPv_GSA.js} +8 -59
- package/dist/client/{ProcessList-DxyCFQdz.js → ProcessList-BIN_Mb27.js} +9 -13
- package/dist/client/{VImg-hwmwzSwG.js → VImg-DhbuvNrA.js} +2 -2
- package/dist/client/{VMain-vk4-rkw-.js → VMain-CVabY_NY.js} +1 -1
- package/dist/client/{VTooltip-BYUZeia1.js → VTooltip-Cc6au3Sn.js} +3 -4
- package/dist/client/{WidgetsContainer-DXD_8rqh.js → WidgetsContainer-ChqTJS4h.js} +1 -1
- package/dist/client/asWebComponent-DaIxULaA.js +9207 -0
- package/dist/client/{async-D1MvO_Z_.js → async-D6Lvv-fT.js} +15 -5
- package/dist/client/eo-dash.js +1 -1
- package/dist/client/{forwardRefs-DM-E2MfG.js → forwardRefs--IccUBdR.js} +196 -37
- package/dist/client/{handling-CbgeKrqT.js → handling-DSA67d6E.js} +160 -37
- package/dist/client/{helpers-CtUlAW0N.js → helpers-BBSdbOmv.js} +239 -126
- package/dist/client/{index-DBo0F4Fv.js → index-6LlXNkke.js} +5 -3
- package/dist/client/{index-BJvLt3Xf.js → index-BS-8Y5FE.js} +34 -77
- package/dist/client/{index-BkW06-Lg.js → index-CQihL_c6.js} +55 -15
- package/dist/client/{index-BxDh5v-H.js → index-qsZhYR_6.js} +15 -16
- package/dist/client/templates.js +52 -2
- package/dist/client/{transition-BdzATvPB.js → transition-DFr4cXu8.js} +1 -1
- package/dist/node/cli.js +1 -1
- package/dist/types/core/client/App.vue.d.ts +16 -6
- package/dist/types/core/client/asWebComponent.d.ts +2 -2
- package/dist/types/core/client/components/DashboardLayout.vue.d.ts +2 -1
- package/dist/types/core/client/components/DynamicWebComponent.vue.d.ts +36 -16
- package/dist/types/core/client/components/EodashOverlay.vue.d.ts +2 -1
- package/dist/types/core/client/components/ErrorAlert.vue.d.ts +9 -1
- package/dist/types/core/client/components/Footer.vue.d.ts +2 -1
- package/dist/types/core/client/components/Header.vue.d.ts +2 -1
- package/dist/types/core/client/components/IframeWrapper.vue.d.ts +12 -6
- package/dist/types/core/client/components/Loading.vue.d.ts +2 -1
- package/dist/types/core/client/components/MobileLayout.vue.d.ts +2 -1
- package/dist/types/core/client/composables/DefineEodash.d.ts +1 -1
- package/dist/types/core/client/eodashSTAC/EodashCollection.d.ts +27 -11
- package/dist/types/core/client/eodashSTAC/createLayers.d.ts +30 -23
- package/dist/types/core/client/eodashSTAC/helpers.d.ts +11 -4
- package/dist/types/core/client/store/actions.d.ts +1 -2
- package/dist/types/core/client/store/states.d.ts +22 -4
- package/dist/types/core/client/types.d.ts +7 -2
- package/dist/types/core/client/utils/index.d.ts +1 -0
- package/dist/types/core/client/views/Dashboard.vue.d.ts +20 -8
- package/dist/types/templates/compare.d.ts +20 -0
- package/dist/types/templates/expert.d.ts +30 -1
- package/dist/types/widgets/EodashChart.vue.d.ts +28 -0
- package/dist/types/widgets/EodashDatePicker.vue.d.ts +38 -9
- package/dist/types/widgets/EodashItemCatalog/index.vue.d.ts +88 -13
- package/dist/types/widgets/EodashItemCatalog/methods/map.d.ts +1 -1
- package/dist/types/widgets/EodashItemFilter.vue.d.ts +169 -26
- package/dist/types/widgets/EodashLayerControl.vue.d.ts +38 -10
- package/dist/types/widgets/EodashLayoutSwitcher.vue.d.ts +22 -7
- package/dist/types/widgets/EodashMap/EodashMapBtns.vue.d.ts +94 -19
- package/dist/types/widgets/EodashMap/index.vue.d.ts +647 -92
- package/dist/types/widgets/EodashMap/methods/btns.d.ts +14 -0
- package/dist/types/widgets/EodashProcess/ProcessList.vue.d.ts +24 -7
- package/dist/types/widgets/EodashProcess/index.vue.d.ts +26 -7
- package/dist/types/widgets/EodashProcess/methods/composables.d.ts +1 -2
- package/dist/types/widgets/EodashProcess/methods/handling.d.ts +18 -11
- package/dist/types/widgets/EodashProcess/methods/outputs.d.ts +2 -2
- package/dist/types/widgets/EodashProcess/methods/utils.d.ts +1 -0
- package/dist/types/widgets/EodashStacInfo.vue.d.ts +67 -18
- package/dist/types/widgets/EodashTimeSlider.vue.d.ts +14 -6
- package/dist/types/widgets/EodashTools.vue.d.ts +437 -47
- package/dist/types/widgets/ExportState.vue.d.ts +26 -8
- package/dist/types/widgets/PopUp.vue.d.ts +61 -11
- package/dist/types/widgets/WidgetsContainer.vue.d.ts +22 -6
- package/package.json +33 -34
- package/templates/baseConfig.js +2 -1
- package/templates/compare.js +28 -1
- package/templates/expert.js +23 -1
- package/widgets/EodashChart.vue +139 -0
- package/widgets/EodashItemCatalog/index.vue +2 -2
- package/widgets/EodashItemCatalog/methods/map.js +9 -10
- package/widgets/EodashMap/EodashMapBtns.vue +73 -93
- package/widgets/EodashMap/index.vue +14 -2
- package/widgets/EodashMap/methods/btns.js +155 -0
- package/widgets/EodashMap/methods/create-layers-config.js +26 -3
- package/widgets/EodashMap/methods/index.js +2 -1
- package/widgets/EodashProcess/ProcessList.vue +2 -3
- package/widgets/EodashProcess/index.vue +19 -70
- package/widgets/EodashProcess/methods/async.js +1 -1
- package/widgets/EodashProcess/methods/composables.js +13 -6
- package/widgets/EodashProcess/methods/custom-endpoints/chart/veda-endpoint.js +20 -7
- package/widgets/EodashProcess/methods/handling.js +100 -22
- package/widgets/EodashProcess/methods/outputs.js +44 -4
- package/widgets/EodashProcess/methods/utils.js +11 -1
- package/widgets/EodashStacInfo.vue +10 -23
- package/widgets/ExportState.vue +9 -15
- package/dist/client/EodashMapBtns-nFY6MIAX.js +0 -301
- package/dist/client/MobileLayout-BfBeF-JF.js +0 -118
- package/dist/client/asWebComponent-DdguWGDI.js +0 -8967
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { registerProjection } from "@/store/actions";
|
|
2
2
|
import { mapEl } from "@/store/states";
|
|
3
|
+
import axios from "@/plugins/axios";
|
|
3
4
|
|
|
4
5
|
import {
|
|
5
6
|
extractRoles,
|
|
@@ -8,6 +9,7 @@ import {
|
|
|
8
9
|
createAssetID,
|
|
9
10
|
mergeGeojsons,
|
|
10
11
|
extractLayerConfig,
|
|
12
|
+
extractEoxLegendLink,
|
|
11
13
|
addTooltipInteraction,
|
|
12
14
|
fetchStyle,
|
|
13
15
|
} from "./helpers";
|
|
@@ -18,9 +20,7 @@ import log from "loglevel";
|
|
|
18
20
|
* @param {string} collectionId
|
|
19
21
|
* @param {string} title
|
|
20
22
|
* @param {Record<string,import("stac-ts").StacAsset>} assets
|
|
21
|
-
* @param {import("stac-ts").StacItem }
|
|
22
|
-
* @param {import("@/types").EodashStyleJson} [style]
|
|
23
|
-
* @param {Record<string, unknown>} [layerConfig]
|
|
23
|
+
* @param {import("stac-ts").StacItem | import("stac-ts").StacCollection } stacObject
|
|
24
24
|
* @param {Record<string, unknown>} [layerDatetime]
|
|
25
25
|
* @param {object | null} [extraProperties]
|
|
26
26
|
**/
|
|
@@ -28,80 +28,40 @@ export async function createLayersFromAssets(
|
|
|
28
28
|
collectionId,
|
|
29
29
|
title,
|
|
30
30
|
assets,
|
|
31
|
-
|
|
32
|
-
style,
|
|
33
|
-
layerConfig,
|
|
31
|
+
stacObject,
|
|
34
32
|
layerDatetime,
|
|
35
33
|
extraProperties,
|
|
36
34
|
) {
|
|
37
35
|
log.debug("Creating layers from assets");
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
let geoTIFFIdx = null;
|
|
42
|
-
|
|
43
|
-
let geoJsonIdx = 0;
|
|
44
|
-
let geoJsonAttributions = [];
|
|
36
|
+
const jsonArray = [];
|
|
37
|
+
const geoTIFFSources = [];
|
|
38
|
+
const geoTIFFIdx = [];
|
|
45
39
|
|
|
46
40
|
const geoJsonSources = [];
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const assetId = createAssetID(collectionId, item.id, idx);
|
|
65
|
-
log.debug(`Creating Vector layer from FlatGeoBuf`, assetId);
|
|
66
|
-
|
|
67
|
-
const layer = {
|
|
68
|
-
type: "Vector",
|
|
69
|
-
source: {
|
|
70
|
-
type: "FlatGeoBuf",
|
|
71
|
-
url: assets[ast].href,
|
|
72
|
-
projection,
|
|
73
|
-
attributions: assets[ast].attribution,
|
|
74
|
-
},
|
|
75
|
-
properties: {
|
|
76
|
-
id: assetId,
|
|
77
|
-
title,
|
|
78
|
-
layerDatetime,
|
|
79
|
-
...(layerConfig && {
|
|
80
|
-
layerConfig: {
|
|
81
|
-
...layerConfig,
|
|
82
|
-
style,
|
|
83
|
-
},
|
|
84
|
-
}),
|
|
85
|
-
},
|
|
86
|
-
...(!style?.variables && { style }),
|
|
87
|
-
interactions: [],
|
|
88
|
-
};
|
|
89
|
-
// add tooltip interaction if style has tooltip
|
|
90
|
-
addTooltipInteraction(layer, style);
|
|
91
|
-
|
|
92
|
-
extractRoles(layer.properties, assets[ast]);
|
|
93
|
-
|
|
94
|
-
layer.properties = { ...layer.properties, ...(extraProperties ?? {}) };
|
|
95
|
-
|
|
96
|
-
jsonArray.push(layer);
|
|
97
|
-
} else if (assets[ast]?.type === "image/tiff") {
|
|
98
|
-
geoTIFFIdx = idx;
|
|
41
|
+
const geoJsonIdx = [];
|
|
42
|
+
|
|
43
|
+
const fgbIdx = [];
|
|
44
|
+
const fgbSources = [];
|
|
45
|
+
const assetIds = [];
|
|
46
|
+
|
|
47
|
+
for (const [idx, assetId] of Object.keys(assets).entries()) {
|
|
48
|
+
assetIds.push(assetId);
|
|
49
|
+
|
|
50
|
+
if (assets[assetId]?.type === "application/geo+json") {
|
|
51
|
+
geoJsonSources.push(assets[assetId].href);
|
|
52
|
+
geoJsonIdx.push(idx);
|
|
53
|
+
} else if (assets[assetId]?.type === "application/vnd.flatgeobuf") {
|
|
54
|
+
fgbSources.push(assets[assetId].href);
|
|
55
|
+
fgbIdx.push(idx);
|
|
56
|
+
} else if (assets[assetId]?.type === "image/tiff") {
|
|
57
|
+
geoTIFFIdx.push(idx);
|
|
99
58
|
geoTIFFSources.push({
|
|
100
|
-
url: assets[
|
|
101
|
-
attributions: assets[
|
|
59
|
+
url: assets[assetId].href,
|
|
60
|
+
attributions: assets[assetId].attribution,
|
|
102
61
|
});
|
|
103
|
-
} else if (assets[
|
|
104
|
-
const responseData = await (await fetch(assets[
|
|
62
|
+
} else if (assets[assetId]?.type === "application/geodb+json") {
|
|
63
|
+
const responseData = await (await fetch(assets[assetId].href)).json();
|
|
64
|
+
geoJsonIdx.push(idx);
|
|
105
65
|
if (
|
|
106
66
|
!responseData ||
|
|
107
67
|
!Array.isArray(responseData) ||
|
|
@@ -161,61 +121,181 @@ export async function createLayersFromAssets(
|
|
|
161
121
|
}
|
|
162
122
|
|
|
163
123
|
if (geoJsonSources.length) {
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
...layerConfig,
|
|
183
|
-
style,
|
|
184
|
-
},
|
|
185
|
-
}),
|
|
186
|
-
},
|
|
187
|
-
...(!style?.variables && { style }),
|
|
188
|
-
interactions: [],
|
|
189
|
-
};
|
|
124
|
+
for (const [i, geoJsonSource] of geoJsonSources.entries()) {
|
|
125
|
+
// fetch styles and separate them by their mapping between links and assets
|
|
126
|
+
const assetName = assetIds[geoJsonIdx[i]];
|
|
127
|
+
const styles = await fetchStyle(stacObject, undefined, assetName);
|
|
128
|
+
// get the correct style which is not attached to a link
|
|
129
|
+
let { layerConfig, style } = extractLayerConfig(collectionId, styles);
|
|
130
|
+
let assetLayerId = createAssetID(
|
|
131
|
+
collectionId,
|
|
132
|
+
stacObject.id,
|
|
133
|
+
geoJsonIdx[i],
|
|
134
|
+
);
|
|
135
|
+
if (
|
|
136
|
+
assets[assetName]?.roles?.includes("overlay") ||
|
|
137
|
+
assets[assetName]?.roles?.includes("baselayer")
|
|
138
|
+
) {
|
|
139
|
+
// to prevent them being removed by date change on main dataset
|
|
140
|
+
assetLayerId = assetName;
|
|
141
|
+
}
|
|
190
142
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
143
|
+
log.debug(`Creating Vector layer from GeoJsons`, assetLayerId);
|
|
144
|
+
// register projection if exists
|
|
145
|
+
const assetProjection =
|
|
146
|
+
/** @type {string | number | {name: string, def: string, extent?:number[]} | undefined} */ (
|
|
147
|
+
assets[assetName]?.["proj:epsg"] ||
|
|
148
|
+
assets[assetName]?.["eodash:proj4_def"]
|
|
149
|
+
);
|
|
150
|
+
await registerProjection(assetProjection);
|
|
151
|
+
const projection = getProjectionCode(assetProjection) || "EPSG:4326";
|
|
152
|
+
const geoJSONURL =
|
|
153
|
+
stacObject?.["eodash:merge_assets"] === false
|
|
154
|
+
? geoJsonSource
|
|
155
|
+
: await mergeGeojsons(geoJsonSources);
|
|
156
|
+
|
|
157
|
+
const layer = {
|
|
158
|
+
type: "Vector",
|
|
159
|
+
source: {
|
|
160
|
+
type: "Vector",
|
|
161
|
+
url: geoJSONURL,
|
|
162
|
+
format: { type: "GeoJSON", dataProjection: projection },
|
|
163
|
+
attributions: assets[assetName].attribution,
|
|
164
|
+
},
|
|
165
|
+
properties: {
|
|
166
|
+
id: assetLayerId,
|
|
167
|
+
title: assets[assetName]?.title || title,
|
|
168
|
+
layerDatetime,
|
|
169
|
+
...(layerConfig && {
|
|
170
|
+
layerConfig: {
|
|
171
|
+
...layerConfig,
|
|
172
|
+
style,
|
|
173
|
+
},
|
|
174
|
+
}),
|
|
175
|
+
},
|
|
176
|
+
...(!style?.variables && { style }),
|
|
177
|
+
interactions: [],
|
|
178
|
+
};
|
|
179
|
+
layer.properties = { ...layer.properties, ...(extraProperties ?? {}) };
|
|
180
|
+
extractRoles(layer.properties, assets[assetName]);
|
|
181
|
+
addTooltipInteraction(layer, style);
|
|
182
|
+
jsonArray.push(layer);
|
|
183
|
+
// if we merged assets (default yes), then we can break from this loop
|
|
184
|
+
if (stacObject?.["eodash:merge_assets"] !== false) break;
|
|
185
|
+
}
|
|
194
186
|
}
|
|
195
|
-
if (
|
|
196
|
-
const
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
187
|
+
if (fgbSources.length) {
|
|
188
|
+
for (const [i, fgbSource] of fgbSources.entries()) {
|
|
189
|
+
// fetch styles and separate them by their mapping between links and assets
|
|
190
|
+
const assetName = assetIds[fgbIdx[i]];
|
|
191
|
+
const styles = await fetchStyle(stacObject, undefined, assetName);
|
|
192
|
+
// get the correct style which is not attached to a link
|
|
193
|
+
let { layerConfig, style } = extractLayerConfig(collectionId, styles);
|
|
194
|
+
let assetLayerId = createAssetID(collectionId, stacObject.id, fgbIdx[i]);
|
|
195
|
+
if (
|
|
196
|
+
assets[assetName]?.roles?.includes("overlay") ||
|
|
197
|
+
assets[assetName]?.roles?.includes("baselayer")
|
|
198
|
+
) {
|
|
199
|
+
// to prevent them being removed by date change on main dataset
|
|
200
|
+
assetLayerId = assetName;
|
|
201
|
+
}
|
|
202
|
+
log.debug(`Creating Vector layer from FlatGeoBuf`, assetLayerId);
|
|
203
|
+
// register projection if exists
|
|
204
|
+
const assetProjection =
|
|
205
|
+
/** @type {string | number | {name: string, def: string, extent?:number[]} | undefined} */ (
|
|
206
|
+
assets[assetName]?.["proj:epsg"] ||
|
|
207
|
+
assets[assetName]?.["eodash:proj4_def"]
|
|
208
|
+
);
|
|
209
|
+
await registerProjection(assetProjection);
|
|
210
|
+
const projection = getProjectionCode(assetProjection) || "EPSG:4326";
|
|
211
|
+
// in case we merge them, we pass urls, else just single url
|
|
212
|
+
const urlsObject = {
|
|
213
|
+
url: fgbSource,
|
|
214
|
+
// TODO uncomment this once fgb merging supported on source
|
|
215
|
+
// url: stacObject?.["eodash:merge_assets"] === false ? fgbSource : undefined,
|
|
216
|
+
// urls: stacObject?.["eodash:merge_assets"] !== false ? fgbSources : undefined,
|
|
217
|
+
};
|
|
218
|
+
const layer = {
|
|
219
|
+
type: "Vector",
|
|
220
|
+
source: {
|
|
221
|
+
...urlsObject,
|
|
222
|
+
type: "FlatGeoBuf",
|
|
223
|
+
projection,
|
|
224
|
+
attributions: assets[assetName].attribution,
|
|
225
|
+
},
|
|
226
|
+
properties: {
|
|
227
|
+
id: assetLayerId,
|
|
228
|
+
title: assets[assetName]?.title || title,
|
|
229
|
+
layerDatetime,
|
|
230
|
+
...(layerConfig && {
|
|
231
|
+
layerConfig: {
|
|
232
|
+
...layerConfig,
|
|
233
|
+
style,
|
|
234
|
+
},
|
|
235
|
+
}),
|
|
236
|
+
},
|
|
237
|
+
...(!style?.variables && { style }),
|
|
238
|
+
interactions: [],
|
|
239
|
+
};
|
|
240
|
+
layer.properties = { ...layer.properties, ...(extraProperties ?? {}) };
|
|
241
|
+
extractRoles(layer.properties, assets[assetName]);
|
|
242
|
+
addTooltipInteraction(layer, style);
|
|
243
|
+
jsonArray.push(layer);
|
|
244
|
+
// if we merged assets (default yes), then we can break from this loop
|
|
245
|
+
// TODO uncomment this once fgb merging supported on source
|
|
246
|
+
// if (stacObject?.["eodash:merge_assets"] !== false)
|
|
247
|
+
// break
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (geoTIFFSources.length) {
|
|
252
|
+
for (const [i, geotiffSource] of geoTIFFSources.entries()) {
|
|
253
|
+
const assetName = assetIds[geoTIFFIdx[i]];
|
|
254
|
+
const styles = await fetchStyle(stacObject, undefined, assetName);
|
|
255
|
+
// get the correct style which is not attached to a link
|
|
256
|
+
let { layerConfig, style } = extractLayerConfig(collectionId, styles);
|
|
257
|
+
let assetLayerId = createAssetID(
|
|
258
|
+
collectionId,
|
|
259
|
+
stacObject.id,
|
|
260
|
+
geoTIFFIdx[i],
|
|
261
|
+
);
|
|
262
|
+
if (
|
|
263
|
+
assets[assetName]?.roles?.includes("overlay") ||
|
|
264
|
+
assets[assetName]?.roles?.includes("baselayer")
|
|
265
|
+
) {
|
|
266
|
+
// to prevent them being removed by date change on main dataset
|
|
267
|
+
assetLayerId = assetName;
|
|
268
|
+
}
|
|
269
|
+
log.debug("Creating WebGLTile layer from GeoTIFF", assetLayerId);
|
|
270
|
+
log.debug("Configured Sources", geoTIFFSources);
|
|
271
|
+
const sources =
|
|
272
|
+
stacObject?.["eodash:merge_assets"] !== false
|
|
273
|
+
? geoTIFFSources
|
|
274
|
+
: geotiffSource;
|
|
275
|
+
const layer = {
|
|
276
|
+
type: "WebGLTile",
|
|
277
|
+
source: {
|
|
278
|
+
type: "GeoTIFF",
|
|
279
|
+
normalize: !style,
|
|
280
|
+
interpolate: false,
|
|
281
|
+
sources,
|
|
282
|
+
},
|
|
283
|
+
properties: {
|
|
284
|
+
id: assetLayerId,
|
|
285
|
+
title,
|
|
286
|
+
layerConfig,
|
|
287
|
+
layerDatetime,
|
|
288
|
+
},
|
|
289
|
+
style,
|
|
290
|
+
};
|
|
291
|
+
if (extraProperties) {
|
|
292
|
+
layer.properties = { ...layer.properties, ...extraProperties };
|
|
293
|
+
}
|
|
294
|
+
extractRoles(layer.properties, assets[assetName]);
|
|
295
|
+
addTooltipInteraction(layer, style);
|
|
296
|
+
jsonArray.push(layer);
|
|
297
|
+
if (stacObject?.["eodash:merge_assets"] !== false) break;
|
|
217
298
|
}
|
|
218
|
-
jsonArray.push(layer);
|
|
219
299
|
}
|
|
220
300
|
|
|
221
301
|
return jsonArray;
|
|
@@ -225,17 +305,17 @@ export async function createLayersFromAssets(
|
|
|
225
305
|
* @param {string} collectionId
|
|
226
306
|
* @param {import('stac-ts').StacItem} item
|
|
227
307
|
* @param {string} title
|
|
228
|
-
* @param {string} itemUrl
|
|
229
308
|
* @param {Record<string,any>} [layerDatetime]
|
|
230
309
|
* @param {object | null} [extraProperties]
|
|
310
|
+
* @param {import('stac-ts').StacCollection} [collection]
|
|
231
311
|
*/
|
|
232
312
|
export const createLayersFromLinks = async (
|
|
233
313
|
collectionId,
|
|
234
314
|
title,
|
|
235
315
|
item,
|
|
236
|
-
itemUrl,
|
|
237
316
|
layerDatetime,
|
|
238
317
|
extraProperties,
|
|
318
|
+
collection,
|
|
239
319
|
) => {
|
|
240
320
|
log.debug("Creating layers from links");
|
|
241
321
|
/** @type {Record<string,any>[]} */
|
|
@@ -252,7 +332,6 @@ export const createLayersFromLinks = async (
|
|
|
252
332
|
|
|
253
333
|
for (const wmsLink of wmsArray ?? []) {
|
|
254
334
|
// Registering setting sub wms link projection
|
|
255
|
-
|
|
256
335
|
const wmsLinkProjection =
|
|
257
336
|
/** @type {number | string | {name: string, def: string} | undefined} */
|
|
258
337
|
(wmsLink?.["proj:epsg"] || wmsLink?.["eodash:proj4_def"]);
|
|
@@ -305,8 +384,16 @@ export const createLayersFromLinks = async (
|
|
|
305
384
|
// Expand all dimensions into the params attribute
|
|
306
385
|
Object.assign(json.source.params, wmsLink["wms:dimensions"]);
|
|
307
386
|
}
|
|
387
|
+
if ("wms:styles" in wmsLink) {
|
|
388
|
+
// @ts-expect-error no type for eox-map
|
|
389
|
+
json.source.params["STYLES"] = wmsLink["wms:styles"];
|
|
390
|
+
}
|
|
308
391
|
if (extraProperties !== null) {
|
|
309
|
-
json.properties = {
|
|
392
|
+
json.properties = {
|
|
393
|
+
...json.properties,
|
|
394
|
+
...extraProperties,
|
|
395
|
+
...extractEoxLegendLink(wmsLink),
|
|
396
|
+
};
|
|
310
397
|
}
|
|
311
398
|
jsonArray.push(json);
|
|
312
399
|
}
|
|
@@ -319,6 +406,17 @@ export const createLayersFromLinks = async (
|
|
|
319
406
|
(wmtsLink?.["proj:epsg"] || wmtsLink?.["eodash:proj4_def"]);
|
|
320
407
|
|
|
321
408
|
await registerProjection(wmtsLinkProjection);
|
|
409
|
+
const key =
|
|
410
|
+
/** @type {string | undefined} */ (wmtsLink["key"]) || undefined;
|
|
411
|
+
|
|
412
|
+
const styles = await fetchStyle(item, key);
|
|
413
|
+
// get the correct style which is attached to a link
|
|
414
|
+
const returnedLayerConfig = extractLayerConfig(
|
|
415
|
+
collectionId,
|
|
416
|
+
styles,
|
|
417
|
+
undefined,
|
|
418
|
+
"tileUrl",
|
|
419
|
+
);
|
|
322
420
|
const projectionCode = getProjectionCode(wmtsLinkProjection || "EPSG:3857");
|
|
323
421
|
// TODO: WARNING! This is a temporary project specific implementation
|
|
324
422
|
// that needs to be removed once catalog and wmts creation from capabilities
|
|
@@ -336,6 +434,17 @@ export const createLayersFromLinks = async (
|
|
|
336
434
|
let { style, ...dimensionsWithoutStyle } = { ...dimensions };
|
|
337
435
|
let extractedStyle = /** @type { string } */ (style || "default");
|
|
338
436
|
|
|
437
|
+
// TODO, this does not yet work between layer time changes because we do not get
|
|
438
|
+
// updated variables from OL layer due to usage of tileurlfunction
|
|
439
|
+
|
|
440
|
+
// update dimensions with current value of style variables if applicable
|
|
441
|
+
const variables = returnedLayerConfig?.style?.variables;
|
|
442
|
+
if (variables) {
|
|
443
|
+
for (const [kk, vv] of Object.entries(variables)) {
|
|
444
|
+
dimensionsWithoutStyle[kk] = vv;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
|
|
339
448
|
if (wmtsLink.title === "wmts capabilities") {
|
|
340
449
|
log.debug(
|
|
341
450
|
"Warning: WMTS Layer from capabilities added, function needs to be updated",
|
|
@@ -347,6 +456,7 @@ export const createLayersFromLinks = async (
|
|
|
347
456
|
id: linkId,
|
|
348
457
|
title: title || item.id,
|
|
349
458
|
layerDatetime,
|
|
459
|
+
layerConfig: returnedLayerConfig.layerConfig,
|
|
350
460
|
},
|
|
351
461
|
source: {
|
|
352
462
|
type: "WMTS",
|
|
@@ -393,7 +503,11 @@ export const createLayersFromLinks = async (
|
|
|
393
503
|
}
|
|
394
504
|
extractRoles(json.properties, wmtsLink);
|
|
395
505
|
if (extraProperties !== null) {
|
|
396
|
-
json.properties = {
|
|
506
|
+
json.properties = {
|
|
507
|
+
...json.properties,
|
|
508
|
+
...extraProperties,
|
|
509
|
+
...extractEoxLegendLink(wmtsLink),
|
|
510
|
+
};
|
|
397
511
|
}
|
|
398
512
|
jsonArray.push(json);
|
|
399
513
|
}
|
|
@@ -402,7 +516,22 @@ export const createLayersFromLinks = async (
|
|
|
402
516
|
const xyzLinkProjection =
|
|
403
517
|
/** @type {number | string | {name: string, def: string} | undefined} */
|
|
404
518
|
(xyzLink?.["proj:epsg"] || xyzLink?.["eodash:proj4_def"]);
|
|
405
|
-
|
|
519
|
+
const key = /** @type {string | undefined} */ (xyzLink["key"]) || undefined;
|
|
520
|
+
const rasterformURL = /** @type {string|undefined} */ (
|
|
521
|
+
collection?.["eodash:rasterform"]
|
|
522
|
+
);
|
|
523
|
+
/** @type {import("@/types").EodashRasterJSONForm|undefined} */
|
|
524
|
+
const rasterForm = rasterformURL
|
|
525
|
+
? await axios.get(rasterformURL).then((resp) => resp.data)
|
|
526
|
+
: undefined;
|
|
527
|
+
const styles = await fetchStyle(item, key);
|
|
528
|
+
// get the correct style which is attached to a link
|
|
529
|
+
let { layerConfig, style } = extractLayerConfig(
|
|
530
|
+
collectionId,
|
|
531
|
+
styles,
|
|
532
|
+
rasterForm,
|
|
533
|
+
"tileUrl",
|
|
534
|
+
);
|
|
406
535
|
await registerProjection(xyzLinkProjection);
|
|
407
536
|
const projectionCode = getProjectionCode(xyzLinkProjection || "EPSG:3857");
|
|
408
537
|
const linkId = createLayerID(
|
|
@@ -411,6 +540,22 @@ export const createLayersFromLinks = async (
|
|
|
411
540
|
xyzLink,
|
|
412
541
|
viewProjectionCode,
|
|
413
542
|
);
|
|
543
|
+
let xyzUrl = xyzLink.href;
|
|
544
|
+
|
|
545
|
+
// TODO, this does not yet work between layer time changes because we do not get
|
|
546
|
+
// updated variables from OL layer due to usage of tileurlfunction
|
|
547
|
+
|
|
548
|
+
// update url query params with current value of style variables if applicable
|
|
549
|
+
const variables = style?.variables;
|
|
550
|
+
if (variables) {
|
|
551
|
+
const [base, query] = xyzUrl.split("?");
|
|
552
|
+
const params = new URLSearchParams(query);
|
|
553
|
+
for (const [kk, vv] of Object.entries(variables)) {
|
|
554
|
+
params.set(kk, JSON.stringify(vv));
|
|
555
|
+
}
|
|
556
|
+
xyzUrl = `${base}?${params.toString()}`;
|
|
557
|
+
}
|
|
558
|
+
|
|
414
559
|
log.debug("XYZ Layer added", linkId);
|
|
415
560
|
let json = {
|
|
416
561
|
type: "Tile",
|
|
@@ -419,10 +564,11 @@ export const createLayersFromLinks = async (
|
|
|
419
564
|
title: xyzLink.title || title || item.id,
|
|
420
565
|
roles: xyzLink.roles,
|
|
421
566
|
layerDatetime,
|
|
567
|
+
layerConfig,
|
|
422
568
|
},
|
|
423
569
|
source: {
|
|
424
570
|
type: "XYZ",
|
|
425
|
-
url:
|
|
571
|
+
url: xyzUrl,
|
|
426
572
|
projection: projectionCode,
|
|
427
573
|
attributions: xyzLink.attribution,
|
|
428
574
|
},
|
|
@@ -430,7 +576,11 @@ export const createLayersFromLinks = async (
|
|
|
430
576
|
|
|
431
577
|
extractRoles(json.properties, xyzLink);
|
|
432
578
|
if (extraProperties !== null) {
|
|
433
|
-
json.properties = {
|
|
579
|
+
json.properties = {
|
|
580
|
+
...json.properties,
|
|
581
|
+
...extraProperties,
|
|
582
|
+
...extractEoxLegendLink(xyzLink),
|
|
583
|
+
};
|
|
434
584
|
}
|
|
435
585
|
jsonArray.push(json);
|
|
436
586
|
}
|
|
@@ -454,9 +604,9 @@ export const createLayersFromLinks = async (
|
|
|
454
604
|
const key =
|
|
455
605
|
/** @type {string | undefined} */ (vectorTileLink["key"]) || undefined;
|
|
456
606
|
// fetch styles and separate them by their mapping between links and assets
|
|
457
|
-
const styles = await fetchStyle(item,
|
|
607
|
+
const styles = await fetchStyle(item, key);
|
|
458
608
|
// get the correct style which is not attached to a link
|
|
459
|
-
let { layerConfig, style } = extractLayerConfig(
|
|
609
|
+
let { layerConfig, style } = extractLayerConfig(collectionId, styles);
|
|
460
610
|
|
|
461
611
|
let href = vectorTileLink.href;
|
|
462
612
|
if ("auth:schemes" in item && "auth:refs" in vectorTileLink) {
|
|
@@ -497,7 +647,11 @@ export const createLayersFromLinks = async (
|
|
|
497
647
|
addTooltipInteraction(json, style);
|
|
498
648
|
extractRoles(json.properties, vectorTileLink);
|
|
499
649
|
if (extraProperties !== null) {
|
|
500
|
-
json.properties = {
|
|
650
|
+
json.properties = {
|
|
651
|
+
...json.properties,
|
|
652
|
+
...extraProperties,
|
|
653
|
+
...extractEoxLegendLink(vectorTileLink),
|
|
654
|
+
};
|
|
501
655
|
}
|
|
502
656
|
jsonArray.push(json);
|
|
503
657
|
}
|
|
@@ -509,18 +663,31 @@ export const createLayersFromLinks = async (
|
|
|
509
663
|
* @param {import("stac-ts").StacItem | undefined | null} item
|
|
510
664
|
* @param {string} rasterURL
|
|
511
665
|
* @param {Record<string, any>} [extraProperties]
|
|
512
|
-
* @returns {import("@eox/map/src/layers").EOxLayerType<"Tile","XYZ">[]}
|
|
666
|
+
* @returns {Promise<import("@eox/map/src/layers").EOxLayerType<"Tile","XYZ">[]>}
|
|
513
667
|
*/
|
|
514
|
-
export
|
|
668
|
+
export const createLayerFromRender = async (
|
|
515
669
|
rasterURL,
|
|
516
670
|
collection,
|
|
517
671
|
item,
|
|
518
672
|
extraProperties,
|
|
519
|
-
) {
|
|
673
|
+
) => {
|
|
520
674
|
if (!collection || !collection.renders || !item) {
|
|
521
675
|
return [];
|
|
522
676
|
}
|
|
523
677
|
|
|
678
|
+
const rasterformURL = /** @type {string|undefined} */ (
|
|
679
|
+
collection?.["eodash:rasterform"]
|
|
680
|
+
);
|
|
681
|
+
/** @type {import("@/types").EodashRasterJSONForm|undefined} */
|
|
682
|
+
const rasterForm = rasterformURL
|
|
683
|
+
? await axios.get(rasterformURL).then((resp) => resp.data)
|
|
684
|
+
: undefined;
|
|
685
|
+
let { layerConfig } = extractLayerConfig(
|
|
686
|
+
collection.id,
|
|
687
|
+
await fetchStyle(item),
|
|
688
|
+
rasterForm,
|
|
689
|
+
);
|
|
690
|
+
|
|
524
691
|
const renders = /** @type {Record<string,import("@/types").Render>} */ (
|
|
525
692
|
collection.renders ?? item?.renders
|
|
526
693
|
);
|
|
@@ -571,6 +738,9 @@ export function createLayerFromRender(
|
|
|
571
738
|
title,
|
|
572
739
|
roles: item.roles,
|
|
573
740
|
...extraProperties,
|
|
741
|
+
layerConfig: {
|
|
742
|
+
...layerConfig,
|
|
743
|
+
},
|
|
574
744
|
},
|
|
575
745
|
source: {
|
|
576
746
|
/** @type {"XYZ"} */
|
|
@@ -582,7 +752,7 @@ export function createLayerFromRender(
|
|
|
582
752
|
}
|
|
583
753
|
|
|
584
754
|
return layers;
|
|
585
|
-
}
|
|
755
|
+
};
|
|
586
756
|
/**
|
|
587
757
|
*
|
|
588
758
|
* @param {Record<string,any>} obj
|