@eodash/eodash 5.3.3 → 5.4.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/composables/DefineEodash.js +3 -1
- package/core/client/eodashSTAC/EodashCollection.js +18 -35
- package/core/client/eodashSTAC/createLayers.js +278 -135
- package/core/client/eodashSTAC/helpers.js +53 -40
- package/core/client/eodashSTAC/parquet.js +1 -0
- package/core/client/eodashSTAC/triggers.js +7 -6
- package/core/client/types.ts +3 -1
- package/dist/client/{DashboardLayout-Cp8Rv3Ef.js → DashboardLayout-CQOGHPW_.js} +2 -2
- package/dist/client/{DynamicWebComponent-CBsxC82P.js → DynamicWebComponent-CoLO8FEf.js} +1 -1
- package/dist/client/{EodashDatePicker-Dewym-cx.js → EodashDatePicker-BZeQ6bcu.js} +3 -3
- package/dist/client/{EodashItemFilter-CAsZpOoQ.js → EodashItemFilter-CmZkk7GK.js} +1 -1
- package/dist/client/{EodashLayerControl-fn-rt8Ac.js → EodashLayerControl-D54fY-bX.js} +2 -2
- package/dist/client/{EodashLayoutSwitcher-B9XqQXCS.js → EodashLayoutSwitcher-BCP3FvDb.js} +3 -3
- package/dist/client/{EodashMapBtns-nFY6MIAX.js → EodashMapBtns-D-HulIl1.js} +14 -9
- package/dist/client/{EodashStacInfo-lxBKoav9.js → EodashStacInfo-BZbmT8vT.js} +1 -1
- package/dist/client/{EodashTimeSlider-DI97QkNT.js → EodashTimeSlider-DIcAJr6D.js} +2 -2
- package/dist/client/{EodashTools-D5ShUT1g.js → EodashTools-Cz6X6hsF.js} +4 -4
- package/dist/client/{ExportState-ruNyRS2E.js → ExportState-DFVFAgKz.js} +4 -4
- package/dist/client/{Footer-IQNyfd78.js → Footer-DLzQcjkI.js} +1 -1
- package/dist/client/{Header-BBdi_-Lp.js → Header-_D9Z-zFJ.js} +2 -2
- package/dist/client/{MobileLayout-BfBeF-JF.js → MobileLayout-3Ko9XSfO.js} +2 -2
- package/dist/client/{PopUp-DRgOmD7-.js → PopUp-DwI8V2gW.js} +2 -2
- package/dist/client/{ProcessList-DxyCFQdz.js → ProcessList-C9eAg2Sb.js} +4 -4
- package/dist/client/{VImg-hwmwzSwG.js → VImg-COXTnCWE.js} +2 -2
- package/dist/client/{VMain-vk4-rkw-.js → VMain-C74l1bv-.js} +1 -1
- package/dist/client/{VTooltip-BYUZeia1.js → VTooltip-BLS-cQ9N.js} +2 -2
- package/dist/client/{WidgetsContainer-DXD_8rqh.js → WidgetsContainer-D-VfMRxE.js} +1 -1
- package/dist/client/{asWebComponent-DdguWGDI.js → asWebComponent-Bw03Jutr.js} +304 -181
- package/dist/client/{async-D1MvO_Z_.js → async-D4G-FOIc.js} +13 -3
- package/dist/client/eo-dash.js +1 -1
- package/dist/client/{forwardRefs-DM-E2MfG.js → forwardRefs-CRMFoNYN.js} +2 -2
- package/dist/client/{handling-CbgeKrqT.js → handling-DTAhQuPh.js} +94 -10
- package/dist/client/{helpers-CtUlAW0N.js → helpers-CsjKHAcK.js} +60 -47
- package/dist/client/{index-BJvLt3Xf.js → index-BHilH1qx.js} +17 -13
- package/dist/client/{index-BkW06-Lg.js → index-BIcmbjr0.js} +34 -7
- package/dist/client/{index-BxDh5v-H.js → index-BoCcZ0l4.js} +3 -3
- package/dist/client/{index-DBo0F4Fv.js → index-DEmHaCL3.js} +2 -2
- package/dist/client/templates.js +5 -1
- package/dist/client/{transition-BdzATvPB.js → transition-6MJLK-_H.js} +1 -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 +10 -4
- package/dist/types/core/client/types.d.ts +1 -1
- package/dist/types/widgets/EodashMap/EodashMapBtns.vue.d.ts +2 -0
- package/dist/types/widgets/EodashMap/index.vue.d.ts +2 -0
- package/dist/types/widgets/EodashProcess/methods/handling.d.ts +13 -0
- package/dist/types/widgets/EodashProcess/methods/utils.d.ts +1 -0
- package/package.json +1 -1
- package/templates/expert.js +4 -0
- package/widgets/EodashMap/EodashMapBtns.vue +15 -0
- package/widgets/EodashMap/index.vue +4 -0
- package/widgets/EodashMap/methods/create-layers-config.js +23 -0
- package/widgets/EodashProcess/index.vue +1 -9
- package/widgets/EodashProcess/methods/composables.js +13 -1
- package/widgets/EodashProcess/methods/custom-endpoints/chart/veda-endpoint.js +15 -6
- package/widgets/EodashProcess/methods/handling.js +77 -0
- package/widgets/EodashProcess/methods/utils.js +10 -0
|
@@ -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,179 @@ 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 ? geoTIFFSources : geotiffSource;
|
|
273
|
+
const layer = {
|
|
274
|
+
type: "WebGLTile",
|
|
275
|
+
source: {
|
|
276
|
+
type: "GeoTIFF",
|
|
277
|
+
normalize: !style,
|
|
278
|
+
interpolate: false,
|
|
279
|
+
sources,
|
|
280
|
+
},
|
|
281
|
+
properties: {
|
|
282
|
+
id: assetLayerId,
|
|
283
|
+
title,
|
|
284
|
+
layerConfig,
|
|
285
|
+
layerDatetime,
|
|
286
|
+
},
|
|
287
|
+
style,
|
|
288
|
+
};
|
|
289
|
+
if (extraProperties) {
|
|
290
|
+
layer.properties = { ...layer.properties, ...extraProperties };
|
|
291
|
+
}
|
|
292
|
+
extractRoles(layer.properties, assets[assetName]);
|
|
293
|
+
addTooltipInteraction(layer, style);
|
|
294
|
+
jsonArray.push(layer);
|
|
295
|
+
if (stacObject?.["eodash:merge_assets"] !== false) break;
|
|
217
296
|
}
|
|
218
|
-
jsonArray.push(layer);
|
|
219
297
|
}
|
|
220
298
|
|
|
221
299
|
return jsonArray;
|
|
@@ -225,17 +303,17 @@ export async function createLayersFromAssets(
|
|
|
225
303
|
* @param {string} collectionId
|
|
226
304
|
* @param {import('stac-ts').StacItem} item
|
|
227
305
|
* @param {string} title
|
|
228
|
-
* @param {string} itemUrl
|
|
229
306
|
* @param {Record<string,any>} [layerDatetime]
|
|
230
307
|
* @param {object | null} [extraProperties]
|
|
308
|
+
* @param {import('stac-ts').StacCollection} [collection]
|
|
231
309
|
*/
|
|
232
310
|
export const createLayersFromLinks = async (
|
|
233
311
|
collectionId,
|
|
234
312
|
title,
|
|
235
313
|
item,
|
|
236
|
-
itemUrl,
|
|
237
314
|
layerDatetime,
|
|
238
315
|
extraProperties,
|
|
316
|
+
collection,
|
|
239
317
|
) => {
|
|
240
318
|
log.debug("Creating layers from links");
|
|
241
319
|
/** @type {Record<string,any>[]} */
|
|
@@ -252,7 +330,6 @@ export const createLayersFromLinks = async (
|
|
|
252
330
|
|
|
253
331
|
for (const wmsLink of wmsArray ?? []) {
|
|
254
332
|
// Registering setting sub wms link projection
|
|
255
|
-
|
|
256
333
|
const wmsLinkProjection =
|
|
257
334
|
/** @type {number | string | {name: string, def: string} | undefined} */
|
|
258
335
|
(wmsLink?.["proj:epsg"] || wmsLink?.["eodash:proj4_def"]);
|
|
@@ -305,8 +382,12 @@ export const createLayersFromLinks = async (
|
|
|
305
382
|
// Expand all dimensions into the params attribute
|
|
306
383
|
Object.assign(json.source.params, wmsLink["wms:dimensions"]);
|
|
307
384
|
}
|
|
385
|
+
if ("wms:styles" in wmsLink) {
|
|
386
|
+
// @ts-expect-error no type for eox-map
|
|
387
|
+
json.source.params["STYLES"] = wmsLink["wms:styles"];
|
|
388
|
+
}
|
|
308
389
|
if (extraProperties !== null) {
|
|
309
|
-
json.properties = { ...json.properties, ...extraProperties };
|
|
390
|
+
json.properties = { ...json.properties, ...extraProperties, ...extractEoxLegendLink(wmsLink) };
|
|
310
391
|
}
|
|
311
392
|
jsonArray.push(json);
|
|
312
393
|
}
|
|
@@ -319,6 +400,12 @@ export const createLayersFromLinks = async (
|
|
|
319
400
|
(wmtsLink?.["proj:epsg"] || wmtsLink?.["eodash:proj4_def"]);
|
|
320
401
|
|
|
321
402
|
await registerProjection(wmtsLinkProjection);
|
|
403
|
+
const key =
|
|
404
|
+
/** @type {string | undefined} */ (wmtsLink["key"]) || undefined;
|
|
405
|
+
|
|
406
|
+
const styles = await fetchStyle(item, key);
|
|
407
|
+
// get the correct style which is attached to a link
|
|
408
|
+
const returnedLayerConfig = extractLayerConfig(collectionId, styles, undefined, "tileUrl");
|
|
322
409
|
const projectionCode = getProjectionCode(wmtsLinkProjection || "EPSG:3857");
|
|
323
410
|
// TODO: WARNING! This is a temporary project specific implementation
|
|
324
411
|
// that needs to be removed once catalog and wmts creation from capabilities
|
|
@@ -336,6 +423,17 @@ export const createLayersFromLinks = async (
|
|
|
336
423
|
let { style, ...dimensionsWithoutStyle } = { ...dimensions };
|
|
337
424
|
let extractedStyle = /** @type { string } */ (style || "default");
|
|
338
425
|
|
|
426
|
+
// TODO, this does not yet work between layer time changes because we do not get
|
|
427
|
+
// updated variables from OL layer due to usage of tileurlfunction
|
|
428
|
+
|
|
429
|
+
// update dimensions with current value of style variables if applicable
|
|
430
|
+
const variables = returnedLayerConfig?.style?.variables;
|
|
431
|
+
if (variables) {
|
|
432
|
+
for (const [kk, vv] of Object.entries(variables)) {
|
|
433
|
+
dimensionsWithoutStyle[kk] = vv;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
|
|
339
437
|
if (wmtsLink.title === "wmts capabilities") {
|
|
340
438
|
log.debug(
|
|
341
439
|
"Warning: WMTS Layer from capabilities added, function needs to be updated",
|
|
@@ -347,6 +445,7 @@ export const createLayersFromLinks = async (
|
|
|
347
445
|
id: linkId,
|
|
348
446
|
title: title || item.id,
|
|
349
447
|
layerDatetime,
|
|
448
|
+
layerConfig: returnedLayerConfig.layerConfig,
|
|
350
449
|
},
|
|
351
450
|
source: {
|
|
352
451
|
type: "WMTS",
|
|
@@ -393,7 +492,7 @@ export const createLayersFromLinks = async (
|
|
|
393
492
|
}
|
|
394
493
|
extractRoles(json.properties, wmtsLink);
|
|
395
494
|
if (extraProperties !== null) {
|
|
396
|
-
json.properties = { ...json.properties, ...extraProperties };
|
|
495
|
+
json.properties = { ...json.properties, ...extraProperties, ...extractEoxLegendLink(wmtsLink) };
|
|
397
496
|
}
|
|
398
497
|
jsonArray.push(json);
|
|
399
498
|
}
|
|
@@ -402,7 +501,18 @@ export const createLayersFromLinks = async (
|
|
|
402
501
|
const xyzLinkProjection =
|
|
403
502
|
/** @type {number | string | {name: string, def: string} | undefined} */
|
|
404
503
|
(xyzLink?.["proj:epsg"] || xyzLink?.["eodash:proj4_def"]);
|
|
405
|
-
|
|
504
|
+
const key =
|
|
505
|
+
/** @type {string | undefined} */ (xyzLink["key"]) || undefined;
|
|
506
|
+
const rasterformURL = /** @type {string|undefined} */ (
|
|
507
|
+
collection?.["eodash:rasterform"]
|
|
508
|
+
);
|
|
509
|
+
/** @type {import("@/types").EodashRasterJSONForm|undefined} */
|
|
510
|
+
const rasterForm = rasterformURL
|
|
511
|
+
? await axios.get(rasterformURL).then((resp) => resp.data)
|
|
512
|
+
: undefined;
|
|
513
|
+
const styles = await fetchStyle(item, key);
|
|
514
|
+
// get the correct style which is attached to a link
|
|
515
|
+
let { layerConfig, style } = extractLayerConfig(collectionId, styles, rasterForm, "tileUrl");
|
|
406
516
|
await registerProjection(xyzLinkProjection);
|
|
407
517
|
const projectionCode = getProjectionCode(xyzLinkProjection || "EPSG:3857");
|
|
408
518
|
const linkId = createLayerID(
|
|
@@ -411,6 +521,22 @@ export const createLayersFromLinks = async (
|
|
|
411
521
|
xyzLink,
|
|
412
522
|
viewProjectionCode,
|
|
413
523
|
);
|
|
524
|
+
let xyzUrl = xyzLink.href;
|
|
525
|
+
|
|
526
|
+
// TODO, this does not yet work between layer time changes because we do not get
|
|
527
|
+
// updated variables from OL layer due to usage of tileurlfunction
|
|
528
|
+
|
|
529
|
+
// update url query params with current value of style variables if applicable
|
|
530
|
+
const variables = style?.variables;
|
|
531
|
+
if (variables) {
|
|
532
|
+
const [base, query] = xyzUrl.split("?");
|
|
533
|
+
const params = new URLSearchParams(query);
|
|
534
|
+
for (const [kk, vv] of Object.entries(variables)) {
|
|
535
|
+
params.set(kk, JSON.stringify(vv));
|
|
536
|
+
}
|
|
537
|
+
xyzUrl = `${base}?${params.toString()}`;
|
|
538
|
+
}
|
|
539
|
+
|
|
414
540
|
log.debug("XYZ Layer added", linkId);
|
|
415
541
|
let json = {
|
|
416
542
|
type: "Tile",
|
|
@@ -419,10 +545,11 @@ export const createLayersFromLinks = async (
|
|
|
419
545
|
title: xyzLink.title || title || item.id,
|
|
420
546
|
roles: xyzLink.roles,
|
|
421
547
|
layerDatetime,
|
|
548
|
+
layerConfig,
|
|
422
549
|
},
|
|
423
550
|
source: {
|
|
424
551
|
type: "XYZ",
|
|
425
|
-
url:
|
|
552
|
+
url: xyzUrl,
|
|
426
553
|
projection: projectionCode,
|
|
427
554
|
attributions: xyzLink.attribution,
|
|
428
555
|
},
|
|
@@ -430,7 +557,7 @@ export const createLayersFromLinks = async (
|
|
|
430
557
|
|
|
431
558
|
extractRoles(json.properties, xyzLink);
|
|
432
559
|
if (extraProperties !== null) {
|
|
433
|
-
json.properties = { ...json.properties, ...extraProperties };
|
|
560
|
+
json.properties = { ...json.properties, ...extraProperties, ...extractEoxLegendLink(xyzLink) };
|
|
434
561
|
}
|
|
435
562
|
jsonArray.push(json);
|
|
436
563
|
}
|
|
@@ -454,9 +581,9 @@ export const createLayersFromLinks = async (
|
|
|
454
581
|
const key =
|
|
455
582
|
/** @type {string | undefined} */ (vectorTileLink["key"]) || undefined;
|
|
456
583
|
// fetch styles and separate them by their mapping between links and assets
|
|
457
|
-
const styles = await fetchStyle(item,
|
|
584
|
+
const styles = await fetchStyle(item, key);
|
|
458
585
|
// get the correct style which is not attached to a link
|
|
459
|
-
let { layerConfig, style } = extractLayerConfig(
|
|
586
|
+
let { layerConfig, style } = extractLayerConfig(collectionId, styles);
|
|
460
587
|
|
|
461
588
|
let href = vectorTileLink.href;
|
|
462
589
|
if ("auth:schemes" in item && "auth:refs" in vectorTileLink) {
|
|
@@ -497,7 +624,7 @@ export const createLayersFromLinks = async (
|
|
|
497
624
|
addTooltipInteraction(json, style);
|
|
498
625
|
extractRoles(json.properties, vectorTileLink);
|
|
499
626
|
if (extraProperties !== null) {
|
|
500
|
-
json.properties = { ...json.properties, ...extraProperties };
|
|
627
|
+
json.properties = { ...json.properties, ...extraProperties, ...extractEoxLegendLink(vectorTileLink) };
|
|
501
628
|
}
|
|
502
629
|
jsonArray.push(json);
|
|
503
630
|
}
|
|
@@ -509,18 +636,31 @@ export const createLayersFromLinks = async (
|
|
|
509
636
|
* @param {import("stac-ts").StacItem | undefined | null} item
|
|
510
637
|
* @param {string} rasterURL
|
|
511
638
|
* @param {Record<string, any>} [extraProperties]
|
|
512
|
-
* @returns {import("@eox/map/src/layers").EOxLayerType<"Tile","XYZ">[]}
|
|
639
|
+
* @returns {Promise<import("@eox/map/src/layers").EOxLayerType<"Tile","XYZ">[]>}
|
|
513
640
|
*/
|
|
514
|
-
export
|
|
641
|
+
export const createLayerFromRender = async (
|
|
515
642
|
rasterURL,
|
|
516
643
|
collection,
|
|
517
644
|
item,
|
|
518
645
|
extraProperties,
|
|
519
|
-
) {
|
|
646
|
+
) => {
|
|
520
647
|
if (!collection || !collection.renders || !item) {
|
|
521
648
|
return [];
|
|
522
649
|
}
|
|
523
650
|
|
|
651
|
+
const rasterformURL = /** @type {string|undefined} */ (
|
|
652
|
+
collection?.["eodash:rasterform"]
|
|
653
|
+
);
|
|
654
|
+
/** @type {import("@/types").EodashRasterJSONForm|undefined} */
|
|
655
|
+
const rasterForm = rasterformURL
|
|
656
|
+
? await axios.get(rasterformURL).then((resp) => resp.data)
|
|
657
|
+
: undefined;
|
|
658
|
+
let { layerConfig } = extractLayerConfig(
|
|
659
|
+
collection.id,
|
|
660
|
+
await fetchStyle(item),
|
|
661
|
+
rasterForm,
|
|
662
|
+
);
|
|
663
|
+
|
|
524
664
|
const renders = /** @type {Record<string,import("@/types").Render>} */ (
|
|
525
665
|
collection.renders ?? item?.renders
|
|
526
666
|
);
|
|
@@ -571,6 +711,9 @@ export function createLayerFromRender(
|
|
|
571
711
|
title,
|
|
572
712
|
roles: item.roles,
|
|
573
713
|
...extraProperties,
|
|
714
|
+
layerConfig: {
|
|
715
|
+
...layerConfig,
|
|
716
|
+
},
|
|
574
717
|
},
|
|
575
718
|
source: {
|
|
576
719
|
/** @type {"XYZ"} */
|