@eeacms/volto-arcgis-block 0.1.401 → 0.1.402

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 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.402](https://github.com/eea/volto-arcgis-block/compare/0.1.401...0.1.402) - 3 November 2025
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - (bug): Using full extent takes user to correct area [Unai Bolivar - [`9ad099c`](https://github.com/eea/volto-arcgis-block/commit/9ad099c01aacc8f0c988b8e100048cabcbedaa38)]
12
+ - (bug): Correcting full extent bug for CDSE product geometries and BBoxes [Unai Bolivar - [`579438b`](https://github.com/eea/volto-arcgis-block/commit/579438b64a077eb85c919a7ccd300ffa0e455153)]
7
13
  ### [0.1.401](https://github.com/eea/volto-arcgis-block/compare/0.1.400...0.1.401) - 29 October 2025
8
14
 
9
15
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-arcgis-block",
3
- "version": "0.1.401",
3
+ "version": "0.1.402",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -2888,7 +2888,7 @@ class MenuWidget extends React.Component {
2888
2888
  ) {
2889
2889
  this.extentInitiated = true;
2890
2890
  // setTimeout(() => {
2891
- this.FullExtentDataset(elem);
2891
+ this.fullExtentDataset(elem);
2892
2892
  // }, 2000);
2893
2893
  }
2894
2894
  }
@@ -3879,24 +3879,69 @@ class MenuWidget extends React.Component {
3879
3879
 
3880
3880
  async datasetFullExtentFromPayload(payload) {
3881
3881
  if (!payload) return null;
3882
- if (Array.isArray(payload.extent) && payload.extent.length === 4) {
3882
+ if (
3883
+ payload.metadata &&
3884
+ Array.isArray(payload.metadata.bbox) &&
3885
+ payload.metadata.bbox.length === 4
3886
+ ) {
3887
+ const srName = payload.metadata?.geometry?.crs?.properties?.name || '';
3888
+ const isCRS84 =
3889
+ typeof srName === 'string' && srName.toUpperCase().includes('CRS84');
3883
3890
  return new Extent({
3884
- xmin: payload.extent[0],
3885
- ymin: payload.extent[1],
3886
- xmax: payload.extent[2],
3887
- ymax: payload.extent[3],
3888
- spatialReference: { wkid: 3857 },
3891
+ xmin: payload.metadata.bbox[0],
3892
+ ymin: payload.metadata.bbox[1],
3893
+ xmax: payload.metadata.bbox[2],
3894
+ ymax: payload.metadata.bbox[3],
3895
+ spatialReference: isCRS84 ? { wkid: 4326 } : { wkid: 3857 },
3889
3896
  });
3890
- }
3891
- if (payload.geometry && payload.geometry.coordinates) {
3892
- return await this.createExtentFromCoordinates(
3893
- payload.geometry.coordinates,
3894
- );
3897
+ } else if (
3898
+ payload.metadata &&
3899
+ payload.metadata.geometry &&
3900
+ payload.metadata.geometry.coordinates
3901
+ ) {
3902
+ const srName = payload.metadata?.geometry?.crs?.properties?.name || '';
3903
+ const isCRS84 =
3904
+ typeof srName === 'string' && srName.toUpperCase().includes('CRS84');
3905
+ const coords = payload.metadata.geometry.coordinates;
3906
+ let xmin = Infinity,
3907
+ ymin = Infinity,
3908
+ xmax = -Infinity,
3909
+ ymax = -Infinity;
3910
+ const walk = (arr) => {
3911
+ if (!Array.isArray(arr)) return;
3912
+ if (typeof arr[0] === 'number' && typeof arr[1] === 'number') {
3913
+ const x = Number(arr[0]);
3914
+ const y = Number(arr[1]);
3915
+ if (isFinite(x) && isFinite(y)) {
3916
+ if (x < xmin) xmin = x;
3917
+ if (x > xmax) xmax = x;
3918
+ if (y < ymin) ymin = y;
3919
+ if (y > ymax) ymax = y;
3920
+ }
3921
+ return;
3922
+ }
3923
+ for (let i = 0; i < arr.length; i++) walk(arr[i]);
3924
+ };
3925
+ walk(coords);
3926
+ if (
3927
+ isFinite(xmin) &&
3928
+ isFinite(ymin) &&
3929
+ isFinite(xmax) &&
3930
+ isFinite(ymax)
3931
+ ) {
3932
+ return new Extent({
3933
+ xmin: xmin,
3934
+ ymin: ymin,
3935
+ xmax: xmax,
3936
+ ymax: ymax,
3937
+ spatialReference: isCRS84 ? { wkid: 4326 } : { wkid: 3857 },
3938
+ });
3939
+ }
3895
3940
  }
3896
3941
  return null;
3897
3942
  }
3898
3943
 
3899
- async FullExtentDataset(elem) {
3944
+ async fullExtentDataset(elem) {
3900
3945
  const serviceLayer = this.state.wmsUserServiceLayers.find(
3901
3946
  (layer) => layer.LayerId === elem.id,
3902
3947
  );
@@ -3910,12 +3955,47 @@ class MenuWidget extends React.Component {
3910
3955
  ['/ogc/', '/cdse/'].some((s) => this.url.toLowerCase().includes(s));
3911
3956
  let BBoxes = {};
3912
3957
  if (isCDSE) {
3913
- const d =
3958
+ let d =
3914
3959
  this.layers[elem.id]?.DatasetDownloadInformation ||
3915
3960
  this.layers[elem.id]?.datasetDownloadInformation ||
3961
+ this.layers[elem.id]?.dataset_download_information ||
3916
3962
  {};
3917
- const byoc =
3918
- d && d.items && d.items[0] ? d.items[0].byoc_collection : null;
3963
+ let byoc = d && d.items && d.items[0] ? d.items[0].byoc_collection : null;
3964
+
3965
+ if (!byoc) {
3966
+ let parentId = elem.getAttribute('parentid');
3967
+ let datasetInput = document.getElementById(parentId);
3968
+ let datasetContainer = datasetInput
3969
+ ? datasetInput.closest('.map-menu-dataset-dropdown')
3970
+ : null;
3971
+ let datasetId = datasetContainer
3972
+ ? datasetContainer.getAttribute('datasetid')
3973
+ : null;
3974
+ if (datasetId && this.compCfg && Array.isArray(this.compCfg)) {
3975
+ for (let i = 0; i < this.compCfg.length; i++) {
3976
+ const comp = this.compCfg[i];
3977
+ if (!comp || !comp.Products) continue;
3978
+ for (let j = 0; j < comp.Products.length; j++) {
3979
+ const prod = comp.Products[j];
3980
+ if (!prod || !prod.Datasets) continue;
3981
+ for (let k = 0; k < prod.Datasets.length; k++) {
3982
+ const ds = prod.Datasets[k];
3983
+ if (ds && ds.DatasetId === datasetId) {
3984
+ const info =
3985
+ ds.dataset_download_information ||
3986
+ ds.DatasetDownloadInformation ||
3987
+ {};
3988
+ if (info && info.items && info.items[0]) {
3989
+ byoc = info.items[0].byoc_collection || byoc;
3990
+ }
3991
+ break;
3992
+ }
3993
+ }
3994
+ }
3995
+ }
3996
+ }
3997
+ }
3998
+
3919
3999
  if (byoc && this.props.fetchCatalogApiDates) {
3920
4000
  let payload =
3921
4001
  this.props.catalogapi &&
@@ -3937,7 +4017,7 @@ class MenuWidget extends React.Component {
3937
4017
  BBoxes = await this.parseBBOXMAPSERVER(this.layers[elem.id]);
3938
4018
  } else if (this.url?.toLowerCase().includes('wms') || serviceLayer) {
3939
4019
  await this.getCapabilities(this.url, 'wms');
3940
- this.parseBBOXWMS(this.xml);
4020
+ BBoxes = this.parseBBOXWMS(this.xml);
3941
4021
  } else if (this.url?.toLowerCase().includes('wmts')) {
3942
4022
  await this.getCapabilities(this.url, 'wmts');
3943
4023
  BBoxes = this.parseBBOXWMTS(this.xml);
@@ -3949,7 +4029,7 @@ class MenuWidget extends React.Component {
3949
4029
  ymin: -20037508.342789,
3950
4030
  xmax: 20037508.342789,
3951
4031
  ymax: 20037508.342789,
3952
- spatialReference: 3857, // by default wkid 4326
4032
+ spatialReference: 3857,
3953
4033
  });
3954
4034
  } else {
3955
4035
  myExtent = new Extent({
@@ -3957,36 +4037,9 @@ class MenuWidget extends React.Component {
3957
4037
  ymin: BBoxes['dataset'].ymin,
3958
4038
  xmax: BBoxes['dataset'].xmax,
3959
4039
  ymax: BBoxes['dataset'].ymax,
3960
- // spatialReference: 4326 // by default wkid 4326
3961
4040
  });
3962
4041
  }
3963
- if (isCDSE) {
3964
- const maxMppAllowed = 23628.54;
3965
- const vw = this.view && this.view.width ? this.view.width : 0;
3966
- const vh = this.view && this.view.height ? this.view.height : 0;
3967
- let extentWM = myExtent;
3968
- try {
3969
- if (
3970
- !(
3971
- myExtent.spatialReference && myExtent.spatialReference.wkid === 3857
3972
- )
3973
- ) {
3974
- extentWM = WebMercatorUtils.geographicToWebMercator(myExtent);
3975
- }
3976
- } catch (e) {}
3977
- if (vw > 0 && vh > 0) {
3978
- const mppX = (extentWM.xmax - extentWM.xmin) / vw;
3979
- const mppY = (extentWM.ymax - extentWM.ymin) / vh;
3980
- const mpp = Math.max(mppX, mppY);
3981
- if (mpp > maxMppAllowed) {
3982
- const cx = (myExtent.xmin + myExtent.xmax) / 2;
3983
- const cy = (myExtent.ymin + myExtent.ymax) / 2;
3984
- this.view.goTo({ center: [cx, cy], zoom: 3 });
3985
- return;
3986
- }
3987
- }
3988
- }
3989
- this.view.goTo(myExtent); //
4042
+ this.view.goTo(myExtent);
3990
4043
  }
3991
4044
 
3992
4045
  async fullExtent(elem) {
@@ -4008,7 +4061,10 @@ class MenuWidget extends React.Component {
4008
4061
  let firstLayer;
4009
4062
  let landCoverAndLandUseMapping = document.querySelector('#component_0');
4010
4063
  let productIds = [];
4011
- if (landCoverAndLandUseMapping) {
4064
+ if (
4065
+ landCoverAndLandUseMapping &&
4066
+ landCoverAndLandUseMapping.contains(document.activeElement)
4067
+ ) {
4012
4068
  const productElements = landCoverAndLandUseMapping.querySelectorAll(
4013
4069
  '.map-menu-product-dropdown',
4014
4070
  );
@@ -4020,12 +4076,47 @@ class MenuWidget extends React.Component {
4020
4076
  });
4021
4077
  }
4022
4078
  if (isCDSE) {
4023
- const d =
4079
+ let d =
4024
4080
  this.layers[elem.id]?.DatasetDownloadInformation ||
4025
4081
  this.layers[elem.id]?.datasetDownloadInformation ||
4082
+ this.layers[elem.id]?.dataset_download_information ||
4026
4083
  {};
4027
- const byoc =
4028
- d && d.items && d.items[0] ? d.items[0].byoc_collection : null;
4084
+ let byoc = d && d.items && d.items[0] ? d.items[0].byoc_collection : null;
4085
+
4086
+ if (!byoc) {
4087
+ let parentId = elem.getAttribute('parentid');
4088
+ let datasetInput = document.getElementById(parentId);
4089
+ let datasetContainer = datasetInput
4090
+ ? datasetInput.closest('.map-menu-dataset-dropdown')
4091
+ : null;
4092
+ let datasetId = datasetContainer
4093
+ ? datasetContainer.getAttribute('datasetid')
4094
+ : null;
4095
+ if (datasetId && this.compCfg && Array.isArray(this.compCfg)) {
4096
+ for (let i = 0; i < this.compCfg.length; i++) {
4097
+ const comp = this.compCfg[i];
4098
+ if (!comp || !comp.Products) continue;
4099
+ for (let j = 0; j < comp.Products.length; j++) {
4100
+ const prod = comp.Products[j];
4101
+ if (!prod || !prod.Datasets) continue;
4102
+ for (let k = 0; k < prod.Datasets.length; k++) {
4103
+ const ds = prod.Datasets[k];
4104
+ if (ds && ds.DatasetId === datasetId) {
4105
+ const info =
4106
+ ds.dataset_download_information ||
4107
+ ds.DatasetDownloadInformation ||
4108
+ {};
4109
+ if (info && info.items && info.items[0]) {
4110
+ byoc = info.items[0].byoc_collection || byoc;
4111
+ }
4112
+ break;
4113
+ }
4114
+ }
4115
+ }
4116
+ }
4117
+ }
4118
+ }
4119
+
4029
4120
  if (byoc && this.props.fetchCatalogApiDates) {
4030
4121
  let payload =
4031
4122
  this.props.catalogapi &&
@@ -4044,13 +4135,12 @@ class MenuWidget extends React.Component {
4044
4135
  }
4045
4136
  return;
4046
4137
  } else if (this.productId?.includes('333e4100b79045daa0ff16466ac83b7f')) {
4047
- //global dynamic landCover
4048
4138
  this.findDatasetBoundingBox(elem);
4049
4139
 
4050
4140
  BBoxes = this.parseBBOXJSON(this.dataBBox);
4051
4141
  } else if (
4052
- this.productId?.includes('fe8209dffe13454891cea05998c8e456') || // Low Resolution Vegetation Parameters
4053
- this.productId?.includes('8914fde2241a4035818af8f0264fd55e') // Water Parameters
4142
+ this.productId?.includes('fe8209dffe13454891cea05998c8e456') ||
4143
+ this.productId?.includes('8914fde2241a4035818af8f0264fd55e')
4054
4144
  ) {
4055
4145
  if (
4056
4146
  this.layers[elem.id].fullExtents &&
@@ -4063,7 +4153,7 @@ class MenuWidget extends React.Component {
4063
4153
  ymin: -20037508.342789,
4064
4154
  xmax: 20037508.342789,
4065
4155
  ymax: 20037508.342789,
4066
- spatialReference: 3857, // by default wkid 4326
4156
+ spatialReference: 3857,
4067
4157
  });
4068
4158
  this.view.goTo(myExtent);
4069
4159
  }
@@ -4090,7 +4180,6 @@ class MenuWidget extends React.Component {
4090
4180
  firstLayer = BBoxes.dataset;
4091
4181
  }
4092
4182
  if (productIds?.includes(this.productId)) {
4093
- // Your code here for when productIds includes this.productId
4094
4183
  let str = elem.parentNode.outerHTML;
4095
4184
  let match = str.match(/layerid="([a-zA-Z0-9_:-]+)"/);
4096
4185
  let layerid = match ? match[1] : null;
@@ -4099,8 +4188,6 @@ class MenuWidget extends React.Component {
4099
4188
  this.productId?.includes('130299ac96e54c30a12edd575eff80f7') &&
4100
4189
  layerid.length <= 2
4101
4190
  ) {
4102
- //let match = str.match(/layerid="(\d+)"/);
4103
- //let layerid = match ? match[1] : null;
4104
4191
  if (this.url?.toLowerCase().endsWith('mapserver')) {
4105
4192
  switch (layerid) {
4106
4193
  case '1':
@@ -4174,7 +4261,6 @@ class MenuWidget extends React.Component {
4174
4261
  ) {
4175
4262
  firstLayer = BBoxes['all_present_lc_a_pol'];
4176
4263
  } else if (serviceLayer) {
4177
- // Full extent treatment for service layers
4178
4264
  firstLayer = BBoxes['dataset'];
4179
4265
  } else {
4180
4266
  firstLayer = BBoxes[elem.attributes.layerid.value];
@@ -4185,9 +4271,8 @@ class MenuWidget extends React.Component {
4185
4271
  ymin: firstLayer.ymin,
4186
4272
  xmax: firstLayer.xmax,
4187
4273
  ymax: firstLayer.ymax,
4188
- // spatialReference: 4326 // by default wkid 4326
4189
4274
  });
4190
- this.view.goTo(myExtent); //
4275
+ this.view.goTo(myExtent);
4191
4276
  }
4192
4277
  this.url = null;
4193
4278
  }