@eodash/eodash 5.7.0 → 5.7.1
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/components/EodashOverlay.vue +27 -4
- package/core/client/composables/DefineEodash.js +0 -1
- package/core/client/composables/DefineWidgets.js +3 -1
- package/core/client/eodashSTAC/EodashCollection.js +74 -20
- package/core/client/eodashSTAC/cql.js +64 -0
- package/core/client/eodashSTAC/createLayers.js +169 -116
- package/core/client/eodashSTAC/helpers.js +391 -98
- package/core/client/eodashSTAC/mosaic.js +416 -0
- package/core/client/plugins/axios.js +31 -1
- package/core/client/store/actions.js +1 -1
- package/core/client/store/stac.js +25 -4
- package/core/client/store/states.js +20 -2
- package/core/client/types.ts +147 -28
- package/core/client/utils/bands-editor/exampleSchema.json +50 -50
- package/core/client/utils/states.js +10 -0
- package/dist/client/{DashboardLayout-kRsmsNW5.js → DashboardLayout-ePbdvUTE.js} +2 -2
- package/dist/client/{DynamicWebComponent-CnKhYo0K.js → DynamicWebComponent-g5SdRbjY.js} +1 -1
- package/dist/client/{EodashChart-CLDqE93C.js → EodashChart-ChrkA5oS.js} +7 -6
- package/dist/client/{EodashDatePicker-CMPDT-ce.js → EodashDatePicker-CY1TrsDo.js} +3 -3
- package/dist/client/{EodashItemFilter-BpdA8QQa.js → EodashItemFilter-DzshHDlS.js} +2 -1
- package/dist/client/{EodashLayerControl-BHpDA4_0.js → EodashLayerControl-DMCeMkSd.js} +50 -20
- package/dist/client/{EodashLayoutSwitcher-B1fRUt7G.js → EodashLayoutSwitcher-iJ8mX1rF.js} +3 -3
- package/dist/client/{EodashMapBtns-Cpned0tc.js → EodashMapBtns-C7Cr7q5Y.js} +200 -86
- package/dist/client/EodashStacInfo-K7-iuXa7.js +169 -0
- package/dist/client/{EodashTools-1zHz26gv.js → EodashTools-BEK7e7JM.js} +4 -4
- package/dist/client/{ExportState-DbOm8hBI.js → ExportState-CqIzfMYQ.js} +6 -168
- package/dist/client/{Footer-BKg-VVkj.js → Footer-1P0cmBOZ.js} +1 -1
- package/dist/client/{Header-DCrwCvmY.js → Header-CkkBaBNh.js} +2 -2
- package/dist/client/{MobileLayout-vWSHpluo.js → MobileLayout-BPf49kDU.js} +2 -2
- package/dist/client/{PopUp-9uimfK49.js → PopUp-DPZq5SWI.js} +4 -168
- package/dist/client/{ProcessList-CTTIZa06.js → ProcessList-DuI6WpS1.js} +5 -5
- package/dist/client/VDivider-Bj9LG_JV.js +168 -0
- package/dist/client/{VImg-CrmB76ZY.js → VImg-Ddv5OyMz.js} +2 -2
- package/dist/client/{VMain-OKZNpcEG.js → VMain-7yqk_qC3.js} +1 -1
- package/dist/client/{VTooltip-CJw2FyWk.js → VTooltip-2hAJyEoa.js} +2 -2
- package/dist/client/{WidgetsContainer-BaWOnE5R.js → WidgetsContainer-2DOrlwCB.js} +1 -1
- package/dist/client/{asWebComponent-BHWpMuE3.js → asWebComponent-BlFN2lkB.js} +456 -306
- package/dist/client/{async-DSKj6g1f.js → async-B2H8ZwUK.js} +2 -2
- package/dist/client/{create-layers-config-CBoYedqB.js → create-layers-config-u_vn5hPk.js} +17 -17
- package/dist/client/dialog-transition-BrMkMiNa.js +170 -0
- package/dist/client/eo-dash.js +1 -1
- package/dist/client/{forwardRefs-DH51zPUr.js → forwardRefs-DAlror6d.js} +8 -87
- package/dist/client/{handling-BrcDDlgS.js → handling-B6I1V5eG.js} +3 -3
- package/dist/client/{helpers-DjZVl_WF.js → helpers-CBqIUSXJ.js} +794 -182
- package/dist/client/index-BWq1ZKaV.js +3168 -0
- package/dist/client/{index-CUjl-ZsI.js → index-CJ9UI3ln.js} +2 -2
- package/dist/client/{index-CSG_JoOA.js → index-DXLz4sFR.js} +62 -56
- package/dist/client/{index-1JKE68n3.js → index-DhKU6KqM.js} +211 -67
- package/dist/client/{index-Cu3-13Xg.js → index-DjQlbWbJ.js} +7 -6
- package/dist/client/mosaic-BFYLEwyx.js +455 -0
- package/dist/client/templates.js +250 -119
- package/dist/client/{transition-OHcz5Qq1.js → transition-D_W6Wn9v.js} +1 -1
- package/dist/node/cli.js +5 -5
- package/dist/node/types.d.ts +4 -0
- package/dist/types/core/client/composables/DefineEodash.d.ts +1 -1
- package/dist/types/core/client/eodashSTAC/EodashCollection.d.ts +57 -25
- package/dist/types/core/client/eodashSTAC/cql.d.ts +15 -0
- package/dist/types/core/client/eodashSTAC/createLayers.d.ts +42 -23
- package/dist/types/core/client/eodashSTAC/helpers.d.ts +77 -18
- package/dist/types/core/client/eodashSTAC/mosaic.d.ts +56 -0
- package/dist/types/core/client/store/stac.d.ts +31 -7
- package/dist/types/core/client/store/states.d.ts +24 -2
- package/dist/types/core/client/types.d.ts +123 -24
- package/dist/types/core/client/utils/states.d.ts +12 -0
- package/dist/types/templates/baseConfig.d.ts +1 -100
- package/dist/types/templates/compare.d.ts +32 -3
- package/dist/types/templates/expert.d.ts +18 -0
- package/dist/types/templates/explore.d.ts +9 -1
- package/dist/types/templates/lite.d.ts +11 -0
- package/dist/types/widgets/EodashChart.vue.d.ts +5 -3
- package/dist/types/widgets/EodashItemCatalog/index.vue.d.ts +129 -2
- package/dist/types/widgets/EodashItemCatalog/methods/filters.d.ts +28 -6
- package/dist/types/widgets/EodashItemCatalog/methods/handlers.d.ts +17 -4
- package/dist/types/widgets/EodashItemCatalog/methods/map.d.ts +16 -4
- package/dist/types/widgets/EodashLayerControl.vue.d.ts +35 -16
- package/dist/types/widgets/EodashMap/EodashMapBtns.vue.d.ts +14 -10
- package/dist/types/widgets/EodashMap/index.vue.d.ts +86 -37
- package/dist/types/widgets/EodashMap/methods/create-layers-config.d.ts +1 -1
- package/dist/types/widgets/EodashMap/methods/index.d.ts +5 -1
- package/dist/types/widgets/EodashMap/methods/use-map-loading.d.ts +1 -0
- package/dist/types/widgets/EodashProcess/index.vue.d.ts +5 -3
- package/dist/types/widgets/EodashProcess/states.d.ts +1 -1
- package/dist/types/widgets/EodashStacInfo.vue.d.ts +20 -0
- package/dist/types/widgets/EodashTimeSlider/index.vue.d.ts +20 -0
- package/dist/types/widgets/EodashTimeSlider/methods/index.d.ts +3 -8
- package/dist/types/widgets/EodashTimeSlider/types.d.ts +6 -16
- package/dist/types/widgets/EodashTools.vue.d.ts +5 -5
- package/package.json +33 -33
- package/templates/baseConfig.js +36 -6
- package/templates/compare.js +62 -7
- package/templates/expert.js +23 -0
- package/templates/explore.js +11 -5
- package/templates/lite.js +14 -0
- package/widgets/EodashChart.vue +1 -0
- package/widgets/EodashItemCatalog/index.vue +363 -35
- package/widgets/EodashItemCatalog/methods/filters.js +134 -70
- package/widgets/EodashItemCatalog/methods/handlers.js +113 -19
- package/widgets/EodashItemCatalog/methods/map.js +142 -28
- package/widgets/EodashLayerControl.vue +42 -11
- package/widgets/EodashMap/EodashMapBtns.vue +109 -48
- package/widgets/EodashMap/index.vue +89 -105
- package/widgets/EodashMap/methods/btns.js +37 -5
- package/widgets/EodashMap/methods/create-layers-config.js +16 -16
- package/widgets/EodashMap/methods/index.js +71 -8
- package/widgets/EodashMap/methods/use-map-loading.js +52 -0
- package/widgets/EodashProcess/index.vue +1 -0
- package/widgets/EodashProcess/states.js +1 -1
- package/widgets/EodashStacInfo.vue +64 -2
- package/widgets/EodashTimeSlider/index.vue +58 -2
- package/widgets/EodashTimeSlider/methods/index.js +5 -48
- package/widgets/EodashTimeSlider/types.ts +7 -17
- package/dist/client/EodashStacInfo-BQspAHKH.js +0 -107
- package/dist/client/index-5Jhsa8Xe.js +0 -570
|
@@ -12,6 +12,10 @@ import {
|
|
|
12
12
|
extractEoxLegendLink,
|
|
13
13
|
addTooltipInteraction,
|
|
14
14
|
fetchStyle,
|
|
15
|
+
resolveStyle,
|
|
16
|
+
getBandsProperty,
|
|
17
|
+
applyTitilerUpscaling,
|
|
18
|
+
encodeURLObject,
|
|
15
19
|
} from "./helpers";
|
|
16
20
|
import { handleAuthenticationOfLink } from "./auth";
|
|
17
21
|
import log from "loglevel";
|
|
@@ -41,6 +45,7 @@ function buildCapabilitiesUrl(href) {
|
|
|
41
45
|
* @param {import("stac-ts").StacItem | import("stac-ts").StacCollection } stacObject
|
|
42
46
|
* @param {Record<string, unknown>} [layerDatetime]
|
|
43
47
|
* @param {object | null} [extraProperties]
|
|
48
|
+
* @param {import("stac-ts").StacCollection | null} [collection] - Used to fall back to a collection-level style link.
|
|
44
49
|
**/
|
|
45
50
|
export async function createLayersFromAssets(
|
|
46
51
|
collectionId,
|
|
@@ -49,6 +54,7 @@ export async function createLayersFromAssets(
|
|
|
49
54
|
stacObject,
|
|
50
55
|
layerDatetime,
|
|
51
56
|
extraProperties,
|
|
57
|
+
collection,
|
|
52
58
|
) {
|
|
53
59
|
log.debug("Creating layers from assets");
|
|
54
60
|
const jsonArray = [];
|
|
@@ -60,18 +66,35 @@ export async function createLayersFromAssets(
|
|
|
60
66
|
|
|
61
67
|
const fgbIdx = [];
|
|
62
68
|
const fgbSources = [];
|
|
69
|
+
const zarrAssetIds = [];
|
|
70
|
+
const zarrIdx = [];
|
|
63
71
|
const assetIds = [];
|
|
64
72
|
|
|
65
73
|
for (const [idx, assetId] of Object.keys(assets).entries()) {
|
|
66
74
|
assetIds.push(assetId);
|
|
67
75
|
|
|
68
|
-
if (
|
|
76
|
+
if (
|
|
77
|
+
assets[assetId]?.type?.includes("application/geo+json") &&
|
|
78
|
+
assets[assetId]?.href?.includes("http")
|
|
79
|
+
) {
|
|
69
80
|
geoJsonSources.push(assets[assetId].href);
|
|
70
81
|
geoJsonIdx.push(idx);
|
|
71
|
-
} else if (
|
|
82
|
+
} else if (
|
|
83
|
+
assets[assetId]?.type?.includes("application/vnd.flatgeobuf") &&
|
|
84
|
+
assets[assetId]?.href?.includes("http")
|
|
85
|
+
) {
|
|
72
86
|
fgbSources.push(assets[assetId].href);
|
|
73
87
|
fgbIdx.push(idx);
|
|
74
|
-
} else if (
|
|
88
|
+
} else if (
|
|
89
|
+
assets[assetId]?.type ==
|
|
90
|
+
"application/vnd.zarr; version=3; profile=multiscales"
|
|
91
|
+
) {
|
|
92
|
+
zarrAssetIds.push(assetId);
|
|
93
|
+
zarrIdx.push(idx);
|
|
94
|
+
} else if (
|
|
95
|
+
assets[assetId]?.type?.includes("image/tiff") &&
|
|
96
|
+
assets[assetId]?.href?.includes("http")
|
|
97
|
+
) {
|
|
75
98
|
geoTIFFIdx.push(idx);
|
|
76
99
|
geoTIFFSources.push({
|
|
77
100
|
url: assets[assetId].href,
|
|
@@ -79,7 +102,7 @@ export async function createLayersFromAssets(
|
|
|
79
102
|
? { attributions: assets[assetId].attribution }
|
|
80
103
|
: {}),
|
|
81
104
|
});
|
|
82
|
-
} else if (assets[assetId]?.type
|
|
105
|
+
} else if (assets[assetId]?.type?.includes("application/geodb+json")) {
|
|
83
106
|
const responseData = await (await fetch(assets[assetId].href)).json();
|
|
84
107
|
geoJsonIdx.push(idx);
|
|
85
108
|
if (
|
|
@@ -140,11 +163,122 @@ export async function createLayersFromAssets(
|
|
|
140
163
|
}
|
|
141
164
|
}
|
|
142
165
|
|
|
166
|
+
if (geoTIFFSources.length) {
|
|
167
|
+
for (const [i, geotiffSource] of geoTIFFSources.entries()) {
|
|
168
|
+
const assetName = assetIds[geoTIFFIdx[i]];
|
|
169
|
+
const styles = await resolveStyle(
|
|
170
|
+
stacObject,
|
|
171
|
+
collection,
|
|
172
|
+
undefined,
|
|
173
|
+
assetName,
|
|
174
|
+
);
|
|
175
|
+
// get the correct style which is not attached to a link
|
|
176
|
+
let { layerConfig, style } = extractLayerConfig(collectionId, styles);
|
|
177
|
+
let assetLayerId = createAssetID(
|
|
178
|
+
collectionId,
|
|
179
|
+
stacObject.id,
|
|
180
|
+
geoTIFFIdx[i],
|
|
181
|
+
);
|
|
182
|
+
if (
|
|
183
|
+
assets[assetName]?.roles?.includes("overlay") ||
|
|
184
|
+
assets[assetName]?.roles?.includes("baselayer")
|
|
185
|
+
) {
|
|
186
|
+
// to prevent them being removed by date change on main dataset
|
|
187
|
+
assetLayerId = assetName;
|
|
188
|
+
}
|
|
189
|
+
log.debug("Creating WebGLTile layer from GeoTIFF", assetLayerId);
|
|
190
|
+
log.debug("Configured Sources", geoTIFFSources);
|
|
191
|
+
const sources =
|
|
192
|
+
stacObject?.["eodash:merge_assets"] !== false
|
|
193
|
+
? geoTIFFSources
|
|
194
|
+
: [geotiffSource];
|
|
195
|
+
const layer = {
|
|
196
|
+
type: "WebGLTile",
|
|
197
|
+
source: {
|
|
198
|
+
type: "GeoTIFF",
|
|
199
|
+
normalize: !style,
|
|
200
|
+
interpolate: false,
|
|
201
|
+
sources,
|
|
202
|
+
},
|
|
203
|
+
properties: {
|
|
204
|
+
id: assetLayerId,
|
|
205
|
+
title: assets[assetName]?.title || title,
|
|
206
|
+
layerConfig,
|
|
207
|
+
layerDatetime,
|
|
208
|
+
},
|
|
209
|
+
style,
|
|
210
|
+
};
|
|
211
|
+
if (extraProperties) {
|
|
212
|
+
layer.properties = { ...layer.properties, ...extraProperties };
|
|
213
|
+
}
|
|
214
|
+
extractRoles(layer.properties, assets[assetName]);
|
|
215
|
+
addTooltipInteraction(layer, style);
|
|
216
|
+
jsonArray.push(layer);
|
|
217
|
+
if (stacObject?.["eodash:merge_assets"] !== false) break;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
if (zarrAssetIds.length) {
|
|
222
|
+
for (const [i, assetName] of zarrAssetIds.entries()) {
|
|
223
|
+
const fetchedStyle = await resolveStyle(
|
|
224
|
+
stacObject,
|
|
225
|
+
collection,
|
|
226
|
+
undefined,
|
|
227
|
+
assetName,
|
|
228
|
+
);
|
|
229
|
+
const { layerConfig, style } = extractLayerConfig(
|
|
230
|
+
collectionId,
|
|
231
|
+
fetchedStyle,
|
|
232
|
+
);
|
|
233
|
+
const bandsPath = getBandsProperty(layerConfig?.schema);
|
|
234
|
+
const defaultBands = bandsPath?.reduce(
|
|
235
|
+
(node, key) => node?.[key],
|
|
236
|
+
layerConfig?.schema,
|
|
237
|
+
)?.default ?? ["b04", "b03", "b02"];
|
|
238
|
+
|
|
239
|
+
let assetLayerId = createAssetID(collectionId, stacObject.id, zarrIdx[i]);
|
|
240
|
+
if (
|
|
241
|
+
assets[assetName]?.roles?.includes("overlay") ||
|
|
242
|
+
assets[assetName]?.roles?.includes("baselayer")
|
|
243
|
+
) {
|
|
244
|
+
assetLayerId = assetName;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
log.debug("Creating WebGLTile layer from GeoZarr", assetLayerId);
|
|
248
|
+
|
|
249
|
+
const layer = {
|
|
250
|
+
type: "WebGLTile",
|
|
251
|
+
properties: {
|
|
252
|
+
id: assetLayerId,
|
|
253
|
+
title: assets[assetName]?.title || title,
|
|
254
|
+
layerConfig,
|
|
255
|
+
layerDatetime,
|
|
256
|
+
},
|
|
257
|
+
source: {
|
|
258
|
+
type: "GeoZarr",
|
|
259
|
+
url: assets[assetName].href,
|
|
260
|
+
bands: defaultBands,
|
|
261
|
+
},
|
|
262
|
+
...(style ? { style } : {}),
|
|
263
|
+
};
|
|
264
|
+
if (extraProperties) {
|
|
265
|
+
layer.properties = { ...layer.properties, ...extraProperties };
|
|
266
|
+
}
|
|
267
|
+
extractRoles(layer.properties, assets[assetName]);
|
|
268
|
+
jsonArray.push(layer);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
143
272
|
if (geoJsonSources.length) {
|
|
144
273
|
for (const [i, geoJsonSource] of geoJsonSources.entries()) {
|
|
145
274
|
// fetch styles and separate them by their mapping between links and assets
|
|
146
275
|
const assetName = assetIds[geoJsonIdx[i]];
|
|
147
|
-
const styles = await
|
|
276
|
+
const styles = await resolveStyle(
|
|
277
|
+
stacObject,
|
|
278
|
+
collection,
|
|
279
|
+
undefined,
|
|
280
|
+
assetName,
|
|
281
|
+
);
|
|
148
282
|
// get the correct style which is not attached to a link
|
|
149
283
|
let { layerConfig, style } = extractLayerConfig(collectionId, styles);
|
|
150
284
|
let assetLayerId = createAssetID(
|
|
@@ -210,7 +344,12 @@ export async function createLayersFromAssets(
|
|
|
210
344
|
for (const [i, fgbSource] of fgbSources.entries()) {
|
|
211
345
|
// fetch styles and separate them by their mapping between links and assets
|
|
212
346
|
const assetName = assetIds[fgbIdx[i]];
|
|
213
|
-
const styles = await
|
|
347
|
+
const styles = await resolveStyle(
|
|
348
|
+
stacObject,
|
|
349
|
+
collection,
|
|
350
|
+
undefined,
|
|
351
|
+
assetName,
|
|
352
|
+
);
|
|
214
353
|
// get the correct style which is not attached to a link
|
|
215
354
|
let { layerConfig, style } = extractLayerConfig(collectionId, styles);
|
|
216
355
|
let assetLayerId = createAssetID(collectionId, stacObject.id, fgbIdx[i]);
|
|
@@ -270,56 +409,6 @@ export async function createLayersFromAssets(
|
|
|
270
409
|
}
|
|
271
410
|
}
|
|
272
411
|
|
|
273
|
-
if (geoTIFFSources.length) {
|
|
274
|
-
for (const [i, geotiffSource] of geoTIFFSources.entries()) {
|
|
275
|
-
const assetName = assetIds[geoTIFFIdx[i]];
|
|
276
|
-
const styles = await fetchStyle(stacObject, undefined, assetName);
|
|
277
|
-
// get the correct style which is not attached to a link
|
|
278
|
-
let { layerConfig, style } = extractLayerConfig(collectionId, styles);
|
|
279
|
-
let assetLayerId = createAssetID(
|
|
280
|
-
collectionId,
|
|
281
|
-
stacObject.id,
|
|
282
|
-
geoTIFFIdx[i],
|
|
283
|
-
);
|
|
284
|
-
if (
|
|
285
|
-
assets[assetName]?.roles?.includes("overlay") ||
|
|
286
|
-
assets[assetName]?.roles?.includes("baselayer")
|
|
287
|
-
) {
|
|
288
|
-
// to prevent them being removed by date change on main dataset
|
|
289
|
-
assetLayerId = assetName;
|
|
290
|
-
}
|
|
291
|
-
log.debug("Creating WebGLTile layer from GeoTIFF", assetLayerId);
|
|
292
|
-
log.debug("Configured Sources", geoTIFFSources);
|
|
293
|
-
const sources =
|
|
294
|
-
stacObject?.["eodash:merge_assets"] !== false
|
|
295
|
-
? geoTIFFSources
|
|
296
|
-
: [geotiffSource];
|
|
297
|
-
const layer = {
|
|
298
|
-
type: "WebGLTile",
|
|
299
|
-
source: {
|
|
300
|
-
type: "GeoTIFF",
|
|
301
|
-
normalize: !style,
|
|
302
|
-
interpolate: false,
|
|
303
|
-
sources,
|
|
304
|
-
},
|
|
305
|
-
properties: {
|
|
306
|
-
id: assetLayerId,
|
|
307
|
-
title: assets[assetName]?.title || title,
|
|
308
|
-
layerConfig,
|
|
309
|
-
layerDatetime,
|
|
310
|
-
},
|
|
311
|
-
style,
|
|
312
|
-
};
|
|
313
|
-
if (extraProperties) {
|
|
314
|
-
layer.properties = { ...layer.properties, ...extraProperties };
|
|
315
|
-
}
|
|
316
|
-
extractRoles(layer.properties, assets[assetName]);
|
|
317
|
-
addTooltipInteraction(layer, style);
|
|
318
|
-
jsonArray.push(layer);
|
|
319
|
-
if (stacObject?.["eodash:merge_assets"] !== false) break;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
|
|
323
412
|
return jsonArray;
|
|
324
413
|
}
|
|
325
414
|
|
|
@@ -441,7 +530,7 @@ export const createLayersFromLinks = async (
|
|
|
441
530
|
const key =
|
|
442
531
|
/** @type {string | undefined} */ (wmtsLink["key"]) || undefined;
|
|
443
532
|
|
|
444
|
-
const styles = await
|
|
533
|
+
const styles = await resolveStyle(item, collection, key);
|
|
445
534
|
// get the correct style which is attached to a link
|
|
446
535
|
const returnedLayerConfig = extractLayerConfig(
|
|
447
536
|
collectionId,
|
|
@@ -554,7 +643,7 @@ export const createLayersFromLinks = async (
|
|
|
554
643
|
const rasterForm = rasterformURL
|
|
555
644
|
? await axios.get(rasterformURL).then((resp) => resp.data)
|
|
556
645
|
: undefined;
|
|
557
|
-
const styles = await
|
|
646
|
+
const styles = await resolveStyle(item, collection, key);
|
|
558
647
|
// get the correct style which is attached to a link
|
|
559
648
|
let { layerConfig, style } = extractLayerConfig(
|
|
560
649
|
collectionId,
|
|
@@ -571,7 +660,6 @@ export const createLayersFromLinks = async (
|
|
|
571
660
|
viewProjectionCode,
|
|
572
661
|
);
|
|
573
662
|
let xyzUrl = xyzLink.href;
|
|
574
|
-
|
|
575
663
|
// TODO, this does not yet work between layer time changes because we do not get
|
|
576
664
|
// updated variables from OL layer due to usage of tileurlfunction
|
|
577
665
|
|
|
@@ -585,11 +673,14 @@ export const createLayersFromLinks = async (
|
|
|
585
673
|
}
|
|
586
674
|
xyzUrl = `${base}?${params.toString()}`;
|
|
587
675
|
}
|
|
588
|
-
|
|
589
676
|
const { supportedUpscalingEndpoints } = useSTAcStore();
|
|
590
|
-
const
|
|
591
|
-
|
|
677
|
+
const upscaling = applyTitilerUpscaling(
|
|
678
|
+
xyzUrl,
|
|
679
|
+
supportedUpscalingEndpoints,
|
|
592
680
|
);
|
|
681
|
+
if (upscaling) {
|
|
682
|
+
xyzUrl = upscaling.url;
|
|
683
|
+
}
|
|
593
684
|
|
|
594
685
|
// Add sharding for s2maps automatically
|
|
595
686
|
if (xyzUrl.includes("s2maps-tiles.eu")) {
|
|
@@ -608,15 +699,15 @@ export const createLayersFromLinks = async (
|
|
|
608
699
|
},
|
|
609
700
|
source: {
|
|
610
701
|
type: "XYZ",
|
|
611
|
-
url:
|
|
702
|
+
url: xyzUrl,
|
|
612
703
|
projection: projectionCode,
|
|
613
704
|
...(xyzLink.attribution ? { attributions: xyzLink.attribution } : {}),
|
|
614
705
|
},
|
|
615
706
|
};
|
|
616
|
-
if (
|
|
707
|
+
if (upscaling) {
|
|
617
708
|
// @ts-expect-error tileGrid is added here and supported in eox-map layer definition
|
|
618
709
|
json.source.tileGrid = {
|
|
619
|
-
tileSize:
|
|
710
|
+
tileSize: upscaling.tileSize,
|
|
620
711
|
};
|
|
621
712
|
}
|
|
622
713
|
if (
|
|
@@ -659,7 +750,7 @@ export const createLayersFromLinks = async (
|
|
|
659
750
|
const key =
|
|
660
751
|
/** @type {string | undefined} */ (vectorTileLink["key"]) || undefined;
|
|
661
752
|
// fetch styles and separate them by their mapping between links and assets
|
|
662
|
-
const styles = await
|
|
753
|
+
const styles = await resolveStyle(item, collection, key);
|
|
663
754
|
// get the correct style which is not attached to a link
|
|
664
755
|
let { layerConfig, style } = extractLayerConfig(collectionId, styles);
|
|
665
756
|
|
|
@@ -745,7 +836,7 @@ export const createLayersFromLinks = async (
|
|
|
745
836
|
),
|
|
746
837
|
applyOptions,
|
|
747
838
|
);
|
|
748
|
-
applyOptions = /** @type {
|
|
839
|
+
applyOptions = /** @type {object} */ (optionsObject);
|
|
749
840
|
href = url;
|
|
750
841
|
}
|
|
751
842
|
const json = {
|
|
@@ -795,6 +886,17 @@ export const createLayerFromRender = async (
|
|
|
795
886
|
return [];
|
|
796
887
|
}
|
|
797
888
|
|
|
889
|
+
// Skip when an explicit xyz link already targets the collection on the same endpoint
|
|
890
|
+
const hasMatchingXyzLink = item.links?.some(
|
|
891
|
+
(link) =>
|
|
892
|
+
link.rel === "xyz" &&
|
|
893
|
+
link.href?.includes(rasterURL) &&
|
|
894
|
+
link.href?.includes(`/collections/${collection.id}/`),
|
|
895
|
+
);
|
|
896
|
+
if (hasMatchingXyzLink) {
|
|
897
|
+
return [];
|
|
898
|
+
}
|
|
899
|
+
|
|
798
900
|
const rasterformURL = /** @type {string|undefined} */ (
|
|
799
901
|
collection?.["eodash:rasterform"]
|
|
800
902
|
);
|
|
@@ -873,52 +975,3 @@ export const createLayerFromRender = async (
|
|
|
873
975
|
|
|
874
976
|
return layers;
|
|
875
977
|
};
|
|
876
|
-
/**
|
|
877
|
-
*
|
|
878
|
-
* @param {Record<string,any>} obj
|
|
879
|
-
* @returns {string}
|
|
880
|
-
*/
|
|
881
|
-
function encodeURLObject(obj) {
|
|
882
|
-
let str = "";
|
|
883
|
-
for (const key in obj) {
|
|
884
|
-
const value = obj[key];
|
|
885
|
-
if (value === null || value === undefined || value === "") {
|
|
886
|
-
continue;
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
const valueType = Array.isArray(value) ? "array" : typeof value;
|
|
890
|
-
|
|
891
|
-
switch (valueType) {
|
|
892
|
-
case "array": {
|
|
893
|
-
// Check if any element in the array is itself an array (multi-dimensional)
|
|
894
|
-
const hasNestedArrays = value.some((/** @type {any} */ item) =>
|
|
895
|
-
Array.isArray(item),
|
|
896
|
-
);
|
|
897
|
-
|
|
898
|
-
if (hasNestedArrays) {
|
|
899
|
-
// For multi-dimensional arrays, repeat the key with different values
|
|
900
|
-
for (const val of value) {
|
|
901
|
-
if (Array.isArray(val)) {
|
|
902
|
-
str += `${key}=${val.join(",")}&`;
|
|
903
|
-
} else {
|
|
904
|
-
str += `${key}=${val}&`;
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
} else {
|
|
908
|
-
// For simple arrays, join with commas
|
|
909
|
-
str += `${key}=${value.join(",")}&`;
|
|
910
|
-
}
|
|
911
|
-
break;
|
|
912
|
-
}
|
|
913
|
-
case "object": {
|
|
914
|
-
str += `${key}=${encodeURI(JSON.stringify(value))}&`;
|
|
915
|
-
break;
|
|
916
|
-
}
|
|
917
|
-
default: {
|
|
918
|
-
str += `${key}=${encodeURIComponent(value)}&`;
|
|
919
|
-
break;
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
}
|
|
923
|
-
return str;
|
|
924
|
-
}
|