@eeacms/volto-arcgis-block 0.1.468 → 0.1.469
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/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/src/components/MapViewer/MenuWidget.jsx +152 -72
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
+
### [0.1.469](https://github.com/eea/volto-arcgis-block/compare/0.1.468...0.1.469) - 12 August 2026
|
|
8
|
+
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
10
|
+
|
|
11
|
+
- (chore): fix linting [Unai Bolivar - [`df6b223`](https://github.com/eea/volto-arcgis-block/commit/df6b223aa3b8b2e0bf098e191e210ec4022f059f)]
|
|
12
|
+
- (bug): dynamically pull time range from catalog for hi/lo res tile requests [Unai Bolivar - [`810b22d`](https://github.com/eea/volto-arcgis-block/commit/810b22d9b555fb18d9f8d5a810a5099f6ae29ab6)]
|
|
7
13
|
### [0.1.468](https://github.com/eea/volto-arcgis-block/compare/0.1.467...0.1.468) - 12 August 2026
|
|
8
14
|
|
|
9
15
|
#### :rocket: New Features
|
|
@@ -17,6 +23,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
17
23
|
|
|
18
24
|
#### :hammer_and_wrench: Others
|
|
19
25
|
|
|
26
|
+
- Merge pull request #1190 from eea/develop [Unai Bolivar - [`5d9e33f`](https://github.com/eea/volto-arcgis-block/commit/5d9e33f1470e6776920657aac835360aff91e47c)]
|
|
20
27
|
- Merge pull request #1189 from eea/CLMS-304632-REFACTOR [Unai Bolivar - [`ffba286`](https://github.com/eea/volto-arcgis-block/commit/ffba286c6368fae6167ffedf3c89a18d74a31edd)]
|
|
21
28
|
- (task): refactor dual layers support [Unai Bolivar - [`c13aaa0`](https://github.com/eea/volto-arcgis-block/commit/c13aaa089d91f476f1fa02e94673dc4d847704c9)]
|
|
22
29
|
- (task): refactor dual layer support [Unai Bolivar - [`7c3a1cf`](https://github.com/eea/volto-arcgis-block/commit/7c3a1cfe18ed8be53b80fb2205b54cce90f0ad68)]
|
package/package.json
CHANGED
|
@@ -952,7 +952,7 @@ class MenuWidget extends React.Component {
|
|
|
952
952
|
}
|
|
953
953
|
}
|
|
954
954
|
|
|
955
|
-
supportDualLayers(layer, inheritedIndexLayer) {
|
|
955
|
+
supportDualLayers(layer, inheritedIndexLayer, datasetCollectionId) {
|
|
956
956
|
const resolutionData = layer.resolution_data || {};
|
|
957
957
|
const thresholdScale = Number(resolutionData.thresholdScale);
|
|
958
958
|
const normalizeScaleValue = (scaleValue, fallbackValue = 0) => {
|
|
@@ -988,10 +988,73 @@ class MenuWidget extends React.Component {
|
|
|
988
988
|
const CDSEProcessTileLayer = BaseTileLayer.createSubclass({
|
|
989
989
|
properties: {
|
|
990
990
|
collectionId: null,
|
|
991
|
+
catalogByoc: null,
|
|
991
992
|
evalscript: null,
|
|
992
993
|
processUrl: '/++api++/@proxyrunprocessapi',
|
|
993
994
|
},
|
|
994
995
|
|
|
996
|
+
_resolveCatalogDateRange: function (options) {
|
|
997
|
+
const rawCollectionId = this.catalogByoc || '';
|
|
998
|
+
const normalizedCollectionId = String(rawCollectionId).replace(
|
|
999
|
+
/^byoc-/i,
|
|
1000
|
+
'',
|
|
1001
|
+
);
|
|
1002
|
+
if (!normalizedCollectionId) {
|
|
1003
|
+
return Promise.resolve(null);
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
const cacheByCollection =
|
|
1007
|
+
this.constructor._catalogDateRangeCache ||
|
|
1008
|
+
(this.constructor._catalogDateRangeCache = {});
|
|
1009
|
+
const pendingByCollection =
|
|
1010
|
+
this.constructor._catalogDateRangePending ||
|
|
1011
|
+
(this.constructor._catalogDateRangePending = {});
|
|
1012
|
+
|
|
1013
|
+
if (cacheByCollection[normalizedCollectionId]) {
|
|
1014
|
+
return Promise.resolve(cacheByCollection[normalizedCollectionId]);
|
|
1015
|
+
}
|
|
1016
|
+
if (pendingByCollection[normalizedCollectionId]) {
|
|
1017
|
+
return pendingByCollection[normalizedCollectionId];
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
const requestUrl =
|
|
1021
|
+
'/++api++/@get_catalogapi_dates?byoc=' +
|
|
1022
|
+
encodeURIComponent(normalizedCollectionId) +
|
|
1023
|
+
'&force_refresh=false';
|
|
1024
|
+
|
|
1025
|
+
pendingByCollection[normalizedCollectionId] = fetch(requestUrl, {
|
|
1026
|
+
headers: {
|
|
1027
|
+
Accept: 'application/json',
|
|
1028
|
+
},
|
|
1029
|
+
signal: options && options.signal,
|
|
1030
|
+
})
|
|
1031
|
+
.then((response) => {
|
|
1032
|
+
if (!response.ok) {
|
|
1033
|
+
return null;
|
|
1034
|
+
}
|
|
1035
|
+
return response.json();
|
|
1036
|
+
})
|
|
1037
|
+
.then((payload) => {
|
|
1038
|
+
const dates = Array.isArray(payload?.dates) ? payload.dates : [];
|
|
1039
|
+
const resolvedDateRange =
|
|
1040
|
+
dates.length > 0
|
|
1041
|
+
? {
|
|
1042
|
+
from: dates[0],
|
|
1043
|
+
to: dates[dates.length - 1],
|
|
1044
|
+
}
|
|
1045
|
+
: null;
|
|
1046
|
+
cacheByCollection[normalizedCollectionId] = resolvedDateRange;
|
|
1047
|
+
delete pendingByCollection[normalizedCollectionId];
|
|
1048
|
+
return resolvedDateRange;
|
|
1049
|
+
})
|
|
1050
|
+
.catch(() => {
|
|
1051
|
+
delete pendingByCollection[normalizedCollectionId];
|
|
1052
|
+
return null;
|
|
1053
|
+
});
|
|
1054
|
+
|
|
1055
|
+
return pendingByCollection[normalizedCollectionId];
|
|
1056
|
+
},
|
|
1057
|
+
|
|
995
1058
|
// Computes the tile bounding box in EPSG:3857 (without projections)
|
|
996
1059
|
_tileToBBox3857: function (level, row, col) {
|
|
997
1060
|
const tileInfo = this.tileInfo;
|
|
@@ -1024,81 +1087,94 @@ class MenuWidget extends React.Component {
|
|
|
1024
1087
|
const width = this.tileInfo.size[0];
|
|
1025
1088
|
const height = this.tileInfo.size[1];
|
|
1026
1089
|
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1090
|
+
return this._resolveCatalogDateRange(options).then(
|
|
1091
|
+
(catalogDateRange) => {
|
|
1092
|
+
const resolvedTimeRangeFrom = catalogDateRange?.from || null;
|
|
1093
|
+
const resolvedTimeRangeTo = catalogDateRange?.to || null;
|
|
1094
|
+
const timeRange = {};
|
|
1095
|
+
if (resolvedTimeRangeFrom) {
|
|
1096
|
+
timeRange.from = resolvedTimeRangeFrom;
|
|
1097
|
+
}
|
|
1098
|
+
if (resolvedTimeRangeTo) {
|
|
1099
|
+
timeRange.to = resolvedTimeRangeTo;
|
|
1100
|
+
}
|
|
1101
|
+
const dataFilter = {};
|
|
1102
|
+
if (Object.keys(timeRange).length) {
|
|
1103
|
+
dataFilter.timeRange = timeRange;
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
const payload = {
|
|
1107
|
+
input: {
|
|
1108
|
+
bounds: {
|
|
1109
|
+
bbox: [
|
|
1110
|
+
bbox3857.west,
|
|
1111
|
+
bbox3857.south,
|
|
1112
|
+
bbox3857.east,
|
|
1113
|
+
bbox3857.north,
|
|
1114
|
+
],
|
|
1115
|
+
properties: {
|
|
1116
|
+
crs: 'http://www.opengis.net/def/crs/EPSG/0/3857',
|
|
1047
1117
|
},
|
|
1048
1118
|
},
|
|
1119
|
+
data: [
|
|
1120
|
+
{
|
|
1121
|
+
type: this.collectionId,
|
|
1122
|
+
...(Object.keys(dataFilter).length ? { dataFilter } : {}),
|
|
1123
|
+
},
|
|
1124
|
+
],
|
|
1049
1125
|
},
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1126
|
+
output: {
|
|
1127
|
+
width: width,
|
|
1128
|
+
height: height,
|
|
1129
|
+
responses: [
|
|
1130
|
+
{
|
|
1131
|
+
identifier: 'default',
|
|
1132
|
+
format: { type: 'image/png' },
|
|
1133
|
+
},
|
|
1134
|
+
],
|
|
1059
1135
|
},
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1136
|
+
evalscript: this.evalscript,
|
|
1137
|
+
};
|
|
1138
|
+
|
|
1139
|
+
return fetch(this.processUrl, {
|
|
1140
|
+
method: 'POST',
|
|
1141
|
+
headers: {
|
|
1142
|
+
'Content-Type': 'application/json',
|
|
1143
|
+
Accept: 'image/png',
|
|
1144
|
+
},
|
|
1145
|
+
body: JSON.stringify(payload),
|
|
1146
|
+
signal: options && options.signal,
|
|
1147
|
+
})
|
|
1148
|
+
.then((response) => {
|
|
1149
|
+
if (!response.ok) {
|
|
1150
|
+
throw new Error(
|
|
1151
|
+
`Process API error ${response.status}: ${response.statusText}`,
|
|
1152
|
+
);
|
|
1153
|
+
}
|
|
1154
|
+
return response.blob();
|
|
1155
|
+
})
|
|
1156
|
+
.then((blob) => {
|
|
1157
|
+
return new Promise((resolve, reject) => {
|
|
1158
|
+
const url = URL.createObjectURL(blob);
|
|
1159
|
+
const img = new Image();
|
|
1160
|
+
img.onload = () => {
|
|
1161
|
+
const canvas = document.createElement('canvas');
|
|
1162
|
+
canvas.width = width;
|
|
1163
|
+
canvas.height = height;
|
|
1164
|
+
const ctx = canvas.getContext('2d');
|
|
1165
|
+
ctx.drawImage(img, 0, 0, width, height);
|
|
1166
|
+
URL.revokeObjectURL(url);
|
|
1167
|
+
resolve(canvas);
|
|
1168
|
+
};
|
|
1169
|
+
img.onerror = (err) => {
|
|
1170
|
+
URL.revokeObjectURL(url);
|
|
1171
|
+
reject(err);
|
|
1172
|
+
};
|
|
1173
|
+
img.src = url;
|
|
1174
|
+
});
|
|
1175
|
+
});
|
|
1070
1176
|
},
|
|
1071
|
-
|
|
1072
|
-
signal: options && options.signal,
|
|
1073
|
-
})
|
|
1074
|
-
.then((response) => {
|
|
1075
|
-
if (!response.ok) {
|
|
1076
|
-
throw new Error(
|
|
1077
|
-
`Process API error ${response.status}: ${response.statusText}`,
|
|
1078
|
-
);
|
|
1079
|
-
}
|
|
1080
|
-
return response.blob();
|
|
1081
|
-
})
|
|
1082
|
-
.then((blob) => {
|
|
1083
|
-
return new Promise((resolve, reject) => {
|
|
1084
|
-
const url = URL.createObjectURL(blob);
|
|
1085
|
-
const img = new Image();
|
|
1086
|
-
img.onload = () => {
|
|
1087
|
-
const canvas = document.createElement('canvas');
|
|
1088
|
-
canvas.width = width;
|
|
1089
|
-
canvas.height = height;
|
|
1090
|
-
const ctx = canvas.getContext('2d');
|
|
1091
|
-
ctx.drawImage(img, 0, 0, width, height);
|
|
1092
|
-
URL.revokeObjectURL(url);
|
|
1093
|
-
resolve(canvas);
|
|
1094
|
-
};
|
|
1095
|
-
img.onerror = (err) => {
|
|
1096
|
-
URL.revokeObjectURL(url);
|
|
1097
|
-
reject(err);
|
|
1098
|
-
};
|
|
1099
|
-
img.src = url;
|
|
1100
|
-
});
|
|
1101
|
-
});
|
|
1177
|
+
);
|
|
1102
1178
|
},
|
|
1103
1179
|
});
|
|
1104
1180
|
const tileInfo = {
|
|
@@ -1132,6 +1208,7 @@ class MenuWidget extends React.Component {
|
|
|
1132
1208
|
new CDSEProcessTileLayer({
|
|
1133
1209
|
...sharedLayerProps,
|
|
1134
1210
|
collectionId: lowResLayerData.collectionId,
|
|
1211
|
+
catalogByoc: datasetCollectionId || null,
|
|
1135
1212
|
evalscript: lowResLayerData.evalscript,
|
|
1136
1213
|
minScale: lowResLayerData.minScale,
|
|
1137
1214
|
maxScale: lowResLayerData.maxScale,
|
|
@@ -1144,6 +1221,7 @@ class MenuWidget extends React.Component {
|
|
|
1144
1221
|
new CDSEProcessTileLayer({
|
|
1145
1222
|
...sharedLayerProps,
|
|
1146
1223
|
collectionId: highResLayerData.collectionId,
|
|
1224
|
+
catalogByoc: datasetCollectionId || null,
|
|
1147
1225
|
evalscript: highResLayerData.evalscript,
|
|
1148
1226
|
minScale: highResLayerData.minScale,
|
|
1149
1227
|
maxScale: highResLayerData.maxScale,
|
|
@@ -2279,7 +2357,9 @@ class MenuWidget extends React.Component {
|
|
|
2279
2357
|
layer.hasLowRes === true ||
|
|
2280
2358
|
(layer.resolution_data?.lowRes && layer.resolution_data?.highRes)
|
|
2281
2359
|
) {
|
|
2282
|
-
|
|
2360
|
+
const datasetCollectionId =
|
|
2361
|
+
dataset_download_information?.items?.[0]?.byoc_collection || null;
|
|
2362
|
+
this.supportDualLayers(layer, inheritedIndexLayer, datasetCollectionId);
|
|
2283
2363
|
} else if (viewService?.toLowerCase().includes('wms')) {
|
|
2284
2364
|
viewService = viewService?.includes('?')
|
|
2285
2365
|
? viewService + '&'
|