@eeacms/volto-arcgis-block 0.1.267 → 0.1.268
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,13 @@ 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.268](https://github.com/eea/volto-arcgis-block/compare/0.1.267...0.1.268) - 21 March 2024
|
|
8
|
+
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
10
|
+
|
|
11
|
+
- CLMS-2383-3050 (bug): allowed file size limit alert corrected. alerts text centered [Unai Bolivar - [`0666ab3`](https://github.com/eea/volto-arcgis-block/commit/0666ab320382db18367bf1076db91e6fe2f6145e)]
|
|
12
|
+
- CLMS-2383-3050 (chore): commented logs [Unai Bolivar - [`f68b1a9`](https://github.com/eea/volto-arcgis-block/commit/f68b1a90d4b77b73446cfd7b45ee310a6eb3dee1)]
|
|
13
|
+
- CLMS-2383-3050 (bug): corrected graphic overlay. corrected add to cart bug. CSV fileu upload disabled [Unai Bolivar - [`4f43430`](https://github.com/eea/volto-arcgis-block/commit/4f434304f4013725b86d302991d826cf861c9c57)]
|
|
7
14
|
### [0.1.267](https://github.com/eea/volto-arcgis-block/compare/0.1.266...0.1.267) - 20 March 2024
|
|
8
15
|
|
|
9
16
|
#### :hammer_and_wrench: Others
|
package/package.json
CHANGED
|
@@ -212,7 +212,7 @@ class AreaWidget extends React.Component {
|
|
|
212
212
|
//definitionExpression: 'LEVL_CODE=' + level,
|
|
213
213
|
});
|
|
214
214
|
|
|
215
|
-
this.removeFileUploadedLayer();
|
|
215
|
+
//this.removeFileUploadedLayer();
|
|
216
216
|
|
|
217
217
|
this.nutsGroupLayer.add(layer);
|
|
218
218
|
|
|
@@ -236,7 +236,7 @@ class AreaWidget extends React.Component {
|
|
|
236
236
|
popupEnabled: false,
|
|
237
237
|
});
|
|
238
238
|
|
|
239
|
-
this.removeFileUploadedLayer();
|
|
239
|
+
//this.removeFileUploadedLayer();
|
|
240
240
|
|
|
241
241
|
this.nutsGroupLayer.add(layer);
|
|
242
242
|
|
|
@@ -254,24 +254,23 @@ class AreaWidget extends React.Component {
|
|
|
254
254
|
};
|
|
255
255
|
|
|
256
256
|
handleFileUpload = (e) => {
|
|
257
|
-
//Store the file as Blob
|
|
258
|
-
let fileBlob = e.target.files[0];
|
|
259
257
|
//Get the file name
|
|
260
258
|
const fileName = e.target.value.toLowerCase();
|
|
261
259
|
//console.log('file name: ', fileName);
|
|
262
260
|
|
|
261
|
+
//Get the file size
|
|
262
|
+
const fileSize = e.target.files[0].size;
|
|
263
263
|
//Get the file from the form
|
|
264
264
|
const file = document.getElementById('uploadForm');
|
|
265
265
|
//console.log('uploaded file from form: ', file);
|
|
266
266
|
|
|
267
267
|
//List allowed file extensions
|
|
268
|
-
let fileExtensions = ['zip', 'geojson'
|
|
268
|
+
let fileExtensions = ['zip', 'geojson'];
|
|
269
269
|
|
|
270
270
|
// Get the file extension
|
|
271
271
|
let fileExtension = fileName.split('.').pop();
|
|
272
272
|
|
|
273
273
|
//console.log('file extension: ', fileExtension);
|
|
274
|
-
|
|
275
274
|
//Check if the file format is not supported
|
|
276
275
|
if (fileExtensions.indexOf(fileExtension) === -1) {
|
|
277
276
|
this.setState({
|
|
@@ -281,12 +280,9 @@ class AreaWidget extends React.Component {
|
|
|
281
280
|
return;
|
|
282
281
|
}
|
|
283
282
|
|
|
284
|
-
//Check if the file size is over the 10mb file size limit
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
(file.size > 1000000 && fileExtension === 'geojson') ||
|
|
288
|
-
(file.size > 1000000 && fileExtension === 'csv')
|
|
289
|
-
) {
|
|
283
|
+
// Check if the file is a geojson or CSV and the file size is over the 10mb file size limit
|
|
284
|
+
// or file is a shape file and the file size is over the 2mb file size limit
|
|
285
|
+
if (fileSize > 10485760 && fileExtension === 'geojson') {
|
|
290
286
|
this.setState({
|
|
291
287
|
showInfoPopup: true,
|
|
292
288
|
infoPopupType: 'fileLimit',
|
|
@@ -294,31 +290,13 @@ class AreaWidget extends React.Component {
|
|
|
294
290
|
return;
|
|
295
291
|
}
|
|
296
292
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
// break;
|
|
305
|
-
// case 'geojson':
|
|
306
|
-
// let parsedData;
|
|
307
|
-
// try {
|
|
308
|
-
// parsedData = JSON.parse(event.target.result);
|
|
309
|
-
// } catch (e) {
|
|
310
|
-
// console.error('Failed to parse JSON', e);
|
|
311
|
-
// return;
|
|
312
|
-
// }
|
|
313
|
-
// this.handleGeoJson(parsedData);
|
|
314
|
-
// break;
|
|
315
|
-
case 'csv':
|
|
316
|
-
this.handleCsv(event.target.result);
|
|
317
|
-
break;
|
|
318
|
-
default:
|
|
319
|
-
break;
|
|
320
|
-
}
|
|
321
|
-
};
|
|
293
|
+
if (fileSize > 2097152 && fileExtension === 'zip') {
|
|
294
|
+
this.setState({
|
|
295
|
+
showInfoPopup: true,
|
|
296
|
+
infoPopupType: 'shapefileLimit',
|
|
297
|
+
});
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
322
300
|
|
|
323
301
|
switch (fileExtension) {
|
|
324
302
|
case 'zip':
|
|
@@ -329,14 +307,14 @@ class AreaWidget extends React.Component {
|
|
|
329
307
|
this.generateFeatureCollection(fileName, file, 'geojson');
|
|
330
308
|
//reader.readAsText(file);
|
|
331
309
|
break;
|
|
332
|
-
case 'csv':
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
310
|
+
//case 'csv':
|
|
311
|
+
//this.generateFeatureCollection(
|
|
312
|
+
// fileName,
|
|
313
|
+
// file,
|
|
314
|
+
// 'csv',
|
|
315
|
+
//);
|
|
316
|
+
// reader.readAsText(fileBlob);
|
|
317
|
+
// break;
|
|
340
318
|
default:
|
|
341
319
|
break;
|
|
342
320
|
}
|
|
@@ -384,6 +362,8 @@ class AreaWidget extends React.Component {
|
|
|
384
362
|
return;
|
|
385
363
|
//Create a feature layer from the feature collection
|
|
386
364
|
this.addFeatureCollectionToMap(response.data.featureCollection);
|
|
365
|
+
//console.log(data);
|
|
366
|
+
//this.loadFileUploadService(response.data.featureCollection);
|
|
387
367
|
} else {
|
|
388
368
|
//console.error('Unexpected response structure:', response);
|
|
389
369
|
}
|
|
@@ -393,14 +373,54 @@ class AreaWidget extends React.Component {
|
|
|
393
373
|
});
|
|
394
374
|
}
|
|
395
375
|
|
|
376
|
+
loadFileUploadService(data) {
|
|
377
|
+
//debugger;
|
|
378
|
+
document.querySelector('.esri-attribution__powered-by').style.display =
|
|
379
|
+
'flex';
|
|
380
|
+
const blob = new Blob([data], {
|
|
381
|
+
type: 'json',
|
|
382
|
+
});
|
|
383
|
+
const url = URL.createObjectURL(blob);
|
|
384
|
+
|
|
385
|
+
var layer = new FeatureLayer({
|
|
386
|
+
id: 9,
|
|
387
|
+
//url: this.props.urls.outsideEu,
|
|
388
|
+
url: url,
|
|
389
|
+
layerId: 9,
|
|
390
|
+
outFields: ['*'],
|
|
391
|
+
popupEnabled: false,
|
|
392
|
+
title: 'upload',
|
|
393
|
+
});
|
|
394
|
+
|
|
395
|
+
//this.removeFileUploadedLayer();
|
|
396
|
+
|
|
397
|
+
this.removeNutsLayers();
|
|
398
|
+
|
|
399
|
+
this.nutsGroupLayer.add(layer);
|
|
400
|
+
|
|
401
|
+
let index = this.getHighestIndex();
|
|
402
|
+
|
|
403
|
+
this.props.map.reorder(this.nutsGroupLayer, index + 1);
|
|
404
|
+
}
|
|
405
|
+
|
|
396
406
|
// add the feature collection to the map and zoom to the feature collection extent
|
|
397
407
|
// if you want to persist the feature collection when you reload browser, you could store the
|
|
398
408
|
// collection in local storage by serializing the layer using featureLayer.toJson()
|
|
399
409
|
// see the 'Feature Collection in Local Storage' sample for an example of how to work with local storage
|
|
400
410
|
addFeatureCollectionToMap(featureCollection) {
|
|
411
|
+
//console.log('feature collection: ', featureCollection);
|
|
401
412
|
let sourceGraphics = [];
|
|
413
|
+
const symbol = new SimpleFillSymbol({
|
|
414
|
+
//type: 'simple-fill',
|
|
415
|
+
color: [255, 255, 255, 0.5],
|
|
416
|
+
outline: {
|
|
417
|
+
color: [0, 0, 0],
|
|
418
|
+
width: 1,
|
|
419
|
+
},
|
|
420
|
+
});
|
|
402
421
|
const layers = featureCollection.layers.map((layer) => {
|
|
403
422
|
const graphics = layer.featureSet.features.map((feature) => {
|
|
423
|
+
feature.symbol = symbol;
|
|
404
424
|
return Graphic.fromJSON(feature);
|
|
405
425
|
});
|
|
406
426
|
sourceGraphics = sourceGraphics.concat(graphics);
|
|
@@ -417,11 +437,42 @@ class AreaWidget extends React.Component {
|
|
|
417
437
|
// outFields: ['*'],
|
|
418
438
|
// popupEnabled: false,
|
|
419
439
|
});
|
|
440
|
+
//featureLayer.renderer = {
|
|
441
|
+
// type: 'simple-fill',
|
|
442
|
+
// color: [255, 255, 255, 0.5],
|
|
443
|
+
// outline: {
|
|
444
|
+
// color: [0, 0, 0],
|
|
445
|
+
// width: 1,
|
|
446
|
+
// },
|
|
447
|
+
//}
|
|
448
|
+
//featureLayer.renderer = {
|
|
449
|
+
// type: "simple", // autocasts as new SimpleRenderer()
|
|
450
|
+
// symbol: {
|
|
451
|
+
// type: "simple-fill", // autocasts as new SimpleMarkerSymbol()
|
|
452
|
+
// //size: 20,
|
|
453
|
+
// color: [255, 255, 255, 0.5],
|
|
454
|
+
// outline: { // autocasts as new SimpleLineSymbol()
|
|
455
|
+
// width: 1,
|
|
456
|
+
// color: [0, 0, 0]
|
|
457
|
+
// }
|
|
458
|
+
// }
|
|
459
|
+
//};
|
|
460
|
+
//featureLayer.renderer = {
|
|
461
|
+
// type: "simple", // autocasts as new SimpleRenderer()
|
|
462
|
+
// symbol: {
|
|
463
|
+
// type: "simple-fill", // autocasts as new SimpleMarkerSymbol()
|
|
464
|
+
// size: 20,
|
|
465
|
+
// color: "green",
|
|
466
|
+
// outline: { // autocasts as new SimpleLineSymbol()
|
|
467
|
+
// width: 4.5,
|
|
468
|
+
// color: "blue"
|
|
469
|
+
// }
|
|
470
|
+
// }
|
|
471
|
+
//};
|
|
420
472
|
return featureLayer;
|
|
421
473
|
});
|
|
422
|
-
|
|
423
474
|
//Check for the correct spatial reference
|
|
424
|
-
//console.log(
|
|
475
|
+
//console.log('layer: ', layers);
|
|
425
476
|
if (this.checkWkid(layers[0]?.spatialReference) === false) return;
|
|
426
477
|
|
|
427
478
|
let geometry = new Extent(
|
|
@@ -442,15 +493,14 @@ class AreaWidget extends React.Component {
|
|
|
442
493
|
this.removeNutsLayers();
|
|
443
494
|
|
|
444
495
|
//Add uploaded layer to the map and zoom to the extent
|
|
445
|
-
this.props.map.addMany(layers);
|
|
496
|
+
//this.props.map.addMany(layers);
|
|
497
|
+
this.props.view.graphics.addMany(sourceGraphics);
|
|
446
498
|
this.props.view.goTo(sourceGraphics).catch((error) => {
|
|
447
499
|
//console.error('From addFeatureCollectionToMap function', error);
|
|
448
500
|
});
|
|
501
|
+
//console.log('source graphics: ', sourceGraphics);
|
|
449
502
|
//Send the area to the parent component
|
|
450
|
-
this.props.updateArea(
|
|
451
|
-
origin: { x: geometry.extent.xmin, y: geometry.extent.ymin },
|
|
452
|
-
end: { x: geometry.extent.xmax, y: geometry.extent.ymax },
|
|
453
|
-
});
|
|
503
|
+
this.props.updateArea(sourceGraphics[0]);
|
|
454
504
|
//Order the layer in the map
|
|
455
505
|
let index = this.getHighestIndex();
|
|
456
506
|
this.props.map.reorder(this.fileUploadLayer, index + 1);
|
|
@@ -597,9 +647,10 @@ class AreaWidget extends React.Component {
|
|
|
597
647
|
|
|
598
648
|
removeFileUploadedLayer() {
|
|
599
649
|
if (this.fileUploadLayer !== null) {
|
|
600
|
-
this.props.map.removeMany(this.fileUploadLayer.layers);
|
|
601
|
-
//this.props.view.graphics.removeMany(this.fileUploadLayer.sourceGraphics);
|
|
602
|
-
this.fileUploadLayer = null;
|
|
650
|
+
// this.props.map.removeMany(this.fileUploadLayer.layers);
|
|
651
|
+
// //this.props.view.graphics.removeMany(this.fileUploadLayer.sourceGraphics);
|
|
652
|
+
// this.fileUploadLayer = null;
|
|
653
|
+
this.clearWidget();
|
|
603
654
|
}
|
|
604
655
|
}
|
|
605
656
|
|
|
@@ -783,7 +834,7 @@ class AreaWidget extends React.Component {
|
|
|
783
834
|
let graphic = response.results.filter((result) => {
|
|
784
835
|
let layer;
|
|
785
836
|
if (
|
|
786
|
-
'nuts0 nuts1 nuts2 nuts3 countries'.includes(
|
|
837
|
+
'nuts0 nuts1 nuts2 nuts3 countries upload'.includes(
|
|
787
838
|
result.graphic.layer.id,
|
|
788
839
|
)
|
|
789
840
|
) {
|
|
@@ -1062,9 +1113,7 @@ class AreaWidget extends React.Component {
|
|
|
1062
1113
|
>
|
|
1063
1114
|
<div className="field">
|
|
1064
1115
|
<label className="file-upload">
|
|
1065
|
-
<span>
|
|
1066
|
-
File formats supported: shp(zip), geojson, csv
|
|
1067
|
-
</span>
|
|
1116
|
+
<span>File formats supported: shp(zip), geojson</span>
|
|
1068
1117
|
<input
|
|
1069
1118
|
type="file"
|
|
1070
1119
|
name="file"
|
|
@@ -1149,7 +1198,19 @@ class AreaWidget extends React.Component {
|
|
|
1149
1198
|
<FontAwesomeIcon icon={['fas', 'info-circle']} />
|
|
1150
1199
|
</span>
|
|
1151
1200
|
<div className="drawRectanglePopup-text">
|
|
1152
|
-
Uploading files larger than 10MB is not
|
|
1201
|
+
Uploading geojson or csv files larger than 10MB is not
|
|
1202
|
+
allowed.
|
|
1203
|
+
</div>
|
|
1204
|
+
</>
|
|
1205
|
+
)}
|
|
1206
|
+
{this.state.infoPopupType === 'shapefileLimit' && (
|
|
1207
|
+
<>
|
|
1208
|
+
<span className="drawRectanglePopup-icon">
|
|
1209
|
+
<FontAwesomeIcon icon={['fas', 'info-circle']} />
|
|
1210
|
+
</span>
|
|
1211
|
+
<div className="drawRectanglePopup-text">
|
|
1212
|
+
Uploading shapefiles files larger than 2MB is not
|
|
1213
|
+
allowed.
|
|
1153
1214
|
</div>
|
|
1154
1215
|
</>
|
|
1155
1216
|
)}
|
|
@@ -31,7 +31,7 @@ export const AddCartItem = ({
|
|
|
31
31
|
const { addCartItem, isLoggedIn } = useCartState();
|
|
32
32
|
|
|
33
33
|
const checkArea = (e) => {
|
|
34
|
-
let check = document.querySelector('.area-panel input:checked')
|
|
34
|
+
let check = document.querySelector('.area-panel input:checked')?.value;
|
|
35
35
|
let area = {};
|
|
36
36
|
if (check === 'area') {
|
|
37
37
|
let graphics = mapViewer.view.graphics;
|
|
@@ -77,7 +77,7 @@ export const AddCartItem = ({
|
|
|
77
77
|
const checkExtent = (e) => {
|
|
78
78
|
let intersection = false;
|
|
79
79
|
let areaExtent = null;
|
|
80
|
-
let check = document.querySelector('.area-panel input:checked')
|
|
80
|
+
let check = document.querySelector('.area-panel input:checked')?.value;
|
|
81
81
|
if (check === 'area') {
|
|
82
82
|
areaExtent = new Extent({
|
|
83
83
|
xmin: Math.min(areaData.end.x, areaData.origin.x),
|