@eeacms/volto-arcgis-block 0.1.164 → 0.1.166

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,19 @@ 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.166](https://github.com/eea/volto-arcgis-block/compare/0.1.165...0.1.166) - 4 July 2023
8
+
9
+ ### [0.1.165](https://github.com/eea/volto-arcgis-block/compare/0.1.164...0.1.165) - 4 July 2023
10
+
11
+ #### :hammer_and_wrench: Others
12
+
13
+ - FIX: Pan constraint modified. Now Hotspot filter zoom in properly to AOI [martinman - [`eb67204`](https://github.com/eea/volto-arcgis-block/commit/eb672041609a647170782d89d4d601debe713c65)]
14
+ - FIX: Pan constraint modified. Now Hotspot filter zoom in properly to AOI [martinman - [`2871e7f`](https://github.com/eea/volto-arcgis-block/commit/2871e7f9be9e32d12ed59f147172f5688a046dc7)]
15
+ - CLMS-HOT-SPOT-FIXES (bug): Bug fixes and some improvements [ujbolivar - [`3f8ee8c`](https://github.com/eea/volto-arcgis-block/commit/3f8ee8cae8ec0559d0118639ac5a52c5547e1f0d)]
16
+ - Merge [martinman - [`3923505`](https://github.com/eea/volto-arcgis-block/commit/3923505e0fab2521c116ee8b2ea785278b3db04a)]
17
+ - Commit. Then create brach for issue with Timor Leste [martinman - [`62e065a`](https://github.com/eea/volto-arcgis-block/commit/62e065a3d5d37e35c44520e7c66f4908db44cfbe)]
18
+ - Commit. Then create brach for issue with Timor Leste [martinman - [`570a92b`](https://github.com/eea/volto-arcgis-block/commit/570a92b98ff788b3d0f5a7f83c60574335afbc99)]
19
+ - CLMS-2300 (bug): Selected region is preserved in dropdown, even when changing datasets if that region exists in both. Not completed [ujbolivar - [`783a6e3`](https://github.com/eea/volto-arcgis-block/commit/783a6e333a755a6cb0fd648fc1b60b3afdce6867)]
7
20
  ### [0.1.164](https://github.com/eea/volto-arcgis-block/compare/0.1.163...0.1.164) - 3 July 2023
8
21
 
9
22
  ### [0.1.163](https://github.com/eea/volto-arcgis-block/compare/0.1.162...0.1.163) - 29 June 2023
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-arcgis-block",
3
- "version": "0.1.164",
3
+ "version": "0.1.166",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -141,10 +141,11 @@ class AreaWidget extends React.Component {
141
141
  this.clearWidget();
142
142
 
143
143
  levels.forEach((level) => {
144
- var url = this.props.urls.nutsHandler;
145
144
  var layer = new FeatureLayer({
146
145
  id: id,
147
- url: url,
146
+ //url: this.props.urls.nutsHandler,
147
+ url:
148
+ 'https://land.discomap.eea.europa.eu/arcgis/rest/services/CLMS_Portal/NUTS_2021_Improved/MapServer/',
148
149
  layerId: level,
149
150
  outFields: ['*'],
150
151
  popupEnabled: false,
@@ -163,7 +164,9 @@ class AreaWidget extends React.Component {
163
164
  this.clearWidget();
164
165
  var layer = new FeatureLayer({
165
166
  id: id,
166
- url: this.props.urls.outsideEu,
167
+ //url: this.props.urls.outsideEu,
168
+ url:
169
+ 'https://land.discomap.eea.europa.eu/arcgis/rest/services/CLMS_Portal/World_countries_except_EU37/MapServer',
167
170
  layerId: 0,
168
171
  outFields: ['*'],
169
172
  popupEnabled: false,
@@ -257,6 +260,7 @@ class AreaWidget extends React.Component {
257
260
  'block';
258
261
  }
259
262
  }
263
+
260
264
  /**
261
265
  * This method is executed after the rener method is executed
262
266
  */
@@ -292,7 +296,12 @@ class AreaWidget extends React.Component {
292
296
  if (graphic) {
293
297
  let geometry = graphic.geometry;
294
298
  if (geometry.type === 'polygon') {
295
- let nuts = graphic.attributes.NUTS_ID;
299
+ let nuts;
300
+ if ('countries'.includes(graphic.layer.id)) {
301
+ nuts = graphic.attributes.ISO_2DIGIT;
302
+ } else {
303
+ nuts = graphic.attributes.NUTS_ID;
304
+ }
296
305
  this.props.updateArea(nuts);
297
306
  let symbol = new SimpleFillSymbol(
298
307
  'solid',
@@ -30,7 +30,7 @@ class HotspotWidget extends React.Component {
30
30
  this.esriLayer_pa = null;
31
31
  this.esriLayer_pa2 = null;
32
32
  this.subscribedLayers = sessionStorage;
33
- this.checkedLayers = [];
33
+ this.checkedLayers = {};
34
34
  this.dataBBox = [];
35
35
  this.dataJSONNames = [];
36
36
  this.klcHighlightsArray = [];
@@ -41,8 +41,11 @@ class HotspotWidget extends React.Component {
41
41
  this.layerModelInit = this.layerModelInit.bind(this);
42
42
  this.getBBoxData = this.getBBoxData.bind(this);
43
43
  this.handleApplyFilter = this.handleApplyFilter.bind(this);
44
+ this.mapCfg = this.props.mapCfg;
44
45
  //this.getLayerParameters();
45
46
  this.selectedArea = null;
47
+ this.lcYear = null;
48
+ this.lccYear = null;
46
49
  }
47
50
 
48
51
  loader() {
@@ -73,6 +76,19 @@ class HotspotWidget extends React.Component {
73
76
  let xmin_ymin = klc_bbox_coordinates[0].split(' ');
74
77
  let xmax_ymax = klc_bbox_coordinates[1].split(' ');
75
78
 
79
+ let constraintExtent = new Extent({
80
+ xmin: this.mapCfg.geometryZoomIn.xmin,
81
+ ymin: this.mapCfg.geometryZoomIn.ymin,
82
+ xmax: this.mapCfg.geometryZoomIn.xmax,
83
+ ymax: this.mapCfg.geometryZoomIn.ymax,
84
+ // xmin: -200,
85
+ // ymin: -85,
86
+ // xmax: 200,
87
+ // ymax: 85,
88
+ spatialReference: 4326,
89
+ });
90
+ this.props.view.constraints.geometry = constraintExtent;
91
+
76
92
  const regionExtent = new Extent({
77
93
  xmin: Number(xmin_ymin[0]) * 0.99,
78
94
  ymin: Number(xmin_ymin[1]) * 0.99,
@@ -227,6 +243,9 @@ class HotspotWidget extends React.Component {
227
243
  }
228
244
  typeFilter.forEach((type) => {
229
245
  if (type === 'lcc') {
246
+ let selectLccBoxTime = document.getElementById('select-klc-lccTime')
247
+ .value;
248
+ this.lccYear = selectLccBoxTime;
230
249
  var selectBoxHighlightsLcc = document
231
250
  .getElementById('select-klc-lccTime')
232
251
  .value.match(/\d+/g)
@@ -267,6 +286,9 @@ class HotspotWidget extends React.Component {
267
286
  ? (typeLegend = 'all_present_lc_a_pol')
268
287
  : (typeLegend = 'all_present_lc_b_pol');
269
288
  });
289
+ let selectLcBoxTime = document.getElementById('select-klc-lcTime')
290
+ .value;
291
+ this.lcYear = selectLcBoxTime;
270
292
  var selectBoxHighlightsLc = document
271
293
  .getElementById('select-klc-lcTime')
272
294
  .value.match(/\d+/g)
@@ -488,11 +510,20 @@ class HotspotWidget extends React.Component {
488
510
  var selectBoxLccTime;
489
511
  let modularKLCAreas = [];
490
512
  let dichotomousKLCAreas = [];
513
+ let checkedLayers =
514
+ JSON.parse(sessionStorage.getItem('checkedLayers')) || {};
491
515
 
492
- this.selectedArea = selectedOption;
493
516
  selectBox = document.getElementById('select-klc-area');
494
517
  selectBoxLccTime = document.getElementById('select-klc-lccTime');
495
518
  selectBoxLcTime = document.getElementById('select-klc-lcTime');
519
+
520
+ if (selectedOption !== this.selectedArea) {
521
+ this.lcYear = null;
522
+ this.lccYear = null;
523
+ }
524
+
525
+ this.selectedArea = selectedOption;
526
+
496
527
  for (let i = 0; i < data.length; i++) {
497
528
  var option = data[i].node.klc_name;
498
529
 
@@ -552,7 +583,6 @@ class HotspotWidget extends React.Component {
552
583
  new Option(optionLcTime, optionLcTime, optionLcTime),
553
584
  );
554
585
  }
555
- return;
556
586
  }
557
587
  }
558
588
  if (selectBox) {
@@ -565,35 +595,76 @@ class HotspotWidget extends React.Component {
565
595
  true,
566
596
  ),
567
597
  );
568
-
569
598
  selectBox.options[0].disabled = true;
570
599
  }
571
- let checkedLayers =
572
- JSON.parse(sessionStorage.getItem('checkedLayers')) || {};
573
-
574
- for (let a = 0; a < checkedLayers.length; a++) {
575
- if (
576
- checkedLayers[a].includes('all_lcc_b_pol') ||
577
- checkedLayers[a].includes('all_present_lc_b_pol')
578
- ) {
579
- for (let i = 0; i < modularKLCAreas.length; i++) {
580
- let option = modularKLCAreas[i];
581
- selectBox.options.add(new Option(option, option, option));
582
- }
583
- this.checkedLayers = checkedLayers;
584
- return;
585
- } else if (
586
- checkedLayers[a].includes('all_lcc_a_pol') ||
587
- checkedLayers[a].includes('all_present_lc_a_pol')
588
- ) {
589
- for (let i = 0; i < dichotomousKLCAreas.length; i++) {
590
- let option = dichotomousKLCAreas[i];
591
- selectBox.options.add(new Option(option, option, option));
600
+ if (checkedLayers.length) {
601
+ for (let a = 0; a < checkedLayers.length; a++) {
602
+ if (
603
+ checkedLayers[a].includes('all_lcc_b_pol') ||
604
+ checkedLayers[a].includes('all_present_lc_b_pol')
605
+ ) {
606
+ for (let i = 0; i < modularKLCAreas.length; i++) {
607
+ let option = modularKLCAreas[i];
608
+ selectBox.options.add(new Option(option, option, option));
609
+ }
610
+ this.checkedLayers = checkedLayers;
611
+ for (let u = 0; u < selectBox.options.length; u++) {
612
+ if (selectBox.options[u].label.includes(this.selectedArea)) {
613
+ selectBox.value = this.selectedArea;
614
+ if (this.lcYear === null) selectBoxLcTime.value = 'default';
615
+ else if (this.lccYear === null)
616
+ selectBoxLccTime.value = 'default';
617
+ else {
618
+ selectBoxLcTime.value = this.lcYear;
619
+ selectBoxLccTime.value = this.lccYear;
620
+ }
621
+ break;
622
+ } else {
623
+ selectBox.value = 'default';
624
+ selectBoxLcTime.value = 'default';
625
+ selectBoxLccTime.value = 'default';
626
+ }
627
+ }
628
+ break;
629
+ } else if (
630
+ checkedLayers[a].includes('all_lcc_a_pol') ||
631
+ checkedLayers[a].includes('all_present_lc_a_pol')
632
+ ) {
633
+ for (let i = 0; i < dichotomousKLCAreas.length; i++) {
634
+ let option = dichotomousKLCAreas[i];
635
+ selectBox.options.add(new Option(option, option, option));
636
+ }
637
+ this.checkedLayers = checkedLayers;
638
+ for (let u = 0; u < selectBox.options.length; u++) {
639
+ if (selectBox.options[u].label.includes(this.selectedArea)) {
640
+ selectBox.value = this.selectedArea;
641
+ //selectBoxLcTime.value = this.lcYear;
642
+ //selectBoxLccTime.value = this.lccYear;
643
+ break;
644
+ } else {
645
+ selectBox.value = 'default';
646
+ //selectBoxLcTime.value = 'default';
647
+ //selectBoxLccTime.value = 'default';
648
+ }
649
+ }
650
+ break;
592
651
  }
593
- this.checkedLayers = checkedLayers;
594
- return;
595
- } else {
596
- continue;
652
+ }
653
+ }
654
+ if (selectBox.value === 'default') {
655
+ if (selectBoxLcTime) {
656
+ this.removeOptions(selectBoxLcTime);
657
+ selectBoxLcTime.options.add(
658
+ new Option('Select a region first', 'default', true, true),
659
+ );
660
+ selectBoxLcTime.options[0].disabled = true;
661
+ }
662
+ if (selectBoxLccTime) {
663
+ this.removeOptions(selectBoxLccTime);
664
+ selectBoxLccTime.options.add(
665
+ new Option('Select a region first', 'default', true, true),
666
+ );
667
+ selectBoxLccTime.options[0].disabled = true;
597
668
  }
598
669
  }
599
670
  }
@@ -733,11 +804,5 @@ class HotspotWidget extends React.Component {
733
804
  JSON.parse(sessionStorage.getItem('checkedLayers')) || {};
734
805
  this.forceUpdate();
735
806
  };
736
-
737
- componentDidUpdate(prevProps) {
738
- if (prevProps.checkedLayers !== this.checkedLayers) {
739
- this.getKLCNames(this.dataJSONNames, this.selectedArea);
740
- }
741
- }
742
807
  }
743
808
  export default HotspotWidget;
@@ -54,7 +54,7 @@ class MapViewer extends React.Component {
54
54
  this.activeLayersHandler = this.activeLayersHandler.bind(this);
55
55
  this.activeLayersArray = {};
56
56
  this.props.mapviewer_config.loading = true;
57
- this.urlCfg = props.cfg.Urls;
57
+ this.cfgUrls = this.props.cfg.Urls;
58
58
  }
59
59
 
60
60
  activeLayersHandler(newActiveLayers) {
@@ -111,19 +111,18 @@ class MapViewer extends React.Component {
111
111
  * they are already mounted
112
112
  */
113
113
 
114
- waitForDataFill() {
115
- while (this.compCfg.length === 0) {
114
+ waitForDataFill(obj) {
115
+ while (obj.length === 0) {
116
116
  new Promise((resolve) => setTimeout(resolve, 100)); // wait for 100ms
117
117
  }
118
- return this.compCfg;
118
+ return obj;
119
119
  }
120
120
 
121
121
  async componentDidMount() {
122
122
  loadCss();
123
123
  await this.loader();
124
- this.state.url = window.location.href;
125
- await this.waitForDataFill();
126
-
124
+ // this.state.url = window.location.href;
125
+ await this.waitForDataFill(this.compCfg);
127
126
  this.positronCompositeBasemap = new Basemap({
128
127
  title: 'Positron composite',
129
128
  thumbnailUrl:
@@ -193,18 +192,18 @@ class MapViewer extends React.Component {
193
192
  this.setZoomState(newValue);
194
193
  if (mapStatus.zoom <= this.mapCfg.minZoom) {
195
194
  constraintExtent = new Extent({
196
- xmin: -90,
197
- ymin: -45,
198
- xmax: 90,
199
- ymax: 45,
195
+ xmin: this.mapCfg.geometry.xmin,
196
+ ymin: this.mapCfg.geometry.ymin,
197
+ xmax: this.mapCfg.geometry.xmax,
198
+ ymax: this.mapCfg.geometry.ymax,
200
199
  spatialReference: 4326,
201
200
  });
202
201
  } else {
203
202
  constraintExtent = new Extent({
204
- xmin: -90,
205
- ymin: -85,
206
- xmax: 90,
207
- ymax: 85,
203
+ xmin: this.mapCfg.geometryZoomIn.xmin,
204
+ ymin: this.mapCfg.geometryZoomIn.ymin,
205
+ xmax: this.mapCfg.geometryZoomIn.xmax,
206
+ ymax: this.mapCfg.geometryZoomIn.ymax,
208
207
  spatialReference: 4326,
209
208
  });
210
209
  }
@@ -226,27 +225,11 @@ class MapViewer extends React.Component {
226
225
  }
227
226
 
228
227
  componentDidUpdate(prevProps, prevState) {
229
- if (this.location.search !== '') {
228
+ if (this.props.Download || (this.location && this.location.search !== '')) {
230
229
  let toc_panel_scrolls = sessionStorage.getItem('toc_panel_scrolls');
231
230
  sessionStorage.clear();
232
231
  sessionStorage.setItem('toc_panel_scrolls', toc_panel_scrolls);
233
232
  }
234
-
235
- mapStatus = this.recoverState();
236
-
237
- if (
238
- mapStatus === null ||
239
- (mapStatus.zoom === null && mapStatus.center === null) ||
240
- Object.entries(mapStatus).length === 0
241
- ) {
242
- mapStatus = {};
243
- mapStatus.zoom = this.mapCfg.zoom;
244
- mapStatus.center = this.mapCfg.center;
245
- mapStatus.activeLayers = this.mapCfg.activeLayers;
246
- this.setCenterState(this.mapCfg.center);
247
- this.setZoomState(this.mapCfg.zoom);
248
- this.activeLayersHandler(this.mapCfg.activeLayers);
249
- }
250
233
  }
251
234
 
252
235
  componentWillUnmount() {
@@ -341,6 +324,7 @@ class MapViewer extends React.Component {
341
324
  selectedLayers={this.layers}
342
325
  mapViewer={this}
343
326
  layers={sessionStorage}
327
+ mapCfg={this.mapCfg}
344
328
  />
345
329
  );
346
330
  }
@@ -349,7 +333,7 @@ class MapViewer extends React.Component {
349
333
  if (this.view)
350
334
  return (
351
335
  <MenuWidget
352
- location={this.props.location}
336
+ location={this.location}
353
337
  view={this.view}
354
338
  conf={this.props.mapviewer_config.Components}
355
339
  download={this.props.mapviewer_config.Download}
@@ -359,6 +343,7 @@ class MapViewer extends React.Component {
359
343
  area={this.state.area}
360
344
  layers={this.layers}
361
345
  activeLayersHandler={this.activeLayersHandler}
346
+ urls={this.cfgUrls}
362
347
  />
363
348
  ); //call conf
364
349
  }
@@ -414,7 +399,7 @@ export const CheckLogin = ({ reference }) => {
414
399
  mapViewer={reference}
415
400
  download={reference.props.mapviewer_config.Download}
416
401
  updateArea={reference.updateArea}
417
- urls={reference.urlCfg}
402
+ urls={reference.cfgUrls}
418
403
  />
419
404
  )}
420
405
  </>
@@ -581,7 +581,6 @@ class MenuWidget extends React.Component {
581
581
  async componentDidMount() {
582
582
  loadCss();
583
583
  await this.loader();
584
- this.state.url = window.location.href;
585
584
  await this.getTMSLayersJSON();
586
585
  this.props.view.ui.add(this.container.current, 'top-left');
587
586
  if (this.props.download) {
@@ -1608,6 +1607,16 @@ class MenuWidget extends React.Component {
1608
1607
  }
1609
1608
  }
1610
1609
  if (productContainerId === 'd764e020485a402598551fa461bf1db2') {
1610
+ // if (this.layers['lc_filter'] || this.layers['lcc_filter']) {
1611
+ // let myExtent = new Extent({
1612
+ // xmin: -2037508.342789,
1613
+ // ymin: -2037508.342789,
1614
+ // xmax: 8037508.342789,
1615
+ // ymax: 8037508.342789,
1616
+ // spatialReference: 3857, // by default wkid 4326
1617
+ // });
1618
+ // this.view.goTo(myExtent);
1619
+ // }
1611
1620
  if (nextElemSibling) {
1612
1621
  siblingInput = nextElemSibling.querySelector('input');
1613
1622
  } else if (previousElemSibling) {
@@ -1660,7 +1669,7 @@ class MenuWidget extends React.Component {
1660
1669
  if (this.props.download || this.location.search !== '') {
1661
1670
  if (
1662
1671
  this.extentInitiated === false &&
1663
- productContainerId !== 'd764e020485a402598551fa461bf1db2'
1672
+ productContainerId !== 'd764e020485a402598551fa461bf1db2' //hotspot
1664
1673
  ) {
1665
1674
  this.extentInitiated = true;
1666
1675
  setTimeout(() => {
@@ -2073,6 +2082,8 @@ class MenuWidget extends React.Component {
2073
2082
  );
2074
2083
  let BBoxes = {};
2075
2084
  let layerGeoGraphic = {};
2085
+ let xList = [];
2086
+ let yList = [];
2076
2087
  for (let i in layersChildren) {
2077
2088
  if (
2078
2089
  layersChildren[i].querySelector('EX_GeographicBoundingBox') !== null
@@ -2101,25 +2112,48 @@ class MenuWidget extends React.Component {
2101
2112
  layerGeoGraphic.querySelector('northBoundLatitude').innerText,
2102
2113
  ),
2103
2114
  };
2104
- }
2115
+ xList.push(
2116
+ BBoxes[layersChildren[i].querySelector('Name').innerText].xmin,
2117
+ );
2118
+ yList.push(
2119
+ BBoxes[layersChildren[i].querySelector('Name').innerText].ymin,
2120
+ );
2121
+ xList.push(
2122
+ BBoxes[layersChildren[i].querySelector('Name').innerText].xmax,
2123
+ );
2124
+ yList.push(
2125
+ BBoxes[layersChildren[i].querySelector('Name').innerText].ymax,
2126
+ );
2127
+ } // For loop
2105
2128
  // Add dataset bbox
2106
- layerGeoGraphic = layerParent[0].querySelector('EX_GeographicBoundingBox');
2107
2129
  BBoxes['dataset'] = {
2108
- xmin: Number(
2109
- layerGeoGraphic.querySelector('westBoundLongitude').innerText,
2110
- ),
2111
- ymin: Number(
2112
- layerGeoGraphic.querySelector('southBoundLatitude').innerText,
2113
- ),
2114
- xmax: Number(
2115
- layerGeoGraphic.querySelector('eastBoundLongitude').innerText,
2116
- ),
2117
- ymax: Number(
2118
- layerGeoGraphic.querySelector('northBoundLatitude').innerText,
2119
- ),
2130
+ xmin: Math.min.apply(Math, xList),
2131
+ ymin: Math.min.apply(Math, yList),
2132
+ xmax: Math.max.apply(Math, xList),
2133
+ ymax: Math.max.apply(Math, yList),
2120
2134
  };
2135
+ // layerGeoGraphic = layerParent[0].querySelector('EX_GeographicBoundingBox');
2136
+ // BBoxes['dataset'] = {
2137
+ // xmin: Number(
2138
+ // layerGeoGraphic.querySelector('westBoundLongitude').innerText,
2139
+ // ),
2140
+ // ymin: Number(
2141
+ // layerGeoGraphic.querySelector('southBoundLatitude').innerText,
2142
+ // ),
2143
+ // xmax: Number(
2144
+ // layerGeoGraphic.querySelector('eastBoundLongitude').innerText,
2145
+ // ),
2146
+ // ymax: Number(
2147
+ // layerGeoGraphic.querySelector('northBoundLatitude').innerText,
2148
+ // ),
2149
+ // };
2121
2150
  return BBoxes;
2122
2151
  } // function parseWMS
2152
+
2153
+ parseCapabilities(xml, tag) {
2154
+ return xml.getElementsByTagName(tag);
2155
+ }
2156
+
2123
2157
  // Web Map Tiled Services WMTS
2124
2158
  parseBBOXWMTS(xml) {
2125
2159
  let BBoxes = {};
@@ -2134,6 +2168,9 @@ class MenuWidget extends React.Component {
2134
2168
  );
2135
2169
  let LowerCorner,
2136
2170
  UpperCorner = [];
2171
+ let xList = [];
2172
+ let yList = [];
2173
+ let title = '';
2137
2174
  for (let i in layersChildren) {
2138
2175
  if (
2139
2176
  this.parseCapabilities(layersChildren[i], 'ows:LowerCorner').length !==
@@ -2161,41 +2198,49 @@ class MenuWidget extends React.Component {
2161
2198
  'ows:UpperCorner',
2162
2199
  )[0].innerText.split(' ');
2163
2200
  }
2164
- BBoxes[
2165
- this.parseCapabilities(layersChildren[i], 'ows:Title')[0].innerText
2166
- ] = {
2201
+ title = this.parseCapabilities(layersChildren[i], 'ows:Title')[0]
2202
+ .innerText;
2203
+ BBoxes[title] = {
2167
2204
  xmin: Number(LowerCorner[0]),
2168
2205
  ymin: Number(LowerCorner[1]),
2169
2206
  xmax: Number(UpperCorner[0]),
2170
2207
  ymax: Number(UpperCorner[1]),
2171
2208
  };
2172
- }
2173
- if (
2174
- typeof layerParent === 'object' &&
2175
- layerParent !== null &&
2176
- 'getElementsByTagName' in layerParent
2177
- ) {
2178
- LowerCorner = this.parseCapabilities(
2179
- layerParent,
2180
- 'ows:LowerCorner',
2181
- )[0]?.innerText.split(' ');
2182
- UpperCorner = this.parseCapabilities(
2183
- layerParent,
2184
- 'ows:UpperCorner',
2185
- )[0].innerText.split(' ');
2186
-
2187
- BBoxes['dataset'] = {
2188
- xmin: Number(LowerCorner[0]),
2189
- ymin: Number(LowerCorner[1]),
2190
- xmax: Number(UpperCorner[0]),
2191
- ymax: Number(UpperCorner[1]),
2192
- };
2193
- }
2194
- return BBoxes;
2195
- }
2209
+ xList.push(BBoxes[title].xmin);
2210
+ yList.push(BBoxes[title].ymin);
2211
+ xList.push(BBoxes[title].xmax);
2212
+ yList.push(BBoxes[title].ymax);
2213
+ } // For loop
2196
2214
 
2197
- parseCapabilities(xml, tag) {
2198
- return xml.getElementsByTagName(tag);
2215
+ BBoxes['dataset'] = {
2216
+ xmin: Math.min.apply(Math, xList),
2217
+ ymin: Math.min.apply(Math, yList),
2218
+ xmax: Math.max.apply(Math, xList),
2219
+ ymax: Math.max.apply(Math, yList),
2220
+ };
2221
+
2222
+ // if (
2223
+ // typeof layerParent === 'object' &&
2224
+ // layerParent !== null &&
2225
+ // 'getElementsByTagName' in layerParent
2226
+ // ) {
2227
+ // LowerCorner = this.parseCapabilities(
2228
+ // layerParent,
2229
+ // 'ows:LowerCorner',
2230
+ // )[0]?.innerText.split(' ');
2231
+ // UpperCorner = this.parseCapabilities(
2232
+ // layerParent,
2233
+ // 'ows:UpperCorner',
2234
+ // )[0].innerText.split(' ');
2235
+
2236
+ // BBoxes['dataset'] = {
2237
+ // xmin: Number(LowerCorner[0]),
2238
+ // ymin: Number(LowerCorner[1]),
2239
+ // xmax: Number(UpperCorner[0]),
2240
+ // ymax: Number(UpperCorner[1]),
2241
+ // };
2242
+ // }
2243
+ return BBoxes;
2199
2244
  }
2200
2245
 
2201
2246
  getCapabilities = (url, serviceType) => {
@@ -2221,12 +2266,13 @@ class MenuWidget extends React.Component {
2221
2266
  let firstLayer;
2222
2267
 
2223
2268
  if (this.productId.includes('333e4100b79045daa0ff16466ac83b7f')) {
2269
+ //global dynamic landCover
2224
2270
  this.findDatasetBoundingBox(elem);
2225
2271
 
2226
2272
  BBoxes = this.parseBBOXJSON(this.dataBBox);
2227
2273
  } else if (
2228
- this.productId.includes('fe8209dffe13454891cea05998c8e456') ||
2229
- this.productId.includes('8914fde2241a4035818af8f0264fd55e')
2274
+ this.productId.includes('fe8209dffe13454891cea05998c8e456') || //Low Resolution Vegetation Parameters
2275
+ this.productId.includes('8914fde2241a4035818af8f0264fd55e') // Water Parameters
2230
2276
  ) {
2231
2277
  if (
2232
2278
  this.layers[elem.id].fullExtents &&
@@ -2241,12 +2287,10 @@ class MenuWidget extends React.Component {
2241
2287
  ymax: 20037508.342789,
2242
2288
  spatialReference: 3857, // by default wkid 4326
2243
2289
  });
2244
-
2245
2290
  this.view.goTo(myExtent);
2246
2291
  }
2247
2292
  } else if (this.url.toLowerCase().includes('wms')) {
2248
2293
  await this.getCapabilities(this.url, 'wms');
2249
-
2250
2294
  BBoxes = this.parseBBOXWMS(this.xml);
2251
2295
  } else if (this.url.toLowerCase().includes('wmts')) {
2252
2296
  await this.getCapabilities(this.url, 'wmts');
@@ -2262,16 +2306,16 @@ class MenuWidget extends React.Component {
2262
2306
  if (
2263
2307
  this.extentInitiated === false &&
2264
2308
  !this.productId.includes('333e4100b79045daa0ff16466ac83b7f') &&
2265
- !(
2266
- this.state.url === 'http://localhost:3000/en/map-viewer' ||
2267
- this.state.url ===
2268
- 'https://clmsdemo.devel6cph.eea.europa.eu/en/map-viewer' ||
2269
- this.state.url === 'https://clms-prod.eea.europa.eu/en/map-viewer'
2270
- )
2309
+ this.location.search !== ''
2271
2310
  ) {
2311
+ // firstLayer = BBoxes['dataset'];
2272
2312
  firstLayer = BBoxes.dataset;
2273
2313
  } else if (this.productId.includes('130299ac96e54c30a12edd575eff80f7')) {
2274
- if (elem.title.includes('Guadeloupe')) {
2314
+ //corine land cover
2315
+ //
2316
+ if (elem.title.includes('LAEA')) {
2317
+ firstLayer = BBoxes['dataset'];
2318
+ } else if (elem.title.includes('Guadeloupe')) {
2275
2319
  firstLayer = BBoxes[Object.keys(BBoxes)[0]];
2276
2320
  } else if (elem.title.includes('French Guiana')) {
2277
2321
  firstLayer = BBoxes[Object.keys(BBoxes)[1]];
@@ -2282,8 +2326,8 @@ class MenuWidget extends React.Component {
2282
2326
  } else if (elem.title.includes('Reunion')) {
2283
2327
  firstLayer = BBoxes[Object.keys(BBoxes)[4]];
2284
2328
  } else {
2285
- firstLayer =
2286
- BBoxes[Object.keys(BBoxes)[Object.keys(BBoxes).length - 1]];
2329
+ // firstLayer = BBoxes[Object.keys(BBoxes)[Object.keys(BBoxes).length - 1]];
2330
+ firstLayer = BBoxes['dataset'];
2287
2331
  }
2288
2332
  } else if (
2289
2333
  elem.id.includes('all_present') ||
@@ -2293,7 +2337,9 @@ class MenuWidget extends React.Component {
2293
2337
  ) {
2294
2338
  firstLayer = BBoxes['all_present_lc_a_pol'];
2295
2339
  } else {
2296
- firstLayer = BBoxes[Object.keys(BBoxes)[0]];
2340
+ // Takes the BBOX corresponding to the layer.
2341
+ firstLayer = BBoxes[elem.attributes.layerid.value];
2342
+ // firstLayer = BBoxes[Object.keys(BBoxes)[0]];
2297
2343
  }
2298
2344
 
2299
2345
  let myExtent = new Extent({
@@ -2303,7 +2349,7 @@ class MenuWidget extends React.Component {
2303
2349
  ymax: firstLayer.ymax,
2304
2350
  // spatialReference: 4326 // by default wkid 4326
2305
2351
  });
2306
- this.view.goTo(myExtent);
2352
+ this.view.goTo(myExtent); //
2307
2353
  }
2308
2354
  }
2309
2355
  /**
@@ -2914,6 +2960,7 @@ class MenuWidget extends React.Component {
2914
2960
  this.checkInfoWidget();
2915
2961
  this.setState({});
2916
2962
  if (this.productId.includes('333e4100b79045daa0ff16466ac83b7f')) {
2963
+ // global dynamic land cover
2917
2964
  if (this.visibleLayers[elem.id][1] === 'eye-slash') {
2918
2965
  this.map.findLayerById(elem.id).visible = false;
2919
2966
  } else {
@@ -12,6 +12,13 @@ const config = {
12
12
  xmax: 90,
13
13
  ymax: 45,
14
14
  },
15
+ geometryZoomIn: {
16
+ type: 'extent',
17
+ xmin: -200,
18
+ ymin: -85,
19
+ xmax: 200,
20
+ ymax: 85,
21
+ },
15
22
  activeLayers: [],
16
23
  },
17
24
  Components: [