@eeacms/volto-arcgis-block 0.1.381 → 0.1.383
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 +13 -0
- package/package.json +1 -1
- package/src/components/MapViewer/MenuWidget.jsx +145 -45
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.383](https://github.com/eea/volto-arcgis-block/compare/0.1.382...0.1.383) - 29 August 2025
|
|
8
|
+
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
10
|
+
|
|
11
|
+
- (bug): implemented CDSE extent mod to full extent button in activelayers tab of the menu widget [Unai Bolivar - [`e9fdd2f`](https://github.com/eea/volto-arcgis-block/commit/e9fdd2f066d7d9cb2d2036e9e780473c751e0937)]
|
|
12
|
+
### [0.1.382](https://github.com/eea/volto-arcgis-block/compare/0.1.381...0.1.382) - 28 August 2025
|
|
13
|
+
|
|
14
|
+
#### :hammer_and_wrench: Others
|
|
15
|
+
|
|
16
|
+
- Merge pull request #1005 from eea/develop [Unai Bolivar - [`820e1bb`](https://github.com/eea/volto-arcgis-block/commit/820e1bb0d930b5388cb088d7d58bbc4bf582efa5)]
|
|
17
|
+
- (feat): clean extent for CDSE working [Unai Bolivar - [`676f76f`](https://github.com/eea/volto-arcgis-block/commit/676f76fd3b0a3bba9d451ea513ee95f47c1d4cbe)]
|
|
18
|
+
- (feat): extent is working for WMTS requests [Unai Bolivar - [`96f1fff`](https://github.com/eea/volto-arcgis-block/commit/96f1fffd898b238da5cece8b83fbd9489b240d68)]
|
|
19
|
+
- (feat): using wfs data to determine graphic position in map viewer. [Unai Bolivar - [`2e4e923`](https://github.com/eea/volto-arcgis-block/commit/2e4e923d6e6e8a8e0c39cbe9e2585b9f5ff550cb)]
|
|
7
20
|
### [0.1.381](https://github.com/eea/volto-arcgis-block/compare/0.1.380...0.1.381) - 20 August 2025
|
|
8
21
|
|
|
9
22
|
#### :hammer_and_wrench: Others
|
package/package.json
CHANGED
|
@@ -2027,6 +2027,9 @@ class MenuWidget extends React.Component {
|
|
|
2027
2027
|
ViewService: viewService,
|
|
2028
2028
|
StaticImageLegend: layer.StaticImageLegend,
|
|
2029
2029
|
LayerTitle: layer.Title,
|
|
2030
|
+
customLayerParameters: {
|
|
2031
|
+
SHOWLOGO: false,
|
|
2032
|
+
},
|
|
2030
2033
|
});
|
|
2031
2034
|
} else {
|
|
2032
2035
|
this.layers[
|
|
@@ -2804,6 +2807,8 @@ class MenuWidget extends React.Component {
|
|
|
2804
2807
|
}
|
|
2805
2808
|
|
|
2806
2809
|
async toggleLayer(elem) {
|
|
2810
|
+
if (!elem) return;
|
|
2811
|
+
this.url = this.layers[elem.id]?.ViewService || this.layers[elem.id]?.url;
|
|
2807
2812
|
const userService =
|
|
2808
2813
|
this.state.wmsUserServiceLayers.find(
|
|
2809
2814
|
(layer) => layer.LayerId === elem.id,
|
|
@@ -2929,41 +2934,50 @@ class MenuWidget extends React.Component {
|
|
|
2929
2934
|
if (!userService) this.checkForHotspots(elem, productContainerId);
|
|
2930
2935
|
// Auto-fit extent once for OGC WMS layers on manual toggle
|
|
2931
2936
|
try {
|
|
2932
|
-
const
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
!layer._ogcExtentApplied &&
|
|
2939
|
-
!this.extentInitiated
|
|
2940
|
-
) {
|
|
2941
|
-
let url;
|
|
2942
|
-
const serviceLayer = this.state.wmsUserServiceLayers.find(
|
|
2943
|
-
(l) => l.LayerId === elem.id,
|
|
2944
|
-
);
|
|
2945
|
-
if (!serviceLayer) {
|
|
2946
|
-
this.findCheckedDataset(elem);
|
|
2947
|
-
url = this.url;
|
|
2948
|
-
} else {
|
|
2949
|
-
url = serviceLayer.ViewService;
|
|
2950
|
-
}
|
|
2951
|
-
if (url) {
|
|
2952
|
-
await this.getCapabilities(url, 'wms');
|
|
2953
|
-
const BBoxes = this.parseBBOXCDSE(this.xml);
|
|
2954
|
-
if (BBoxes && BBoxes['dataset']) {
|
|
2955
|
-
const myExtent = new Extent({
|
|
2956
|
-
xmin: BBoxes['dataset'].xmin,
|
|
2957
|
-
ymin: BBoxes['dataset'].ymin,
|
|
2958
|
-
xmax: BBoxes['dataset'].xmax,
|
|
2959
|
-
ymax: BBoxes['dataset'].ymax,
|
|
2960
|
-
});
|
|
2961
|
-
this.view.goTo(myExtent);
|
|
2962
|
-
layer._ogcExtentApplied = true;
|
|
2963
|
-
}
|
|
2964
|
-
}
|
|
2937
|
+
const isCDSE = !!this.url && this.url.toLowerCase().includes('/ogc/');
|
|
2938
|
+
if (isCDSE) {
|
|
2939
|
+
const cdseGeometry = await this.getCDSEWFSGeoCoordinates(this.url);
|
|
2940
|
+
const extent = await this.createExtentFromCoordinates(cdseGeometry);
|
|
2941
|
+
this.view.goTo(extent);
|
|
2942
|
+
// layer._ogcExtentApplied = true;
|
|
2965
2943
|
}
|
|
2966
2944
|
} catch (e) {}
|
|
2945
|
+
// try {
|
|
2946
|
+
// const layer = this.layers[elem.id];
|
|
2947
|
+
// const viewService = layer?.ViewService || '';
|
|
2948
|
+
// if (
|
|
2949
|
+
// viewService &&
|
|
2950
|
+
// viewService.toLowerCase().includes('wms') &&
|
|
2951
|
+
// viewService.toLowerCase().includes('/ogc/') &&
|
|
2952
|
+
// !layer._ogcExtentApplied &&
|
|
2953
|
+
// !this.extentInitiated
|
|
2954
|
+
// ) {
|
|
2955
|
+
// let url;
|
|
2956
|
+
// const serviceLayer = this.state.wmsUserServiceLayers.find(
|
|
2957
|
+
// (l) => l.LayerId === elem.id,
|
|
2958
|
+
// );
|
|
2959
|
+
// if (!serviceLayer) {
|
|
2960
|
+
// this.findCheckedDataset(elem);
|
|
2961
|
+
// url = this.url;
|
|
2962
|
+
// } else {
|
|
2963
|
+
// url = serviceLayer.ViewService;
|
|
2964
|
+
// }
|
|
2965
|
+
// if (url) {
|
|
2966
|
+
// await this.getCapabilities(url, 'wms');
|
|
2967
|
+
// const BBoxes = this.parseBBOXCDSE(this.xml);
|
|
2968
|
+
// if (BBoxes && BBoxes['dataset']) {
|
|
2969
|
+
// const myExtent = new Extent({
|
|
2970
|
+
// xmin: BBoxes['dataset'].xmin,
|
|
2971
|
+
// ymin: BBoxes['dataset'].ymin,
|
|
2972
|
+
// xmax: BBoxes['dataset'].xmax,
|
|
2973
|
+
// ymax: BBoxes['dataset'].ymax,
|
|
2974
|
+
// });
|
|
2975
|
+
// this.view.goTo(myExtent);
|
|
2976
|
+
// layer._ogcExtentApplied = true;
|
|
2977
|
+
// }
|
|
2978
|
+
// }
|
|
2979
|
+
// }
|
|
2980
|
+
// } catch (e) {}
|
|
2967
2981
|
} else {
|
|
2968
2982
|
sessionStorage.removeItem('downloadButtonClicked');
|
|
2969
2983
|
sessionStorage.removeItem('timeSliderTag');
|
|
@@ -2995,6 +3009,7 @@ class MenuWidget extends React.Component {
|
|
|
2995
3009
|
this.activeLayersToHotspotData(elem.id);
|
|
2996
3010
|
}
|
|
2997
3011
|
this.renderHotspot();
|
|
3012
|
+
this.url = null;
|
|
2998
3013
|
}
|
|
2999
3014
|
|
|
3000
3015
|
getHotspotLayerIds() {
|
|
@@ -3418,6 +3433,85 @@ class MenuWidget extends React.Component {
|
|
|
3418
3433
|
return BBoxes;
|
|
3419
3434
|
}
|
|
3420
3435
|
|
|
3436
|
+
async createExtentFromCoordinates(coordinates) {
|
|
3437
|
+
if (!coordinates) return null;
|
|
3438
|
+
let pts;
|
|
3439
|
+
if (
|
|
3440
|
+
Array.isArray(coordinates) &&
|
|
3441
|
+
coordinates[0] &&
|
|
3442
|
+
Array.isArray(coordinates[0]) &&
|
|
3443
|
+
Array.isArray(coordinates[0][0])
|
|
3444
|
+
) {
|
|
3445
|
+
pts = coordinates[0];
|
|
3446
|
+
} else if (
|
|
3447
|
+
Array.isArray(coordinates) &&
|
|
3448
|
+
coordinates[0] &&
|
|
3449
|
+
typeof coordinates[0] === 'object' &&
|
|
3450
|
+
'latitude' in coordinates[0] &&
|
|
3451
|
+
'longitude' in coordinates[0]
|
|
3452
|
+
) {
|
|
3453
|
+
pts = coordinates.map((c) => [c.longitude, c.latitude]);
|
|
3454
|
+
} else if (
|
|
3455
|
+
Array.isArray(coordinates) &&
|
|
3456
|
+
coordinates[0] &&
|
|
3457
|
+
Array.isArray(coordinates[0]) &&
|
|
3458
|
+
typeof coordinates[0][0] === 'number'
|
|
3459
|
+
) {
|
|
3460
|
+
pts = coordinates;
|
|
3461
|
+
} else {
|
|
3462
|
+
return null;
|
|
3463
|
+
}
|
|
3464
|
+
let xmin = Infinity,
|
|
3465
|
+
ymin = Infinity,
|
|
3466
|
+
xmax = -Infinity,
|
|
3467
|
+
ymax = -Infinity;
|
|
3468
|
+
for (let i = 0; i < pts.length; i++) {
|
|
3469
|
+
const p = pts[i];
|
|
3470
|
+
if (!Array.isArray(p) || p.length < 2) continue;
|
|
3471
|
+
const x = p[0];
|
|
3472
|
+
const y = p[1];
|
|
3473
|
+
if (x < xmin) xmin = x;
|
|
3474
|
+
if (x > xmax) xmax = x;
|
|
3475
|
+
if (y < ymin) ymin = y;
|
|
3476
|
+
if (y > ymax) ymax = y;
|
|
3477
|
+
}
|
|
3478
|
+
if (
|
|
3479
|
+
!isFinite(xmin) ||
|
|
3480
|
+
!isFinite(ymin) ||
|
|
3481
|
+
!isFinite(xmax) ||
|
|
3482
|
+
!isFinite(ymax)
|
|
3483
|
+
)
|
|
3484
|
+
return null;
|
|
3485
|
+
return new Extent({
|
|
3486
|
+
xmin: xmin,
|
|
3487
|
+
ymin: ymin,
|
|
3488
|
+
xmax: xmax,
|
|
3489
|
+
ymax: ymax,
|
|
3490
|
+
spatialReference: { wkid: 3857 },
|
|
3491
|
+
});
|
|
3492
|
+
}
|
|
3493
|
+
|
|
3494
|
+
async getCDSEWFSGeoCoordinates(url) {
|
|
3495
|
+
if (!url) return {};
|
|
3496
|
+
const match = /\/ogc\/(?:wmts|wms)\/([^/?]+)/i.exec(url);
|
|
3497
|
+
if (!match) return {};
|
|
3498
|
+
const fetchUrl = `https://sh.dataspace.copernicus.eu/ogc/wfs/${match[1]}?SERVICE=WFS&REQUEST=GetFeature&VERSION=2.0.0&TYPENAMES=byoc-4bd995a1-dc49-4176-a285-b1d0084ba51a&COUNT=100&BBOX=-21039383,-22375217,21039383,22375217&OUTPUTFORMAT=application/json`;
|
|
3499
|
+
try {
|
|
3500
|
+
const res = await fetch(fetchUrl);
|
|
3501
|
+
const data = await res.json();
|
|
3502
|
+
if (
|
|
3503
|
+
data &&
|
|
3504
|
+
data.features &&
|
|
3505
|
+
data.features[0] &&
|
|
3506
|
+
data.features[0].geometry &&
|
|
3507
|
+
data.features[0].geometry.coordinates
|
|
3508
|
+
)
|
|
3509
|
+
return data.features[0].geometry.coordinates;
|
|
3510
|
+
} catch (e) {
|
|
3511
|
+
return {};
|
|
3512
|
+
}
|
|
3513
|
+
}
|
|
3514
|
+
|
|
3421
3515
|
parseBBOXCDSE(xml) {
|
|
3422
3516
|
if (!xml || typeof xml.getElementsByTagName !== 'function') return {};
|
|
3423
3517
|
const all = Array.from(xml.getElementsByTagName('*'));
|
|
@@ -3710,13 +3804,16 @@ class MenuWidget extends React.Component {
|
|
|
3710
3804
|
}
|
|
3711
3805
|
let isCDSE = this.url?.toLowerCase().includes('/ogc/') ? true : false;
|
|
3712
3806
|
let BBoxes = {};
|
|
3713
|
-
if (
|
|
3807
|
+
if (isCDSE) {
|
|
3808
|
+
const cdseGeometry = await this.getCDSEWFSGeoCoordinates(this.url);
|
|
3809
|
+
const extent = await this.createExtentFromCoordinates(cdseGeometry);
|
|
3810
|
+
this.view.goTo(extent);
|
|
3811
|
+
return;
|
|
3812
|
+
} else if (this.url?.toLowerCase().endsWith('mapserver')) {
|
|
3714
3813
|
BBoxes = await this.parseBBOXMAPSERVER(this.layers[elem.id]);
|
|
3715
3814
|
} else if (this.url?.toLowerCase().includes('wms') || serviceLayer) {
|
|
3716
3815
|
await this.getCapabilities(this.url, 'wms');
|
|
3717
|
-
|
|
3718
|
-
? this.parseBBOXCDSE(this.xml)
|
|
3719
|
-
: this.parseBBOXWMS(this.xml);
|
|
3816
|
+
this.parseBBOXWMS(this.xml);
|
|
3720
3817
|
} else if (this.url?.toLowerCase().includes('wmts')) {
|
|
3721
3818
|
await this.getCapabilities(this.url, 'wmts');
|
|
3722
3819
|
BBoxes = this.parseBBOXWMTS(this.xml);
|
|
@@ -3769,6 +3866,8 @@ class MenuWidget extends React.Component {
|
|
|
3769
3866
|
}
|
|
3770
3867
|
|
|
3771
3868
|
async fullExtent(elem) {
|
|
3869
|
+
this.url = this.layers[elem.id]?.url;
|
|
3870
|
+
const isCDSE = !!this.url && this.url.toLowerCase().includes('/ogc/');
|
|
3772
3871
|
const serviceLayer = this.state.wmsUserServiceLayers.find(
|
|
3773
3872
|
(layer) => layer.LayerId === elem.id,
|
|
3774
3873
|
);
|
|
@@ -3783,7 +3882,12 @@ class MenuWidget extends React.Component {
|
|
|
3783
3882
|
let firstLayer;
|
|
3784
3883
|
let landCoverAndLandUseMapping = document.querySelector('#component_0');
|
|
3785
3884
|
let productIds = [];
|
|
3786
|
-
if (
|
|
3885
|
+
if (isCDSE) {
|
|
3886
|
+
const cdseGeometry = await this.getCDSEWFSGeoCoordinates(this.url);
|
|
3887
|
+
const extent = await this.createExtentFromCoordinates(cdseGeometry);
|
|
3888
|
+
this.view.goTo(extent);
|
|
3889
|
+
return;
|
|
3890
|
+
} else if (landCoverAndLandUseMapping) {
|
|
3787
3891
|
const productElements = landCoverAndLandUseMapping.querySelectorAll(
|
|
3788
3892
|
'.map-menu-product-dropdown',
|
|
3789
3893
|
);
|
|
@@ -3793,9 +3897,7 @@ class MenuWidget extends React.Component {
|
|
|
3793
3897
|
productIds.push(productId);
|
|
3794
3898
|
}
|
|
3795
3899
|
});
|
|
3796
|
-
}
|
|
3797
|
-
|
|
3798
|
-
if (this.productId?.includes('333e4100b79045daa0ff16466ac83b7f')) {
|
|
3900
|
+
} else if (this.productId?.includes('333e4100b79045daa0ff16466ac83b7f')) {
|
|
3799
3901
|
//global dynamic landCover
|
|
3800
3902
|
this.findDatasetBoundingBox(elem);
|
|
3801
3903
|
|
|
@@ -3823,10 +3925,7 @@ class MenuWidget extends React.Component {
|
|
|
3823
3925
|
BBoxes = await this.parseBBOXMAPSERVER(this.layers[elem.id]);
|
|
3824
3926
|
} else if (this.url?.toLowerCase().includes('wms') || serviceLayer) {
|
|
3825
3927
|
await this.getCapabilities(this.url, 'wms');
|
|
3826
|
-
|
|
3827
|
-
} else {
|
|
3828
|
-
BBoxes = this.parseBBOXWMS(this.xml);
|
|
3829
|
-
}
|
|
3928
|
+
BBoxes = this.parseBBOXWMS(this.xml);
|
|
3830
3929
|
} else if (this.url?.toLowerCase().includes('wmts')) {
|
|
3831
3930
|
await this.getCapabilities(this.url, 'wmts');
|
|
3832
3931
|
BBoxes = this.parseBBOXWMTS(this.xml);
|
|
@@ -3944,6 +4043,7 @@ class MenuWidget extends React.Component {
|
|
|
3944
4043
|
});
|
|
3945
4044
|
this.view.goTo(myExtent); //
|
|
3946
4045
|
}
|
|
4046
|
+
this.url = null;
|
|
3947
4047
|
}
|
|
3948
4048
|
/**
|
|
3949
4049
|
* Method to show Active Layers of the map
|