@eox/layercontrol 1.8.2 → 1.9.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/dist/blosc-JROzDOnd.js +692 -0
- package/dist/chunk-INHXZS53-CsrPGdTf.js +13 -0
- package/dist/eox-layercontrol.js +47418 -3593
- package/dist/eox-layercontrol.umd.cjs +1351 -173
- package/dist/lz4-CUYSbVey.js +626 -0
- package/dist/zstd-YMzMcush.js +583 -0
- package/package.json +3 -3
- package/src/enums/stories/index.js +6 -2
- package/src/helpers/get-start-vals.js +36 -2
- package/src/helpers/handle-datetime-update.js +11 -0
- package/src/methods/layer/first-updated.js +7 -1
- package/src/methods/layer-config/apply-updated-styles.js +40 -12
- package/types/enums/stories/index.d.ts +6 -0
- package/types/enums/stories/index.d.ts.map +1 -1
- package/types/helpers/get-start-vals.d.ts +2 -1
- package/types/helpers/get-start-vals.d.ts.map +1 -1
- package/types/helpers/handle-datetime-update.d.ts.map +1 -1
- package/types/methods/layer/first-updated.d.ts.map +1 -1
- package/types/methods/layer-config/apply-updated-styles.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eox/layercontrol",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"@eox/map": "*",
|
|
12
12
|
"@types/lodash.throttle": "^4.1.9",
|
|
13
13
|
"@types/sortablejs": "^1.15.1",
|
|
14
|
-
"ol": "^10.
|
|
15
|
-
"vite": "^8.
|
|
14
|
+
"ol": "^10.10.0",
|
|
15
|
+
"vite": "^8.2.2"
|
|
16
16
|
},
|
|
17
17
|
"engines": {
|
|
18
18
|
"npm": ">=8.0.0",
|
|
@@ -12,6 +12,7 @@ const LAYER_EOX_CLOUDLESS = (year) => ({
|
|
|
12
12
|
source: {
|
|
13
13
|
type: "XYZ",
|
|
14
14
|
url: S2MAP_URL(`s2cloudless-${year}_3857`),
|
|
15
|
+
attribution: `EOxCloudless <a href="https://cloudless.eox.at" target="_blank" rel="noreferrer">https://cloudless.eox.at</a> by <a href="https://eox.at" target="_blank">EOX IT Services GmbH</a> (Contains modified Copernicus Sentinel data ${year})`,
|
|
15
16
|
},
|
|
16
17
|
});
|
|
17
18
|
|
|
@@ -61,7 +62,7 @@ export const STORIES_LAYER_S2 = {
|
|
|
61
62
|
properties: {
|
|
62
63
|
id: "s2",
|
|
63
64
|
layerControlExclusive: true,
|
|
64
|
-
title: "
|
|
65
|
+
title: "EOxCloudless 2024 Exploitation Ready",
|
|
65
66
|
},
|
|
66
67
|
style: {
|
|
67
68
|
variables: {
|
|
@@ -84,9 +85,11 @@ export const STORIES_LAYER_S2 = {
|
|
|
84
85
|
source: {
|
|
85
86
|
type: "GeoTIFF",
|
|
86
87
|
normalize: false,
|
|
88
|
+
attributions:
|
|
89
|
+
'EOxCloudless <a href="https://cloudless.eox.at" target="_blank" rel="noreferrer">https://cloudless.eox.at</a> by <a href="https://eox.at" target="_blank">EOX IT Services GmbH</a> (Contains modified Copernicus Sentinel data 2024)',
|
|
87
90
|
sources: [
|
|
88
91
|
{
|
|
89
|
-
url: "https://
|
|
92
|
+
url: "https://cloudlessdownloads.eox.at/api/public/dl/jvu06wnt/exploitation-ready-epsg-4326/exploitation-ready_eoxcloudless-sentinel-2-2024_zoom-1_4bands_16bit.tif",
|
|
90
93
|
},
|
|
91
94
|
],
|
|
92
95
|
},
|
|
@@ -340,6 +343,7 @@ const LAYERCONFIG_LAYER_SEE = {
|
|
|
340
343
|
maximum: 5,
|
|
341
344
|
format: "range",
|
|
342
345
|
default: 2,
|
|
346
|
+
step: 0.001,
|
|
343
347
|
},
|
|
344
348
|
vmax: {
|
|
345
349
|
type: "number",
|
|
@@ -18,7 +18,7 @@ export function getStartVals(layer, layerConfig) {
|
|
|
18
18
|
(layer)["style_"]?.variables
|
|
19
19
|
: layerConfig.style?.variables;
|
|
20
20
|
if ((layerConfig.type === "style" || layerConfig.style) && styleVars) {
|
|
21
|
-
nestedValues = styleVars;
|
|
21
|
+
nestedValues = { ...styleVars };
|
|
22
22
|
} else if (/** @type {any} */ (layer.getSource())?.getParams?.()) {
|
|
23
23
|
nestedValues = /** @type {any} */ (layer.getSource()).getParams();
|
|
24
24
|
} else if (
|
|
@@ -52,6 +52,7 @@ export function getStartVals(layer, layerConfig) {
|
|
|
52
52
|
Object.keys(fieldSchemas).length ? fieldSchemas : layerConfig.schema,
|
|
53
53
|
nestedValues,
|
|
54
54
|
layerConfig.schema,
|
|
55
|
+
layer,
|
|
55
56
|
);
|
|
56
57
|
|
|
57
58
|
return Object.keys(startVals).length ? startVals : null;
|
|
@@ -106,9 +107,15 @@ function collectFieldSchemas(
|
|
|
106
107
|
* @param {{[key: string]: any}} schema - The schema object to traverse.
|
|
107
108
|
* @param {{[key: string]: any}} nestedValues - values of nested properties to extract startVals.
|
|
108
109
|
* @param {{[key: string]: any}} [rootSchema] - The root schema `$ref`s resolve against.
|
|
110
|
+
* @param {import("ol/layer/Base").default | any} [layer] - The layer object.
|
|
109
111
|
* @returns {object} - Object containing the startVals.
|
|
110
112
|
*/
|
|
111
|
-
export function getNestedStartVals(
|
|
113
|
+
export function getNestedStartVals(
|
|
114
|
+
schema,
|
|
115
|
+
nestedValues,
|
|
116
|
+
rootSchema = schema,
|
|
117
|
+
layer = null,
|
|
118
|
+
) {
|
|
112
119
|
let startVals = {};
|
|
113
120
|
|
|
114
121
|
for (const key in schema) {
|
|
@@ -120,12 +127,39 @@ export function getNestedStartVals(schema, nestedValues, rootSchema = schema) {
|
|
|
120
127
|
: nestedValues[key];
|
|
121
128
|
// keep the raw URL value instead of NaN (e.g. "auto" on a number field)
|
|
122
129
|
startVals[key] = Number.isNaN(value) ? nestedValues[key] : value;
|
|
130
|
+
} else if (
|
|
131
|
+
type &&
|
|
132
|
+
type !== "object" &&
|
|
133
|
+
schema[key]?.default !== undefined
|
|
134
|
+
) {
|
|
135
|
+
startVals[key] = schema[key].default;
|
|
136
|
+
} else if (
|
|
137
|
+
type &&
|
|
138
|
+
type !== "object" &&
|
|
139
|
+
Array.isArray(schema[key]?.enum) &&
|
|
140
|
+
schema[key].enum.length > 0
|
|
141
|
+
) {
|
|
142
|
+
startVals[key] = schema[key].enum[0];
|
|
143
|
+
} else if (key === "variable" && type && type !== "object" && layer) {
|
|
144
|
+
const source = /** @type {any} */ (
|
|
145
|
+
layer.getSource ? layer.getSource() : null
|
|
146
|
+
);
|
|
147
|
+
const bands =
|
|
148
|
+
(typeof source?.getBands === "function" ? source.getBands() : null) ||
|
|
149
|
+
source?.bands_ ||
|
|
150
|
+
layer.get?.("_lastVariable") ||
|
|
151
|
+
layer.get?.("_jsonDefinition")?.source?.bands ||
|
|
152
|
+
layer.get?.("source")?.bands;
|
|
153
|
+
if (bands) {
|
|
154
|
+
startVals[key] = Array.isArray(bands) ? bands[0] : bands;
|
|
155
|
+
}
|
|
123
156
|
} else {
|
|
124
157
|
// Recursively traverse nested properties
|
|
125
158
|
const nestedStartVals = getNestedStartVals(
|
|
126
159
|
collectFieldSchemas(schema[key], rootSchema),
|
|
127
160
|
nestedValues,
|
|
128
161
|
rootSchema,
|
|
162
|
+
layer,
|
|
129
163
|
);
|
|
130
164
|
if (Object.keys(nestedStartVals).length > 0) {
|
|
131
165
|
startVals[key] = nestedStartVals;
|
|
@@ -4,6 +4,17 @@
|
|
|
4
4
|
* @param {HTMLElement} element
|
|
5
5
|
*/
|
|
6
6
|
export function handleDatetimeUpdate(evt, element) {
|
|
7
|
+
const { datetime, layer } = evt.detail || {};
|
|
8
|
+
if (layer && datetime) {
|
|
9
|
+
const sliceMap = layer.get("layerDatetime")?.sliceMap;
|
|
10
|
+
if (sliceMap && datetime in sliceMap) {
|
|
11
|
+
const sliceIndex = sliceMap[datetime];
|
|
12
|
+
const source = layer.getSource ? layer.getSource() : null;
|
|
13
|
+
if (source && typeof source.updateDimensions === "function") {
|
|
14
|
+
source.updateDimensions({ time: sliceIndex });
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
7
18
|
element.dispatchEvent(
|
|
8
19
|
new CustomEvent("datetime:updated", { detail: evt.detail, bubbles: true }),
|
|
9
20
|
);
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
isLayerVisibleBasedOnZoomState,
|
|
3
3
|
isLayerZoomStateRequired,
|
|
4
4
|
} from "../../helpers";
|
|
5
|
-
|
|
5
|
+
import { isGeoZarrLayer, setupGeoZarrLayer } from "@eox/map";
|
|
6
6
|
/**
|
|
7
7
|
* Check and update layer zoom visibility at beginning
|
|
8
8
|
* and register "change:resolution" ones at the beginning if `showLayerZoomState` is present
|
|
@@ -60,6 +60,12 @@ const firstUpdatedMethod = (EOxLayerControlLayer) => {
|
|
|
60
60
|
.getView()
|
|
61
61
|
.on("change:resolution", () => updateLayerZoomVisibility());
|
|
62
62
|
}
|
|
63
|
+
|
|
64
|
+
if (isGeoZarrLayer(EOxLayerControlLayer.layer)) {
|
|
65
|
+
setupGeoZarrLayer(EOxLayerControlLayer.layer).then(() => {
|
|
66
|
+
EOxLayerControlLayer.requestUpdate();
|
|
67
|
+
});
|
|
68
|
+
}
|
|
63
69
|
};
|
|
64
70
|
|
|
65
71
|
export default firstUpdatedMethod;
|
|
@@ -11,26 +11,54 @@ export default function (jsonformOutput, layer, layerConfig) {
|
|
|
11
11
|
const styles = isTile
|
|
12
12
|
? /** @type {import('ol/layer/WebGLTile').default} */ (layer)["style_"]
|
|
13
13
|
: layerConfig.style;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
const updatedValues = flattenObject(jsonformOutput);
|
|
15
|
+
|
|
16
|
+
if (styles) {
|
|
17
|
+
const styleVars = styles.variables || {};
|
|
17
18
|
/** @type {Record<string,any>} */
|
|
18
19
|
styles.variables = {
|
|
19
20
|
...styleVars,
|
|
20
21
|
...updatedValues,
|
|
21
22
|
};
|
|
23
|
+
}
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
// check if it supports updating the variables using ol first
|
|
26
|
+
if (isTile) {
|
|
27
|
+
if (jsonformOutput?.variable) {
|
|
28
|
+
const sourceUrl =
|
|
29
|
+
layer.get("_geozarrSourceUrl") ||
|
|
30
|
+
layer.get("_jsonDefinition")?.source?.url ||
|
|
31
|
+
layer.get("source")?.url ||
|
|
32
|
+
layer.get("_geozarrRootUrl");
|
|
33
|
+
const source = /** @type {any} */ (
|
|
34
|
+
layer.getSource ? layer.getSource() : null
|
|
32
35
|
);
|
|
36
|
+
if (source) {
|
|
37
|
+
if (typeof source.setBands === "function") {
|
|
38
|
+
source.setBands([jsonformOutput.variable]);
|
|
39
|
+
} else if (sourceUrl && source.constructor) {
|
|
40
|
+
const GeoZarrClass = /** @type {any} */ (source.constructor);
|
|
41
|
+
const newSource = new GeoZarrClass({
|
|
42
|
+
url: sourceUrl,
|
|
43
|
+
bands: [jsonformOutput.variable],
|
|
44
|
+
crossOrigin: "anonymous",
|
|
45
|
+
});
|
|
46
|
+
layer.setSource(newSource);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const lastVar = layer.get("_lastVariable");
|
|
50
|
+
if (jsonformOutput.variable !== lastVar) {
|
|
51
|
+
layer.set("_lastVariable", jsonformOutput.variable);
|
|
52
|
+
}
|
|
33
53
|
}
|
|
54
|
+
/** @type {import('ol/layer/WebGLTile').default} */ (
|
|
55
|
+
layer
|
|
56
|
+
).updateStyleVariables(updatedValues);
|
|
57
|
+
} else if (isVector && styles) {
|
|
58
|
+
const updatedStyles = updateVectorLayerStyle(styles);
|
|
59
|
+
/** @type {import('ol/layer/Vector').default} */ (layer).setStyle(
|
|
60
|
+
updatedStyles,
|
|
61
|
+
);
|
|
34
62
|
}
|
|
35
63
|
}
|
|
36
64
|
|
|
@@ -86,6 +86,8 @@ export namespace STORIES_LAYER_S2 {
|
|
|
86
86
|
let type_7: string;
|
|
87
87
|
export { type_7 as type };
|
|
88
88
|
export let normalize: boolean;
|
|
89
|
+
let attributions_1: string;
|
|
90
|
+
export { attributions_1 as attributions };
|
|
89
91
|
export let sources: {
|
|
90
92
|
url: string;
|
|
91
93
|
}[];
|
|
@@ -143,6 +145,7 @@ export namespace STORIES_LAYER_EOX_CLOUDLESS_2019 {
|
|
|
143
145
|
export { type_13 as type };
|
|
144
146
|
let url_2: string;
|
|
145
147
|
export { url_2 as url };
|
|
148
|
+
export let attribution: string;
|
|
146
149
|
}
|
|
147
150
|
export { source_6 as source };
|
|
148
151
|
}
|
|
@@ -178,6 +181,7 @@ export const STORIES_MAIN_MAP_LAYERS: ({
|
|
|
178
181
|
source: {
|
|
179
182
|
type: string;
|
|
180
183
|
normalize: boolean;
|
|
184
|
+
attributions: string;
|
|
181
185
|
sources: {
|
|
182
186
|
url: string;
|
|
183
187
|
}[];
|
|
@@ -902,6 +906,8 @@ declare namespace LAYERCONFIG_LAYER_SEE {
|
|
|
902
906
|
export { format_16 as format };
|
|
903
907
|
let _default_15: number;
|
|
904
908
|
export { _default_15 as default };
|
|
909
|
+
let step_2: number;
|
|
910
|
+
export { step_2 as step };
|
|
905
911
|
}
|
|
906
912
|
export { vmin_5 as vmin };
|
|
907
913
|
export namespace vmax_5 {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/enums/stories/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/enums/stories/index.js"],"names":[],"mappings":"AAkBA,yCAA0C,eAAe,CAAC;AAE1D,gCACE,gDAAgD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuGnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAuBE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAjJF,gCACE,gFAAgF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4LnF;;;;;;;;;;EA2DE;0BA1PwB,6BAA6B"}
|
|
@@ -12,6 +12,7 @@ export function getStartVals(layer: import("ol/layer").Layer, layerConfig: impor
|
|
|
12
12
|
* @param {{[key: string]: any}} schema - The schema object to traverse.
|
|
13
13
|
* @param {{[key: string]: any}} nestedValues - values of nested properties to extract startVals.
|
|
14
14
|
* @param {{[key: string]: any}} [rootSchema] - The root schema `$ref`s resolve against.
|
|
15
|
+
* @param {import("ol/layer/Base").default | any} [layer] - The layer object.
|
|
15
16
|
* @returns {object} - Object containing the startVals.
|
|
16
17
|
*/
|
|
17
18
|
export function getNestedStartVals(schema: {
|
|
@@ -20,5 +21,5 @@ export function getNestedStartVals(schema: {
|
|
|
20
21
|
[key: string]: any;
|
|
21
22
|
}, rootSchema?: {
|
|
22
23
|
[key: string]: any;
|
|
23
|
-
}): object;
|
|
24
|
+
}, layer?: import("ol/layer/Base").default | any): object;
|
|
24
25
|
//# sourceMappingURL=get-start-vals.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-start-vals.d.ts","sourceRoot":"","sources":["../../src/helpers/get-start-vals.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,oCAJW,OAAO,UAAU,EAAE,KAAK,eACxB,OAAO,4BAA4B,EAAE,0BAA0B,CAAC,aAAa,CAAC,GAC5E,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"get-start-vals.d.ts","sourceRoot":"","sources":["../../src/helpers/get-start-vals.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,oCAJW,OAAO,UAAU,EAAE,KAAK,eACxB,OAAO,4BAA4B,EAAE,0BAA0B,CAAC,aAAa,CAAC,GAC5E,MAAM,GAAG,IAAI,CAqDzB;AA6CD;;;;;;;;GAQG;AACH,2CANW;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAC,gBACpB;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAC,eACpB;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAC,UACpB,OAAO,eAAe,EAAE,OAAO,GAAG,GAAG,GACnC,MAAM,CA2DlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle-datetime-update.d.ts","sourceRoot":"","sources":["../../src/helpers/handle-datetime-update.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,0CAHW,WAAW,WACX,WAAW,
|
|
1
|
+
{"version":3,"file":"handle-datetime-update.d.ts","sourceRoot":"","sources":["../../src/helpers/handle-datetime-update.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,0CAHW,WAAW,WACX,WAAW,QAiBrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"first-updated.d.ts","sourceRoot":"","sources":["../../../src/methods/layer/first-updated.js"],"names":[],"mappings":";AAKA;;;;;GAKG;AACH,0DAFW,OAAO,wBAAwB,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"first-updated.d.ts","sourceRoot":"","sources":["../../../src/methods/layer/first-updated.js"],"names":[],"mappings":";AAKA;;;;;GAKG;AACH,0DAFW,OAAO,wBAAwB,EAAE,oBAAoB,QA2D/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply-updated-styles.d.ts","sourceRoot":"","sources":["../../../src/methods/layer-config/apply-updated-styles.js"],"names":[],"mappings":"AAAA;;;;KAIK;AACL,iDAJW,MAAM,CAAC,MAAM,EAAC,MAAM,CAAC,SACpB,OAAO,gBAAgB,EAAE,OAAO,eAChC,OAAO,+BAA+B,EAAE,0BAA0B,CAAC,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"apply-updated-styles.d.ts","sourceRoot":"","sources":["../../../src/methods/layer-config/apply-updated-styles.js"],"names":[],"mappings":"AAAA;;;;KAIK;AACL,iDAJW,MAAM,CAAC,MAAM,EAAC,MAAM,CAAC,SACpB,OAAO,gBAAgB,EAAE,OAAO,eAChC,OAAO,+BAA+B,EAAE,0BAA0B,CAAC,aAAa,CAAC,QA2D5F;AA+BD;;;;;GAKG;AACH,+CAHW,MAAM,CAAC,MAAM,EAAC,GAAG,CAAC,uBA+B5B;AA5DM,mCAFI,MAAM,CAAC,MAAM,EAAC,GAAG,CAAC,uBA0B5B"}
|