@eeacms/volto-arcgis-block 0.1.126 → 0.1.128

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,17 @@ 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.128](https://github.com/eea/volto-arcgis-block/compare/0.1.127...0.1.128) - 21 April 2023
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - CLMS-1763 (fix):Applied internal filter in the map viewer to show only the relevant KLC borders and the PAs [Urkorue - [`3ef7ff2`](https://github.com/eea/volto-arcgis-block/commit/3ef7ff2eff491f40b584f84ff73150f7e8bd3c9e)]
12
+ ### [0.1.127](https://github.com/eea/volto-arcgis-block/compare/0.1.126...0.1.127) - 20 April 2023
13
+
14
+ #### :hammer_and_wrench: Others
15
+
16
+ - CLMS-1838 (fix): Area Widget runs improved NUTS service [ujbolivar - [`6cd1a91`](https://github.com/eea/volto-arcgis-block/commit/6cd1a91f2dbf176455827f271fff53ce629b6cd5)]
17
+ - CLMS-1838 (feat): improved NUTS service prepared the script for later [ujbolivar - [`0b0a88b`](https://github.com/eea/volto-arcgis-block/commit/0b0a88bc5e37518870db616f6f43deb52e40e96d)]
7
18
  ### [0.1.126](https://github.com/eea/volto-arcgis-block/compare/0.1.125...0.1.126) - 19 April 2023
8
19
 
9
20
  #### :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.126",
3
+ "version": "0.1.128",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -122,32 +122,37 @@ class AreaWidget extends React.Component {
122
122
  }
123
123
  }
124
124
  nuts0handler(e) {
125
- this.loadNutsService(e.target.value, 0);
125
+ this.loadNutsService(e.target.value, [0]);
126
126
  }
127
127
  nuts1handler(e) {
128
- this.loadNutsService(e.target.value, 1);
128
+ this.loadNutsService(e.target.value, [1, 2]);
129
129
  }
130
130
  nuts2handler(e) {
131
- this.loadNutsService(e.target.value, 2);
131
+ this.loadNutsService(e.target.value, [3, 4, 5]);
132
132
  }
133
133
  nuts3handler(e) {
134
- this.loadNutsService(e.target.value, 3);
134
+ this.loadNutsService(e.target.value, [6, 7, 8]);
135
135
  }
136
- loadNutsService(id, level) {
136
+ loadNutsService(id, levels) {
137
137
  this.clearWidget();
138
138
 
139
- var url =
140
- 'https://trial.discomap.eea.europa.eu/arcgis/rest/services/CLMS/NUTS_2021/MapServer/0';
141
- var layer = new FeatureLayer({
142
- url: url,
143
- id: id,
144
- outFields: ['*'],
145
- popupEnabled: false,
146
- definitionExpression: 'LEVL_CODE=' + level,
139
+ levels.forEach((level) => {
140
+ var url = `https://trial.discomap.eea.europa.eu/arcgis/rest/services/CLMS/NUTS_2021_Improved/MapServer/`;
141
+ var layer = new FeatureLayer({
142
+ id: id,
143
+ url: url,
144
+ layerId: level,
145
+ outFields: ['*'],
146
+ popupEnabled: false,
147
+ //definitionExpression: 'LEVL_CODE=' + level,
148
+ });
149
+
150
+ this.nutsGroupLayer.add(layer);
151
+
152
+ let index = this.getHighestIndex();
153
+
154
+ this.props.map.reorder(this.nutsGroupLayer, index + 1);
147
155
  });
148
- this.nutsGroupLayer.add(layer);
149
- let index = this.getHighestIndex();
150
- this.props.map.reorder(this.nutsGroupLayer, index + 1);
151
156
  }
152
157
  getHighestIndex() {
153
158
  let index = 0;
@@ -234,7 +239,7 @@ class AreaWidget extends React.Component {
234
239
  await this.loader();
235
240
  this.nutsGroupLayer = new GroupLayer({
236
241
  title: 'nuts',
237
- opacity: 0.5,
242
+ //opacity: 0.5,
238
243
  });
239
244
  this.props.map.add(this.nutsGroupLayer);
240
245
  this.props.view.on('click', (event) => {
@@ -25,6 +25,10 @@ class HotspotWidget extends React.Component {
25
25
  this.esriLayer_lcc2 = null;
26
26
  this.esriLayer_lc = null;
27
27
  this.esriLayer_lc2 = null;
28
+ this.esriLayer_klc = null;
29
+ this.esriLayer_klc2 = null;
30
+ this.esriLayer_pa = null;
31
+ this.esriLayer_pa2 = null;
28
32
  this.subscribedLayers = sessionStorage;
29
33
  this.checkedLayers = this.props.layers
30
34
  ? this.props.layers.checkedLayers
@@ -119,6 +123,28 @@ class HotspotWidget extends React.Component {
119
123
  },
120
124
  ],
121
125
  });
126
+ this.esriLayer_klc = new WMSLayer({
127
+ url: serviceUrl,
128
+ //featureInfoFormat: "application/json",
129
+ customLayerParameters: {},
130
+ sublayers: [
131
+ {
132
+ name: this.addLegendName('cop_klc'),
133
+ legendUrl: this.addLegendNameToUrl('cop_klc'),
134
+ },
135
+ ],
136
+ });
137
+ this.esriLayer_pa = new WMSLayer({
138
+ url: serviceUrl,
139
+ //featureInfoFormat: "application/json",
140
+ customLayerParameters: {},
141
+ sublayers: [
142
+ {
143
+ name: this.addLegendName('protected_areas'),
144
+ legendUrl: this.addLegendNameToUrl('protected_areas'),
145
+ },
146
+ ],
147
+ });
122
148
  }
123
149
 
124
150
  handleApplyFilter(typeFilter) {
@@ -134,12 +160,28 @@ class HotspotWidget extends React.Component {
134
160
  );
135
161
  if (currentLcLayer) delete this.props.selectedLayers[currentLcLayer];
136
162
 
163
+ var currentKlcLayer = Object.keys(this.props.selectedLayers).find((e) =>
164
+ e.includes('klc_filter'),
165
+ );
166
+ if (currentKlcLayer) delete this.props.selectedLayers[currentKlcLayer];
167
+
168
+ var currentPaLayer = Object.keys(this.props.selectedLayers).find((e) =>
169
+ e.includes('pa_filter'),
170
+ );
171
+ if (currentPaLayer) delete this.props.selectedLayers[currentPaLayer];
172
+
137
173
  var currentLcckey = Object.keys(this.props.selectedLayers).find((e) =>
138
174
  e.includes('all_lcc'),
139
175
  );
140
176
  var currentLckey = Object.keys(this.props.selectedLayers).find((e) =>
141
177
  e.includes('all_present_lc'),
142
178
  );
179
+ var currentKlckey = Object.keys(this.props.selectedLayers).find((e) =>
180
+ e.includes('cop_klc'),
181
+ );
182
+ var currentPakey = Object.keys(this.props.selectedLayers).find((e) =>
183
+ e.includes('protected_areas'),
184
+ );
143
185
  if (currentLcckey) {
144
186
  //this.props.map.remove(this.props.selectedLayers[currentLcckey]);
145
187
  this.props.selectedLayers[currentLcckey].visible = false;
@@ -148,6 +190,14 @@ class HotspotWidget extends React.Component {
148
190
  //this.props.map.remove(this.props.selectedLayers[currentLckey]);
149
191
  this.props.selectedLayers[currentLckey].visible = false;
150
192
  }
193
+ if (currentKlckey) {
194
+ //this.props.map.remove(this.props.selectedLayers[currentKlckey]);
195
+ this.props.selectedLayers[currentKlckey].visible = false;
196
+ }
197
+ if (currentPakey) {
198
+ //this.props.map.remove(this.props.selectedLayers[currentPakey]);
199
+ this.props.selectedLayers[currentPakey].visible = false;
200
+ }
151
201
  }
152
202
  typeFilter.forEach((type) => {
153
203
  if (type === 'lcc') {
@@ -161,7 +211,7 @@ class HotspotWidget extends React.Component {
161
211
  ? 'all_lcc_a_pol'
162
212
  : 'all_lcc_b_pol';
163
213
  if (this.esriLayer_lcc !== null) {
164
- if (this.esriLayer_lcc2 != null) {
214
+ if (this.esriLayer_lcc2 !== null) {
165
215
  this.props.map.remove(this.esriLayer_lcc2);
166
216
  }
167
217
 
@@ -196,7 +246,7 @@ class HotspotWidget extends React.Component {
196
246
  .value.match(/\d+/g)
197
247
  .map(Number)[0];
198
248
  if (this.esriLayer_lc !== null) {
199
- if (this.esriLayer_lc2 != null) {
249
+ if (this.esriLayer_lc2 !== null) {
200
250
  this.props.map.remove(this.esriLayer_lc2);
201
251
  }
202
252
  this.esriLayer_lc.sublayers.items[0].name = this.addLegendName(
@@ -219,6 +269,34 @@ class HotspotWidget extends React.Component {
219
269
  this.layerModelInit();
220
270
  }
221
271
  }
272
+ if (type === 'klc') {
273
+ if (this.esriLayer_klc !== null) {
274
+ if (this.esriLayer_klc2 !== null) {
275
+ this.props.map.remove(this.esriLayer_klc2);
276
+ }
277
+ this.esriLayer_klc.customLayerParameters['CQL_FILTER'] =
278
+ "klc_code LIKE '" + this.dataKlc_code + "'";
279
+ this.props.map.add(this.esriLayer_klc);
280
+ this.props.selectedLayers['klc_filter'] = this.esriLayer_klc;
281
+ this.props.selectedLayers['klc_filter'].visible = true;
282
+ this.esriLayer_klc2 = this.esriLayer_klc;
283
+ this.layerModelInit();
284
+ }
285
+ }
286
+ if (type === 'pa') {
287
+ if (this.esriLayer_pa !== null) {
288
+ if (this.esriLayer_pa2 !== null) {
289
+ this.props.map.remove(this.esriLayer_pa2);
290
+ }
291
+ this.esriLayer_pa.customLayerParameters['CQL_FILTER'] =
292
+ "klc_code LIKE '" + this.dataKlc_code + "'";
293
+ this.props.map.add(this.esriLayer_pa);
294
+ this.props.selectedLayers['pa_filter'] = this.esriLayer_pa;
295
+ this.props.selectedLayers['pa_filter'].visible = true;
296
+ this.esriLayer_pa2 = this.esriLayer_pa;
297
+ this.layerModelInit();
298
+ }
299
+ }
222
300
  this.setBBoxCoordinates(this.dataBBox);
223
301
  });
224
302
  //set sessionStorage value to keep the widget open
@@ -311,7 +389,15 @@ class HotspotWidget extends React.Component {
311
389
  ) {
312
390
  typeFilter.push('lcc');
313
391
  }
314
-
392
+ let checkedLayers = JSON.parse(sessionStorage.getItem('checkedLayers'));
393
+ checkedLayers.forEach((layer) => {
394
+ if (layer.match('cop_klc')) {
395
+ typeFilter.push('klc');
396
+ }
397
+ if (layer.match('protected_areas')) {
398
+ typeFilter.push('pa');
399
+ }
400
+ });
315
401
  return this.handleApplyFilter(typeFilter);
316
402
  }
317
403
 
@@ -2387,6 +2387,12 @@ class MenuWidget extends React.Component {
2387
2387
  } else if (this.layers['lc_filter'] && layer.includes('all_present')) {
2388
2388
  this.layers['lc_filter'].opacity = value / 100;
2389
2389
  this.saveOpacity(this.layers['lc_filter'], value / 100);
2390
+ } else if (this.layers['klc_filter'] && layer.includes('cop_klc')) {
2391
+ this.layers['klc_filter'].opacity = value / 100;
2392
+ this.saveOpacity(this.layers['klc_filter'], value / 100);
2393
+ } else if (this.layers['pa_filter'] && layer.includes('protected_areas')) {
2394
+ this.layers['pa_filter'].opacity = value / 100;
2395
+ this.saveOpacity(this.layers['pa_filter'], value / 100);
2390
2396
  } else {
2391
2397
  this.layers[layer].opacity = value / 100;
2392
2398
  this.saveOpacity(this.layer, value / 100);
@@ -2464,6 +2470,15 @@ class MenuWidget extends React.Component {
2464
2470
  } else if (this.layers['lc_filter'] && elem.id.includes('all_present')) {
2465
2471
  this.map.remove(this.layers['lc_filter']);
2466
2472
  this.layers['lc_filter'].visible = false;
2473
+ } else if (this.layers['klc_filter'] && elem.id.includes('cop_klc')) {
2474
+ this.map.remove(this.layers['klc_filter']);
2475
+ this.layers['klc_filter'].visible = false;
2476
+ } else if (
2477
+ this.layers['pa_filter'] &&
2478
+ elem.id.includes('protected_areas')
2479
+ ) {
2480
+ this.map.remove(this.layers['pa_filter']);
2481
+ this.layers['pa_filter'].visible = false;
2467
2482
  }
2468
2483
  } else {
2469
2484
  if (this.layers['lcc_filter'] && elem.id.includes('all_lcc')) {
@@ -2472,6 +2487,15 @@ class MenuWidget extends React.Component {
2472
2487
  } else if (this.layers['lc_filter'] && elem.id.includes('all_present')) {
2473
2488
  this.map.add(this.layers['lc_filter']);
2474
2489
  this.layers['lc_filter'].visible = true;
2490
+ } else if (this.layers['klc_filter'] && elem.id.includes('cop_klc')) {
2491
+ this.map.add(this.layers['klc_filter']);
2492
+ this.layers['klc_filter'].visible = true;
2493
+ } else if (
2494
+ this.layers['pa_filter'] &&
2495
+ elem.id.includes('protected_areas')
2496
+ ) {
2497
+ this.map.add(this.layers['pa_filter']);
2498
+ this.layers['pa_filter'].visible = true;
2475
2499
  } else {
2476
2500
  this.map.add(this.layers[elem.id]);
2477
2501
  this.layers[elem.id].visible = true;
@@ -2628,6 +2652,12 @@ class MenuWidget extends React.Component {
2628
2652
  } else if (layers['lc_filter'] && layer.includes('all_present_lc')) {
2629
2653
  layers['lc_filter'].visible = false;
2630
2654
  delete layers['lc_filter'];
2655
+ } else if (layers['klc_filter'] && layer.includes('cop_klc')) {
2656
+ layers['klc_filter'].visible = false;
2657
+ delete layers['klc_filter'];
2658
+ } else if (layers['pa_filter'] && layer.includes('protected_areas')) {
2659
+ layers['pa_filter'].visible = false;
2660
+ delete layers['pa_filter'];
2631
2661
  }
2632
2662
  }
2633
2663