@eeacms/volto-arcgis-block 0.1.134 → 0.1.136
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,27 @@ 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.136](https://github.com/eea/volto-arcgis-block/compare/0.1.135...0.1.136) - 5 May 2023
|
|
8
|
+
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
10
|
+
|
|
11
|
+
- CLMS-2060 (chore): ran linting scripts and passed. [ujbolivar - [`76fed5c`](https://github.com/eea/volto-arcgis-block/commit/76fed5c5960453233dddf63e7946bb5b4f249c42)]
|
|
12
|
+
- CLMS-2060 (chore): ran linting scripts [ujbolivar - [`2dcb14a`](https://github.com/eea/volto-arcgis-block/commit/2dcb14a6c87d5b37787375cff05352f4344eae9c)]
|
|
13
|
+
- [FEAT]: Code can load all layers or just a group of them. Gisco Basemap add to Map by default [martinman - [`08524e6`](https://github.com/eea/volto-arcgis-block/commit/08524e6386d6103cff9dbc92e5a6ed313a49ee35)]
|
|
14
|
+
- CLMS-2060 (chore): Ticket completed. NUTS is working [ujbolivar - [`38c364d`](https://github.com/eea/volto-arcgis-block/commit/38c364d2db017638981eddee66aff0b75706e472)]
|
|
15
|
+
- revert back to feature layer implementation [ujbolivar - [`78075ae`](https://github.com/eea/volto-arcgis-block/commit/78075ae608991e5a815d410bf0c2e438796b6f37)]
|
|
16
|
+
- still not completed [ujbolivar - [`629e825`](https://github.com/eea/volto-arcgis-block/commit/629e82561b1e0887bc49b2cfffe750c4d4ab3274)]
|
|
17
|
+
- Merge local changes and latest changes [martinman - [`243d6d4`](https://github.com/eea/volto-arcgis-block/commit/243d6d4122b5dea59e719a40c7edf57c1a99a3b8)]
|
|
18
|
+
- CLMS-2060 (chore): changed url to production endpoint for NUTS. Not completed [ujbolivar - [`cd6627e`](https://github.com/eea/volto-arcgis-block/commit/cd6627e14825d7503513642079884abc4292462a)]
|
|
19
|
+
- FEAT: Thumbnails from GetMap requests. Next step generate Basemaps automatically from Gisco GetCapabilities. Set Gisco Basemap as default in Mapviewer [martinman - [`b53b7d6`](https://github.com/eea/volto-arcgis-block/commit/b53b7d6ad4874e65bf93499839614ee48f3850ce)]
|
|
20
|
+
- FEAT: Gisco basemaps added and some ESRI basemaps. Next step add thumbnails [martinman - [`00152b9`](https://github.com/eea/volto-arcgis-block/commit/00152b9637746ac6666bf8c4ec6b5b8257c76d7a)]
|
|
21
|
+
- First commit [martinman - [`8508c9a`](https://github.com/eea/volto-arcgis-block/commit/8508c9a3830afe0b84f1582923bde616a68b38b6)]
|
|
22
|
+
### [0.1.135](https://github.com/eea/volto-arcgis-block/compare/0.1.134...0.1.135) - 5 May 2023
|
|
23
|
+
|
|
24
|
+
#### :hammer_and_wrench: Others
|
|
25
|
+
|
|
26
|
+
- CLMS-1733 (lint):Ran linting scripts before push [Urkorue - [`3fffb43`](https://github.com/eea/volto-arcgis-block/commit/3fffb438efb27a59f251ea89bd35b67301af9040)]
|
|
27
|
+
- CLMS-1733 (fix): Compares the product title instead of the url [Urkorue - [`41b88af`](https://github.com/eea/volto-arcgis-block/commit/41b88afdfc34dafccd9d587da880caf998bf7f41)]
|
|
7
28
|
### [0.1.134](https://github.com/eea/volto-arcgis-block/compare/0.1.133...0.1.134) - 4 May 2023
|
|
8
29
|
|
|
9
30
|
### [0.1.133](https://github.com/eea/volto-arcgis-block/compare/0.1.132...0.1.133) - 2 May 2023
|
package/package.json
CHANGED
|
@@ -137,7 +137,7 @@ class AreaWidget extends React.Component {
|
|
|
137
137
|
this.clearWidget();
|
|
138
138
|
|
|
139
139
|
levels.forEach((level) => {
|
|
140
|
-
var url = `https://
|
|
140
|
+
var url = `https://land.discomap.eea.europa.eu/arcgis/rest/services/CLMS_Portal/NUTS_2021_Improved/MapServer/`;
|
|
141
141
|
var layer = new FeatureLayer({
|
|
142
142
|
id: id,
|
|
143
143
|
url: url,
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import React, { createRef } from 'react';
|
|
2
2
|
import { loadModules } from 'esri-loader';
|
|
3
3
|
var BasemapGallery;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
var Basemap;
|
|
5
|
+
var WebTileLayer;
|
|
6
|
+
var esriRequest;
|
|
6
7
|
// var LocalBasemapsSource;
|
|
7
8
|
|
|
9
|
+
// Configuration
|
|
10
|
+
const LOAD_WHOLE_SERVICE = false;
|
|
11
|
+
const GISCO_CAPABILITIES_URL =
|
|
12
|
+
'https://gisco-services.ec.europa.eu/maps/wmts/1.0.0/WMTSCapabilities.xml';
|
|
13
|
+
|
|
8
14
|
class BasemapWidget extends React.Component {
|
|
9
15
|
/**
|
|
10
16
|
* Creator of the Basemap widget class
|
|
@@ -28,12 +34,21 @@ class BasemapWidget extends React.Component {
|
|
|
28
34
|
'esri/Basemap',
|
|
29
35
|
'esri/layers/WebTileLayer',
|
|
30
36
|
'esri/widgets/BasemapGallery/support/LocalBasemapsSource',
|
|
37
|
+
'esri/request',
|
|
31
38
|
]).then(
|
|
32
|
-
([
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
([
|
|
40
|
+
_BasemapGallery,
|
|
41
|
+
_Basemap,
|
|
42
|
+
_WebTileLayer,
|
|
43
|
+
_LocalBasemapsSource,
|
|
44
|
+
_esriRequest,
|
|
45
|
+
]) => {
|
|
46
|
+
[BasemapGallery] = [_BasemapGallery];
|
|
47
|
+
[Basemap] = [_Basemap];
|
|
48
|
+
[WebTileLayer] = [_WebTileLayer];
|
|
49
|
+
[esriRequest] = [_esriRequest];
|
|
50
|
+
|
|
51
|
+
// [LocalBasemapsSource] = [_LocalBasemapsSource];
|
|
37
52
|
},
|
|
38
53
|
);
|
|
39
54
|
}
|
|
@@ -43,33 +58,51 @@ class BasemapWidget extends React.Component {
|
|
|
43
58
|
* button is clicked. It controls the open
|
|
44
59
|
* and close actions of the component
|
|
45
60
|
*/
|
|
46
|
-
openMenu() {
|
|
47
|
-
if (this.loadFirst) {
|
|
48
|
-
document
|
|
49
|
-
.querySelectorAll('.esri-basemap-gallery__item')[3]
|
|
50
|
-
.setAttribute('aria-selected', true);
|
|
51
|
-
document
|
|
52
|
-
.querySelectorAll('.esri-basemap-gallery__item')[3]
|
|
53
|
-
.classList.add('esri-basemap-gallery__item--selected');
|
|
54
|
-
this.loadFirst = false;
|
|
55
61
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
62
|
+
getGISCOCapabilities = (url) => {
|
|
63
|
+
// Get the coordinates of the click on the view
|
|
64
|
+
return esriRequest(url, {
|
|
65
|
+
responseType: 'html',
|
|
66
|
+
sync: 'true',
|
|
67
|
+
}).then((response) => {
|
|
68
|
+
let parser = new DOMParser();
|
|
69
|
+
let xml = parser.parseFromString(response.data, 'text/html');
|
|
70
|
+
return xml;
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
parseCapabilities = (xml, tag) => {
|
|
75
|
+
return xml.getElementsByTagName(tag);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
openMenu = () => {
|
|
79
|
+
// if (this.loadFirst) {
|
|
80
|
+
// // Add styles to selected basemap, but fails if not exist
|
|
81
|
+
// document
|
|
82
|
+
// .querySelectorAll('.esri-basemap-gallery__item')[0]
|
|
83
|
+
// .setAttribute('aria-selected', true);
|
|
84
|
+
// document
|
|
85
|
+
// .querySelectorAll('.esri-basemap-gallery__item')[0]
|
|
86
|
+
// .classList.add('esri-basemap-gallery__item--selected');
|
|
87
|
+
// this.loadFirst = false;
|
|
88
|
+
|
|
89
|
+
// document
|
|
90
|
+
// .querySelector('.esri-basemap-gallery__item-container')
|
|
91
|
+
// .addEventListener(
|
|
92
|
+
// 'click',
|
|
93
|
+
// (e) => {
|
|
94
|
+
// document
|
|
95
|
+
// .querySelectorAll('.esri-basemap-gallery__item')[0]
|
|
96
|
+
// .setAttribute('aria-selected', false);
|
|
97
|
+
// document
|
|
98
|
+
// .querySelectorAll('.esri-basemap-gallery__item')[0]
|
|
99
|
+
// .classList.remove('esri-basemap-gallery__item--selected');
|
|
100
|
+
// },
|
|
101
|
+
// {
|
|
102
|
+
// once: true,
|
|
103
|
+
// },
|
|
104
|
+
// );
|
|
105
|
+
// }
|
|
73
106
|
|
|
74
107
|
if (this.state.showMapMenu) {
|
|
75
108
|
this.props.mapViewer.setActiveWidget();
|
|
@@ -99,38 +132,117 @@ class BasemapWidget extends React.Component {
|
|
|
99
132
|
// and ensure that the component is rendered again
|
|
100
133
|
this.setState({ showMapMenu: true });
|
|
101
134
|
}
|
|
102
|
-
}
|
|
135
|
+
};
|
|
103
136
|
/**
|
|
104
137
|
* This method is executed after the rener method is executed
|
|
105
138
|
*/
|
|
139
|
+
|
|
140
|
+
layerArray = [];
|
|
106
141
|
async componentDidMount() {
|
|
107
142
|
await this.loader();
|
|
108
143
|
if (!this.container.current) return;
|
|
109
144
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
145
|
+
if (LOAD_WHOLE_SERVICE) {
|
|
146
|
+
// Load all layers in GISCO service as basemap
|
|
147
|
+
this.getGISCOCapabilities(GISCO_CAPABILITIES_URL).then((xml) => {
|
|
148
|
+
let layers = Array.from(xml.querySelectorAll('Layer')).filter(
|
|
149
|
+
(v) => v.querySelectorAll('Layer').length === 0,
|
|
150
|
+
);
|
|
151
|
+
let url = '';
|
|
152
|
+
|
|
153
|
+
let epsgArray = [];
|
|
154
|
+
Array.from(layers[0].querySelectorAll('tilematrixset')).map(
|
|
155
|
+
(element) => {
|
|
156
|
+
epsgArray.push(element.innerText);
|
|
157
|
+
return element;
|
|
158
|
+
},
|
|
159
|
+
);
|
|
160
|
+
let proj = 'EPSG3857'; //default projection
|
|
161
|
+
for (let i = 0; i < layers.length; i++) {
|
|
162
|
+
if (!epsgArray.includes(proj)) {
|
|
163
|
+
proj = epsgArray[0];
|
|
164
|
+
}
|
|
165
|
+
url = this.parseCapabilities(layers[i], 'ResourceURL')[0].attributes
|
|
166
|
+
.template.textContent;
|
|
167
|
+
let basemapCode = `
|
|
168
|
+
let basemap${i} = new Basemap({
|
|
169
|
+
title: this.parseCapabilities(layers[${i}], 'ows:title')[0].innerText,
|
|
170
|
+
thumbnailUrl: ${url}.replace('{TileMatrixSet}/{TileMatrix}/{TileCol}/{TileRow}', '/${proj}/0/0/0'),
|
|
171
|
+
baseLayers: [
|
|
172
|
+
new WebTileLayer({
|
|
173
|
+
urlTemplate: ${url}.replace('{TileMatrixSet}/{TileMatrix}/{TileCol}/{TileRow}', '/${proj}/{z}/{x}/{y}')
|
|
174
|
+
})
|
|
175
|
+
]
|
|
176
|
+
});
|
|
177
|
+
this.layerArray.push(basemap${i});
|
|
178
|
+
`;
|
|
179
|
+
|
|
180
|
+
Function.apply(null, [basemapCode]).call(this);
|
|
181
|
+
}
|
|
182
|
+
this.basemapGallery = new BasemapGallery({
|
|
183
|
+
view: this.props.view,
|
|
184
|
+
container: this.container.current.querySelector('.basemap-panel'),
|
|
185
|
+
source: this.layerArray,
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
} else {
|
|
189
|
+
// Only 3 basemaps
|
|
190
|
+
this.positronCompositeBasemap = new Basemap({
|
|
191
|
+
title: 'Positron composite',
|
|
192
|
+
thumbnailUrl:
|
|
193
|
+
'https://gisco-services.ec.europa.eu/maps/wmts/OSMPositronComposite/EPSG3857/0/0/0.png',
|
|
194
|
+
baseLayers: [
|
|
195
|
+
new WebTileLayer({
|
|
196
|
+
urlTemplate:
|
|
197
|
+
'https://gisco-services.ec.europa.eu/maps/tiles/OSMPositronComposite/EPSG3857/{z}/{x}/{y}.png',
|
|
198
|
+
}),
|
|
199
|
+
],
|
|
200
|
+
// referenceLayers: [
|
|
201
|
+
// new _WebTileLayer(...)
|
|
202
|
+
// ],
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
this.blossomCompositeBasemap = new Basemap({
|
|
206
|
+
title: 'Blossom composite',
|
|
207
|
+
thumbnailUrl:
|
|
208
|
+
'https://gisco-services.ec.europa.eu/maps/wmts/OSMBlossomComposite/EPSG3857/0/0/0.png',
|
|
209
|
+
baseLayers: [
|
|
210
|
+
new WebTileLayer({
|
|
211
|
+
urlTemplate:
|
|
212
|
+
'https://gisco-services.ec.europa.eu/maps/tiles/OSMBlossomComposite/EPSG3857/{z}/{x}/{y}.png',
|
|
213
|
+
}),
|
|
214
|
+
],
|
|
215
|
+
// referenceLayers: [
|
|
216
|
+
// new WebTileLayer(...)
|
|
217
|
+
// ],
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
this.worldBoundariesBasemap = new Basemap({
|
|
221
|
+
title: 'World boundaries',
|
|
222
|
+
thumbnailUrl:
|
|
223
|
+
'https://gisco-services.ec.europa.eu/maps/wmts/CountriesWorld/EPSG3857/0/0/0.png',
|
|
224
|
+
baseLayers: [
|
|
225
|
+
new WebTileLayer({
|
|
226
|
+
urlTemplate:
|
|
227
|
+
'https://gisco-services.ec.europa.eu/maps/tiles/CountriesWorld/EPSG3857/{z}/{x}/{y}.png',
|
|
228
|
+
}),
|
|
229
|
+
],
|
|
230
|
+
// referenceLayers: [
|
|
231
|
+
// new WebTileLayer(...)
|
|
232
|
+
// ],
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
this.basemapGallery = new BasemapGallery({
|
|
236
|
+
view: this.props.view,
|
|
237
|
+
container: this.container.current.querySelector('.basemap-panel'),
|
|
238
|
+
source: [
|
|
239
|
+
this.worldBoundariesBasemap,
|
|
240
|
+
this.blossomCompositeBasemap,
|
|
241
|
+
this.positronCompositeBasemap,
|
|
242
|
+
],
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
|
|
134
246
|
this.props.view.ui.add(this.container.current, 'top-right');
|
|
135
247
|
}
|
|
136
248
|
/**
|
|
@@ -18,7 +18,7 @@ import InfoWidget from './InfoWidget';
|
|
|
18
18
|
import MenuWidget from './MenuWidget';
|
|
19
19
|
import HotspotWidget from './HotspotWidget';
|
|
20
20
|
//import "isomorphic-fetch"; <-- Necessary to use fetch?
|
|
21
|
-
var Map, MapView, Zoom, intl;
|
|
21
|
+
var Map, MapView, Zoom, intl, Basemap, WebTileLayer;
|
|
22
22
|
let mapStatus = {};
|
|
23
23
|
const CheckLanguage = () => {
|
|
24
24
|
const { locale } = useIntl();
|
|
@@ -83,8 +83,17 @@ class MapViewer extends React.Component {
|
|
|
83
83
|
'esri/views/MapView',
|
|
84
84
|
'esri/widgets/Zoom',
|
|
85
85
|
'esri/intl',
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
'esri/Basemap',
|
|
87
|
+
'esri/layers/WebTileLayer',
|
|
88
|
+
]).then(([_Map, _MapView, _Zoom, _intl, _Basemap, _WebTileLayer]) => {
|
|
89
|
+
[Map, MapView, Zoom, intl, Basemap, WebTileLayer] = [
|
|
90
|
+
_Map,
|
|
91
|
+
_MapView,
|
|
92
|
+
_Zoom,
|
|
93
|
+
_intl,
|
|
94
|
+
_Basemap,
|
|
95
|
+
_WebTileLayer,
|
|
96
|
+
];
|
|
88
97
|
});
|
|
89
98
|
}
|
|
90
99
|
|
|
@@ -107,8 +116,25 @@ class MapViewer extends React.Component {
|
|
|
107
116
|
await this.waitForDataFill();
|
|
108
117
|
// this.mapdiv.current is the reference to the current DOM element of
|
|
109
118
|
// this.mapdiv after it was mounted by the render() method
|
|
119
|
+
|
|
120
|
+
this.positronCompositeBasemap = new Basemap({
|
|
121
|
+
title: 'Positron composite',
|
|
122
|
+
thumbnailUrl:
|
|
123
|
+
'https://gisco-services.ec.europa.eu/maps/wmts/OSMPositronComposite/EPSG3857/0/0/0.png',
|
|
124
|
+
baseLayers: [
|
|
125
|
+
new WebTileLayer({
|
|
126
|
+
urlTemplate:
|
|
127
|
+
'https://gisco-services.ec.europa.eu/maps/tiles/OSMPositronComposite/EPSG3857/{z}/{x}/{y}.png',
|
|
128
|
+
}),
|
|
129
|
+
],
|
|
130
|
+
// referenceLayers: [
|
|
131
|
+
// new _WebTileLayer(...)
|
|
132
|
+
// ],
|
|
133
|
+
});
|
|
134
|
+
|
|
110
135
|
this.map = new Map({
|
|
111
|
-
basemap: 'topo',
|
|
136
|
+
// basemap: 'topo',
|
|
137
|
+
basemap: this.positronCompositeBasemap,
|
|
112
138
|
});
|
|
113
139
|
|
|
114
140
|
mapStatus = this.recoverState();
|
|
@@ -1961,6 +1961,7 @@ class MenuWidget extends React.Component {
|
|
|
1961
1961
|
product.Datasets.forEach((dataset) => {
|
|
1962
1962
|
if (dataset.DatasetTitle.includes(selectedDataset.title)) {
|
|
1963
1963
|
this.url = dataset.ViewService;
|
|
1964
|
+
this.productTitle = product.ProductTitle;
|
|
1964
1965
|
}
|
|
1965
1966
|
});
|
|
1966
1967
|
});
|
|
@@ -2105,10 +2106,13 @@ class MenuWidget extends React.Component {
|
|
|
2105
2106
|
this.findCheckedDataset(elem);
|
|
2106
2107
|
let BBoxes = {};
|
|
2107
2108
|
let firstLayer;
|
|
2108
|
-
if (this.
|
|
2109
|
+
if (this.productTitle.includes('Global Dynamic Land Cover')) {
|
|
2109
2110
|
this.findDatasetBoundingBox(elem);
|
|
2110
2111
|
BBoxes = this.parseBBOXJSON(this.dataBBox);
|
|
2111
|
-
} else if (
|
|
2112
|
+
} else if (
|
|
2113
|
+
this.productTitle.includes('Low Resolution Vegetation Parameters') ||
|
|
2114
|
+
this.productTitle.includes('Water Parameters')
|
|
2115
|
+
) {
|
|
2112
2116
|
if (
|
|
2113
2117
|
this.layers[elem.id].fullExtents &&
|
|
2114
2118
|
this.layers[elem.id].fullExtents !== null
|