@opengeoweb/webmap-react 14.0.0 → 14.1.0

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/index.esm.js CHANGED
@@ -7,7 +7,7 @@ import LayerProperty from 'ol/layer/Property';
7
7
  import ImageSource, { getRequestExtent } from 'ol/source/Image';
8
8
  import ImageState from 'ol/ImageState';
9
9
  import { fromResolutionLike } from 'ol/resolution';
10
- import { without, isEqual, throttle, debounce, memoize, range } from 'lodash';
10
+ import { without, isEqual, throttle, debounce, memoize, range, cloneDeep } from 'lodash';
11
11
  import ImageWrapper, { load } from 'ol/Image';
12
12
  import { getImageSrc, getRequestParams, createLoader } from 'ol/source/wms';
13
13
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
@@ -15,14 +15,13 @@ import { CustomTooltip, CanvasComponent, useWheelStopPropagation, ToolContainerD
15
15
  import 'i18next';
16
16
  import { useTranslation } from 'react-i18next';
17
17
  import { Paper, Box, Typography, useTheme, Grid, TextField, FormControl, InputLabel, Select, MenuItem, Icon as Icon$2, FormLabel, Switch, styled, Slider } from '@mui/material';
18
- import { useQuery } from '@tanstack/react-query';
18
+ import { queryOptions, useQuery } from '@tanstack/react-query';
19
19
  import { Style, Icon as Icon$1, Circle, Stroke, Fill, Text } from 'ol/style';
20
20
  import { Point, MultiPoint, LineString, Polygon } from 'ol/geom';
21
21
  import { arrowUpPath, Home, Add, Minus, List, Delete, Edit, DrawRegion, DrawPolygon, Location, DrawFIRLand, ArrowUp, SandStorm, Equalizer, DimensionsElevation, Link, LinkOff, Info, DimensionsOther, DimensionsRefTime, DimensionsTime, locationPath } from '@opengeoweb/theme';
22
22
  import { http, HttpResponse } from 'msw';
23
23
  import proj4 from 'proj4';
24
- import * as turf from '@turf/turf';
25
- import { polygonToLine, booleanClockwise, rewind } from '@turf/turf';
24
+ import { feature, simplify, booleanPointInPolygon, intersect, cleanCoords, polygonToLine, booleanClockwise, rewind, bbox, toWgs84, toMercator, coordEach } from '@turf/turf';
26
25
  import { produce } from 'immer';
27
26
  import Box$1 from '@mui/material/Box';
28
27
  import Typography$1 from '@mui/material/Typography';
@@ -1115,6 +1114,7 @@ var TimeawareImageSource = /*#__PURE__*/function (_ImageSource) {
1115
1114
  });
1116
1115
  _this._layerId = layerId;
1117
1116
  _this.triggerPrefetch = _this.triggerPrefetch.bind(_this);
1117
+ _this.cancelPrefetch = _this.cancelPrefetch.bind(_this);
1118
1118
  _this._imWrapperEmptyButLoading = initImageWrapper();
1119
1119
  _this._imWrapperForOlSource = initImageWrapper();
1120
1120
  _this._imWrapperForAltImage = initImageWrapper();
@@ -1225,6 +1225,11 @@ var TimeawareImageSource = /*#__PURE__*/function (_ImageSource) {
1225
1225
  this.throttledPrefetch();
1226
1226
  }
1227
1227
  }
1228
+ }, {
1229
+ key: "cancelPrefetch",
1230
+ value: function cancelPrefetch() {
1231
+ this._prefetchWorkers.clearJobs();
1232
+ }
1228
1233
  }, {
1229
1234
  key: "getImage",
1230
1235
  value: function getImage(extent, resolution, pixelRatio, projection) {
@@ -1441,13 +1446,15 @@ var timeSpanToTimeList = function timeSpanToTimeList(timespan) {
1441
1446
  }
1442
1447
  if (numStepsToFetch > MAX_NUMBER_STEPS_IN_TIME_SLIDER_TO_PREFETCH) {
1443
1448
  var msg = "too many steps to prefetch: ".concat(numStepsToFetch);
1444
- throw new RangeError(msg);
1449
+ console.warn(msg);
1450
+ return [];
1445
1451
  }
1446
1452
  var stepsToCheck = range(timespan.start, timespan.end + timespan.step, timespan.step);
1447
1453
  // Find out which dimension time values are available for prefetching
1448
1454
  if (stepsToCheck.length > MAX_NUMBER_STEPS_IN_TIME_SLIDER_TO_PREFETCH) {
1449
1455
  var _msg = "too many steps to prefetch: ".concat(stepsToCheck.length);
1450
- throw new RangeError(_msg);
1456
+ console.warn(_msg);
1457
+ return [];
1451
1458
  }
1452
1459
  return stepsToCheck;
1453
1460
  }
@@ -1553,12 +1560,40 @@ var LegendLayout = function LegendLayout(_ref) {
1553
1560
  * Copyright 2025 - Finnish Meteorological Institute (FMI)
1554
1561
  * Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
1555
1562
  * */
1563
+ // This function is a copy of /libs/api/src/utils.ts which cannot be used here due to circular dependency
1564
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type, @typescript-eslint/explicit-module-boundary-types
1565
+ var handleResponse = function handleResponse(response) {
1566
+ if (response.ok) {
1567
+ return response.json().then(function (json) {
1568
+ return json || response.headers;
1569
+ })["catch"](function () {
1570
+ // No JSON response
1571
+ });
1572
+ }
1573
+ return response.json()["catch"](function () {
1574
+ // Couldn't parse the JSON
1575
+ throw new Error("".concat(response.status));
1576
+ }).then(function (json) {
1577
+ // Got valid JSON with error response, use it
1578
+ if (json) {
1579
+ var message = json.message;
1580
+ if (message) {
1581
+ throw new Error(message, {
1582
+ cause: response.status
1583
+ });
1584
+ }
1585
+ var result = JSON.stringify(json);
1586
+ throw new Error(result);
1587
+ }
1588
+ throw new Error("".concat(response.status));
1589
+ });
1590
+ };
1556
1591
  var joinUrlParams = function joinUrlParams(params) {
1557
1592
  return params.filter(function (x) {
1558
1593
  return x !== undefined && x.length > 0;
1559
1594
  }).join('/');
1560
1595
  };
1561
- var fetchEDRLayerCollection = /*#__PURE__*/function () {
1596
+ var fetchEDRCollectionDetails = /*#__PURE__*/function () {
1562
1597
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(edrBaseUrlWithCollection) {
1563
1598
  var instanceId,
1564
1599
  _args = arguments;
@@ -1566,31 +1601,24 @@ var fetchEDRLayerCollection = /*#__PURE__*/function () {
1566
1601
  while (1) switch (_context.prev = _context.next) {
1567
1602
  case 0:
1568
1603
  instanceId = _args.length > 1 && _args[1] !== undefined ? _args[1] : '';
1569
- _context.next = 3;
1570
- return fetch(joinUrlParams([edrBaseUrlWithCollection, instanceId]));
1571
- case 3:
1572
- _context.next = 5;
1573
- return _context.sent.json();
1574
- case 5:
1575
- return _context.abrupt("return", _context.sent);
1576
- case 6:
1604
+ return _context.abrupt("return", fetch(joinUrlParams([edrBaseUrlWithCollection, instanceId])).then(handleResponse));
1605
+ case 2:
1577
1606
  case "end":
1578
1607
  return _context.stop();
1579
1608
  }
1580
1609
  }, _callee);
1581
1610
  }));
1582
- return function fetchEDRLayerCollection(_x) {
1611
+ return function fetchEDRCollectionDetails(_x) {
1583
1612
  return _ref.apply(this, arguments);
1584
1613
  };
1585
1614
  }();
1586
- var fetchEDRLayerCollectionCube = /*#__PURE__*/function () {
1615
+ var fetchEDRCube = /*#__PURE__*/function () {
1587
1616
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(edrBaseUrlWithCollection, parameterName) {
1588
1617
  var datetime,
1589
1618
  instanceId,
1590
1619
  bbox,
1591
1620
  queryParams,
1592
1621
  url,
1593
- response,
1594
1622
  _args2 = arguments;
1595
1623
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1596
1624
  while (1) switch (_context2.prev = _context2.next) {
@@ -1603,68 +1631,229 @@ var fetchEDRLayerCollectionCube = /*#__PURE__*/function () {
1603
1631
  queryParams.append('parameter-name', parameterName);
1604
1632
  datetime && queryParams.append('datetime', datetime);
1605
1633
  url = "".concat(joinUrlParams([edrBaseUrlWithCollection, instanceId, 'cube']), "?").concat(queryParams.toString());
1606
- _context2.next = 10;
1607
- return fetch(url);
1608
- case 10:
1609
- response = _context2.sent;
1610
- _context2.next = 13;
1611
- return response.json();
1612
- case 13:
1613
- return _context2.abrupt("return", _context2.sent);
1614
- case 14:
1634
+ return _context2.abrupt("return", fetch(url).then(handleResponse));
1635
+ case 9:
1615
1636
  case "end":
1616
1637
  return _context2.stop();
1617
1638
  }
1618
1639
  }, _callee2);
1619
1640
  }));
1620
- return function fetchEDRLayerCollectionCube(_x2, _x3) {
1641
+ return function fetchEDRCube(_x2, _x3) {
1621
1642
  return _ref2.apply(this, arguments);
1622
1643
  };
1623
1644
  }();
1645
+ var fetchEDRArea = /*#__PURE__*/function () {
1646
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(edrBaseUrlWithCollection, parameterName) {
1647
+ var datetime,
1648
+ instanceId,
1649
+ coords,
1650
+ queryParams,
1651
+ url,
1652
+ _args3 = arguments;
1653
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1654
+ while (1) switch (_context3.prev = _context3.next) {
1655
+ case 0:
1656
+ datetime = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : '';
1657
+ instanceId = _args3.length > 3 && _args3[3] !== undefined ? _args3[3] : '';
1658
+ coords = _args3.length > 4 && _args3[4] !== undefined ? _args3[4] : 'POLYGON((-180 -90, -180 90, 180 90, 180 -90, -180 -90))';
1659
+ queryParams = new URLSearchParams();
1660
+ queryParams.append('coords', coords);
1661
+ queryParams.append('parameter-name', parameterName);
1662
+ datetime && queryParams.append('datetime', datetime);
1663
+ url = "".concat(joinUrlParams([edrBaseUrlWithCollection, instanceId, 'area']), "?").concat(queryParams.toString());
1664
+ return _context3.abrupt("return", fetch(url).then(handleResponse));
1665
+ case 9:
1666
+ case "end":
1667
+ return _context3.stop();
1668
+ }
1669
+ }, _callee3);
1670
+ }));
1671
+ return function fetchEDRArea(_x4, _x5) {
1672
+ return _ref3.apply(this, arguments);
1673
+ };
1674
+ }();
1675
+ var fetchEDRParameter = /*#__PURE__*/function () {
1676
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(collection, edrBaseUrlWithCollection, parameterName) {
1677
+ var _collection$data_quer, _collection$data_quer2;
1678
+ var datetime,
1679
+ instanceId,
1680
+ _args4 = arguments;
1681
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
1682
+ while (1) switch (_context4.prev = _context4.next) {
1683
+ case 0:
1684
+ datetime = _args4.length > 3 && _args4[3] !== undefined ? _args4[3] : '';
1685
+ instanceId = _args4.length > 4 && _args4[4] !== undefined ? _args4[4] : '';
1686
+ if (!(collection !== null && collection !== void 0 && (_collection$data_quer = collection.data_queries) !== null && _collection$data_quer !== void 0 && _collection$data_quer.cube)) {
1687
+ _context4.next = 4;
1688
+ break;
1689
+ }
1690
+ return _context4.abrupt("return", fetchEDRCube(edrBaseUrlWithCollection, parameterName, datetime, instanceId));
1691
+ case 4:
1692
+ if (!(collection !== null && collection !== void 0 && (_collection$data_quer2 = collection.data_queries) !== null && _collection$data_quer2 !== void 0 && _collection$data_quer2.area)) {
1693
+ _context4.next = 6;
1694
+ break;
1695
+ }
1696
+ return _context4.abrupt("return", fetchEDRArea(edrBaseUrlWithCollection, parameterName, datetime, instanceId));
1697
+ case 6:
1698
+ return _context4.abrupt("return", undefined);
1699
+ case 7:
1700
+ case "end":
1701
+ return _context4.stop();
1702
+ }
1703
+ }, _callee4);
1704
+ }));
1705
+ return function fetchEDRParameter(_x6, _x7, _x8) {
1706
+ return _ref4.apply(this, arguments);
1707
+ };
1708
+ }();
1709
+
1710
+ /* *
1711
+ * Licensed under the Apache License, Version 2.0 (the "License");
1712
+ * you may not use this file except in compliance with the License.
1713
+ * You may obtain a copy of the License at
1714
+ *
1715
+ * http://www.apache.org/licenses/LICENSE-2.0
1716
+ *
1717
+ * Unless required by applicable law or agreed to in writing, software
1718
+ * distributed under the License is distributed on an "AS IS" BASIS,
1719
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1720
+ * See the License for the specific language governing permissions and
1721
+ * limitations under the License.
1722
+ *
1723
+ * Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1724
+ * Copyright 2025 - Finnish Meteorological Institute (FMI)
1725
+ * Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
1726
+ * */
1727
+ var coverageCollectionToFeatureCollection = function coverageCollectionToFeatureCollection(cov, parameterNames) {
1728
+ if (cov === undefined) {
1729
+ return {
1730
+ features: [],
1731
+ type: 'FeatureCollection'
1732
+ };
1733
+ }
1734
+ // For coverage collection
1735
+ if (cov && _typeof(cov) === 'object' && 'coverages' in cov) {
1736
+ var _cov$coverages$reduce, _cov$coverages;
1737
+ var latLonValues = (_cov$coverages$reduce = cov === null || cov === void 0 || (_cov$coverages = cov.coverages) === null || _cov$coverages === void 0 ? void 0 : _cov$coverages.reduce(function (coordinateObj, coverage) {
1738
+ // Extract all parameter from coverage
1739
+ var paramVals = {};
1740
+ // Add parameters values to latlon position
1741
+ var latlon = "".concat(coverage.domain.axes.x.values[0], ",").concat(coverage.domain.axes.y.values[0]);
1742
+ if (coordinateObj[latlon] === undefined) {
1743
+ parameterNames.split(',').forEach(function (parameterName) {
1744
+ var _coverage$ranges$para;
1745
+ paramVals[parameterName] = coverage.ranges[parameterName] ? (_coverage$ranges$para = coverage.ranges[parameterName]) === null || _coverage$ranges$para === void 0 ? void 0 : _coverage$ranges$para.values[0] : undefined;
1746
+ });
1747
+ return _objectSpread2(_objectSpread2({}, coordinateObj), {}, _defineProperty({}, latlon, paramVals));
1748
+ }
1749
+ // if it already exists, don't overwrite existing values unless they are undefined
1750
+ var currentVals = coordinateObj[latlon];
1751
+ parameterNames.split(',').forEach(function (parameterName) {
1752
+ if (coverage.ranges[parameterName] && currentVals[parameterName] === undefined) {
1753
+ var _coverage$ranges$para2;
1754
+ paramVals[parameterName] = (_coverage$ranges$para2 = coverage.ranges[parameterName]) === null || _coverage$ranges$para2 === void 0 ? void 0 : _coverage$ranges$para2.values[0];
1755
+ }
1756
+ });
1757
+ return _objectSpread2(_objectSpread2({}, coordinateObj), {}, _defineProperty({}, latlon, _objectSpread2(_objectSpread2({}, coordinateObj[latlon]), paramVals)));
1758
+ }, {})) !== null && _cov$coverages$reduce !== void 0 ? _cov$coverages$reduce : {};
1759
+ var features = Object.keys(latLonValues).map(function (latlon) {
1760
+ var latlonvalues = latlon.split(',');
1761
+ return {
1762
+ type: 'Feature',
1763
+ properties: {
1764
+ values: _objectSpread2({}, latLonValues[latlon])
1765
+ },
1766
+ geometry: {
1767
+ coordinates: [Number(latlonvalues[0]), Number(latlonvalues[1])],
1768
+ type: 'Point'
1769
+ }
1770
+ };
1771
+ });
1772
+ var _featurePoint = {
1773
+ type: 'FeatureCollection',
1774
+ features: features
1775
+ };
1776
+ return _featurePoint;
1777
+ }
1778
+ // For Coverage
1779
+ var paramVals = {};
1780
+ parameterNames.split(',').forEach(function (parameterName) {
1781
+ var _cov$ranges$parameter;
1782
+ paramVals[parameterName] = cov !== null && cov !== void 0 && cov.ranges[parameterName] ? (_cov$ranges$parameter = cov.ranges[parameterName]) === null || _cov$ranges$parameter === void 0 ? void 0 : _cov$ranges$parameter.values[0] : undefined;
1783
+ });
1784
+ var featurePoint = {
1785
+ type: 'FeatureCollection',
1786
+ features: [{
1787
+ type: 'Feature',
1788
+ properties: {
1789
+ values: _objectSpread2({}, paramVals)
1790
+ },
1791
+ geometry: {
1792
+ coordinates: [Number(cov === null || cov === void 0 ? void 0 : cov.domain.axes.x.values[0]), Number(cov === null || cov === void 0 ? void 0 : cov.domain.axes.y.values[0])],
1793
+ type: 'Point'
1794
+ }
1795
+ }]
1796
+ };
1797
+ return featurePoint;
1798
+ };
1624
1799
 
1625
1800
  var DEFAULT_STALE_TIME = 60000; // One minute
1626
- var useEDRLayerCollection = function useEDRLayerCollection(edrBaseUrlWithCollection) {
1801
+ // Ensures every webmap-react query starts with the same query key
1802
+ var generateWebmapQueryKeys = function generateWebmapQueryKeys(queryKeys) {
1803
+ return ['webmap-react'].concat(queryKeys);
1804
+ };
1805
+ var webmapEDRQueryOptions = {
1806
+ getCollectionDetailsQuery: function getCollectionDetailsQuery(edrBaseUrlWithCollection, enabled) {
1807
+ var instanceId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
1808
+ return queryOptions({
1809
+ staleTime: DEFAULT_STALE_TIME,
1810
+ queryKey: generateWebmapQueryKeys(['get-collection-details', edrBaseUrlWithCollection, instanceId]),
1811
+ queryFn: function () {
1812
+ var _queryFn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1813
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1814
+ while (1) switch (_context.prev = _context.next) {
1815
+ case 0:
1816
+ return _context.abrupt("return", fetchEDRCollectionDetails(edrBaseUrlWithCollection, instanceId));
1817
+ case 1:
1818
+ case "end":
1819
+ return _context.stop();
1820
+ }
1821
+ }, _callee);
1822
+ }));
1823
+ function queryFn() {
1824
+ return _queryFn.apply(this, arguments);
1825
+ }
1826
+ return queryFn;
1827
+ }(),
1828
+ enabled: edrBaseUrlWithCollection.length > 0 && enabled
1829
+ });
1830
+ }
1831
+ };
1832
+ var useEDRGetCollectionDetails = function useEDRGetCollectionDetails(edrBaseUrlWithCollection) {
1627
1833
  var instanceId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
1628
1834
  var enabled = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
1629
- return useQuery({
1630
- staleTime: DEFAULT_STALE_TIME,
1631
- queryKey: [edrBaseUrlWithCollection, instanceId, 'useEDRLayerCollection'],
1632
- queryFn: function () {
1633
- var _queryFn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1634
- return _regeneratorRuntime().wrap(function _callee$(_context) {
1635
- while (1) switch (_context.prev = _context.next) {
1636
- case 0:
1637
- return _context.abrupt("return", fetchEDRLayerCollection(edrBaseUrlWithCollection, instanceId));
1638
- case 1:
1639
- case "end":
1640
- return _context.stop();
1641
- }
1642
- }, _callee);
1643
- }));
1644
- function queryFn() {
1645
- return _queryFn.apply(this, arguments);
1646
- }
1647
- return queryFn;
1648
- }(),
1649
- enabled: edrBaseUrlWithCollection.length > 0 && enabled
1650
- });
1835
+ return useQuery(webmapEDRQueryOptions.getCollectionDetailsQuery(edrBaseUrlWithCollection, enabled, instanceId));
1651
1836
  };
1652
- var useEDRLayerCollectionCube = function useEDRLayerCollectionCube(edrBaseUrlWithCollection, parameterName) {
1837
+ var useEDRGetParameterData = function useEDRGetParameterData(edrBaseUrlWithCollection, parameterName) {
1653
1838
  var datetime = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
1654
1839
  var instanceId = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
1655
- var bbox = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '-180,-90,180,90';
1656
- var params = [edrBaseUrlWithCollection, instanceId, 'cube'];
1657
- var queryKey = [].concat(params, [bbox, parameterName, datetime]);
1840
+ var _useEDRGetCollectionD = useEDRGetCollectionDetails(edrBaseUrlWithCollection, instanceId),
1841
+ collection = _useEDRGetCollectionD.data;
1658
1842
  return useQuery({
1659
1843
  staleTime: DEFAULT_STALE_TIME,
1660
- queryKey: queryKey,
1844
+ queryKey: generateWebmapQueryKeys(['get-parameter-data', edrBaseUrlWithCollection, instanceId, parameterName, datetime]),
1661
1845
  queryFn: function () {
1662
1846
  var _queryFn2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
1847
+ var data;
1663
1848
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1664
1849
  while (1) switch (_context2.prev = _context2.next) {
1665
1850
  case 0:
1666
- return _context2.abrupt("return", fetchEDRLayerCollectionCube(edrBaseUrlWithCollection, parameterName, datetime, instanceId, bbox));
1667
- case 1:
1851
+ _context2.next = 2;
1852
+ return fetchEDRParameter(collection, edrBaseUrlWithCollection, parameterName, datetime, instanceId);
1853
+ case 2:
1854
+ data = _context2.sent;
1855
+ return _context2.abrupt("return", coverageCollectionToFeatureCollection(data, parameterName));
1856
+ case 4:
1668
1857
  case "end":
1669
1858
  return _context2.stop();
1670
1859
  }
@@ -1675,7 +1864,7 @@ var useEDRLayerCollectionCube = function useEDRLayerCollectionCube(edrBaseUrlWit
1675
1864
  }
1676
1865
  return queryFn;
1677
1866
  }(),
1678
- enabled: parameterName.length > 0
1867
+ enabled: collection !== undefined && parameterName.length > 0 && datetime.length > 0
1679
1868
  });
1680
1869
  };
1681
1870
 
@@ -1969,7 +2158,7 @@ var makeFeatureStyleMultiParam = function makeFeatureStyleMultiParam(feature) {
1969
2158
  var paramValues = Object.values(values);
1970
2159
  // Determine offset between columns (long strings need more space)
1971
2160
  var maxLength = Math.max.apply(Math, _toConsumableArray(paramValues.map(function (el) {
1972
- return el !== undefined ? el.toString().length : 1;
2161
+ return el ? el.toString().length : 1;
1973
2162
  })));
1974
2163
  var factor = maxLength > 5 ? 1.4 : 1;
1975
2164
  var offsetValues = getOffsetValues(factor);
@@ -2123,12 +2312,12 @@ var defaultEdrStyles = [{
2123
2312
  * @param {string} name
2124
2313
  * @returns {(WMLayer | null)}
2125
2314
  */
2126
- var useGetEDRWMLayerInstance = function useGetEDRWMLayerInstance(serviceUrl, name, id, onLayerError) {
2315
+ var useCreateEDRWMLayer = function useCreateEDRWMLayer(serviceUrl, name, id, onLayerError) {
2127
2316
  var _React$useState = React__default.useState(null),
2128
2317
  _React$useState2 = _slicedToArray(_React$useState, 2),
2129
2318
  layer = _React$useState2[0],
2130
2319
  setLayer = _React$useState2[1];
2131
- var refId = useRef(id || webmapUtils.generateLayerId());
2320
+ var refId = useRef(id !== null && id !== void 0 ? id : webmapUtils.generateLayerId());
2132
2321
  React__default.useEffect(function () {
2133
2322
  var layerId = refId.current;
2134
2323
  // Check if the layer is already registered
@@ -2153,23 +2342,23 @@ var useGetEDRWMLayerInstance = function useGetEDRWMLayerInstance(serviceUrl, nam
2153
2342
  }, [name, onLayerError, serviceUrl]);
2154
2343
  return layer;
2155
2344
  };
2156
- var useGetEDRLayerInstance = function useGetEDRLayerInstance(edrBaseUrl, parameter, layerId, onInitializeLayer) {
2157
- var wmLayer = useGetEDRWMLayerInstance(edrBaseUrl, parameter, layerId);
2158
- var collectionInfo = useEDRLayerCollection(edrBaseUrl);
2345
+ var useEDRWMLayer = function useEDRWMLayer(edrBaseUrl, parameter, layerId, onInitializeLayer) {
2346
+ var wmLayer = useCreateEDRWMLayer(edrBaseUrl, parameter, layerId);
2347
+ var collectionInfo = useEDRGetCollectionDetails(edrBaseUrl);
2159
2348
  var _React$useState3 = React__default.useState(undefined),
2160
2349
  _React$useState4 = _slicedToArray(_React$useState3, 2),
2161
2350
  timeRangeDuration = _React$useState4[0],
2162
2351
  setTimeRangeDuration = _React$useState4[1];
2163
2352
  React__default.useEffect(function () {
2164
2353
  if (wmLayer && collectionInfo.data && collectionInfo.isFetched) {
2165
- var _collectionInfo$data, _collectionInfo$data2;
2166
- // TODO: Extract PT10M from the EDR service: https://gitlab.com/opengeoweb/geoweb-assets/-/issues/4139
2167
- var timeRangeDurationFromEdrCollection = "".concat((_collectionInfo$data = collectionInfo.data) === null || _collectionInfo$data === void 0 || (_collectionInfo$data = _collectionInfo$data.extent) === null || _collectionInfo$data === void 0 || (_collectionInfo$data = _collectionInfo$data.temporal) === null || _collectionInfo$data === void 0 ? void 0 : _collectionInfo$data.interval[0][0], "/").concat((_collectionInfo$data2 = collectionInfo.data) === null || _collectionInfo$data2 === void 0 || (_collectionInfo$data2 = _collectionInfo$data2.extent) === null || _collectionInfo$data2 === void 0 || (_collectionInfo$data2 = _collectionInfo$data2.temporal) === null || _collectionInfo$data2 === void 0 ? void 0 : _collectionInfo$data2.interval[0][1], "/PT10M");
2354
+ var _collectionInfo$data, _collectionInfo$data2, _collectionInfo$data3, _collectionInfo$data4;
2355
+ // TODO: Extract timerange from the EDR service: https://gitlab.com/opengeoweb/geoweb-assets/-/issues/4139
2356
+ var timeRangeDurationFromEdrCollection = edrBaseUrl.includes('10-minute') ? "".concat((_collectionInfo$data = collectionInfo.data) === null || _collectionInfo$data === void 0 || (_collectionInfo$data = _collectionInfo$data.extent) === null || _collectionInfo$data === void 0 || (_collectionInfo$data = _collectionInfo$data.temporal) === null || _collectionInfo$data === void 0 ? void 0 : _collectionInfo$data.interval[0][0], "/").concat((_collectionInfo$data2 = collectionInfo.data) === null || _collectionInfo$data2 === void 0 || (_collectionInfo$data2 = _collectionInfo$data2.extent) === null || _collectionInfo$data2 === void 0 || (_collectionInfo$data2 = _collectionInfo$data2.temporal) === null || _collectionInfo$data2 === void 0 ? void 0 : _collectionInfo$data2.interval[0][1], "/PT10M") : "".concat((_collectionInfo$data3 = collectionInfo.data) === null || _collectionInfo$data3 === void 0 || (_collectionInfo$data3 = _collectionInfo$data3.extent) === null || _collectionInfo$data3 === void 0 || (_collectionInfo$data3 = _collectionInfo$data3.temporal) === null || _collectionInfo$data3 === void 0 ? void 0 : _collectionInfo$data3.interval[0][0], "/").concat((_collectionInfo$data4 = collectionInfo.data) === null || _collectionInfo$data4 === void 0 || (_collectionInfo$data4 = _collectionInfo$data4.extent) === null || _collectionInfo$data4 === void 0 || (_collectionInfo$data4 = _collectionInfo$data4.temporal) === null || _collectionInfo$data4 === void 0 ? void 0 : _collectionInfo$data4.interval[0][1], "/PT1M");
2168
2357
  if (!wmLayer.getDimension('time')) {
2169
- var _collectionInfo$data3;
2358
+ var _collectionInfo$data5;
2170
2359
  var dim = new WMJSDimension({
2171
2360
  name: 'time',
2172
- currentValue: (_collectionInfo$data3 = collectionInfo.data) === null || _collectionInfo$data3 === void 0 || (_collectionInfo$data3 = _collectionInfo$data3.extent) === null || _collectionInfo$data3 === void 0 || (_collectionInfo$data3 = _collectionInfo$data3.temporal) === null || _collectionInfo$data3 === void 0 ? void 0 : _collectionInfo$data3.interval[0][1],
2361
+ currentValue: (_collectionInfo$data5 = collectionInfo.data) === null || _collectionInfo$data5 === void 0 || (_collectionInfo$data5 = _collectionInfo$data5.extent) === null || _collectionInfo$data5 === void 0 || (_collectionInfo$data5 = _collectionInfo$data5.temporal) === null || _collectionInfo$data5 === void 0 ? void 0 : _collectionInfo$data5.interval[0][1],
2173
2362
  units: 'ISO8601',
2174
2363
  values: timeRangeDurationFromEdrCollection
2175
2364
  });
@@ -2182,7 +2371,7 @@ var useGetEDRLayerInstance = function useGetEDRLayerInstance(edrBaseUrl, paramet
2182
2371
  setTimeRangeDuration(timeRangeDurationFromEdrCollection);
2183
2372
  wmLayer.isConfigured = true;
2184
2373
  }
2185
- }, [collectionInfo.data, collectionInfo.isFetched, wmLayer]);
2374
+ }, [collectionInfo.data, collectionInfo.isFetched, wmLayer, edrBaseUrl]);
2186
2375
  React__default.useEffect(function () {
2187
2376
  var initializeLayer = /*#__PURE__*/function () {
2188
2377
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
@@ -2213,7 +2402,7 @@ var useGetEDRLayerInstance = function useGetEDRLayerInstance(edrBaseUrl, paramet
2213
2402
  }),
2214
2403
  style: ''
2215
2404
  };
2216
- onInitializeLayer && onInitializeLayer(layerProps);
2405
+ onInitializeLayer === null || onInitializeLayer === void 0 || onInitializeLayer(layerProps);
2217
2406
  }
2218
2407
  case 1:
2219
2408
  case "end":
@@ -11416,7 +11605,8 @@ var addFeatureProperties = function addFeatureProperties(geojson, featurePropert
11416
11605
  return null;
11417
11606
  }
11418
11607
  return produce(geojson, function (draft) {
11419
- if (draft.features && draft.features.length > 0 && draft.features[featureIndex] !== undefined && draft.features[featureIndex].properties) {
11608
+ var _draft$features$featu;
11609
+ if (draft.features && draft.features.length > 0 && (_draft$features$featu = draft.features[featureIndex]) !== null && _draft$features$featu !== void 0 && _draft$features$featu.properties) {
11420
11610
  Object.keys(featureProperties).forEach(function (key) {
11421
11611
  draft.features[featureIndex].properties[key] = featureProperties[key];
11422
11612
  });
@@ -11439,16 +11629,19 @@ var getGeoJSONPropertyValue = function getGeoJSONPropertyValue(property, propert
11439
11629
  var defaultProperties = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : defaultGeoJSONStyleProperties;
11440
11630
  // if a shape is set, extract the style from there
11441
11631
  if (properties[property] !== undefined) {
11632
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
11442
11633
  return properties[property];
11443
11634
  }
11444
11635
  // if active polygon tool is preset, retreive style from there
11445
11636
  if (polygonDrawMode) {
11446
11637
  var polygonDrawModeProperty = polygonDrawMode.shape.type === 'Feature' && polygonDrawMode.shape.properties[property];
11447
11638
  if (polygonDrawModeProperty !== undefined) {
11639
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
11448
11640
  return polygonDrawModeProperty;
11449
11641
  }
11450
11642
  }
11451
11643
  // otherwise get values from defaultStyle
11644
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
11452
11645
  return defaultProperties[property];
11453
11646
  };
11454
11647
  /**
@@ -11479,7 +11672,8 @@ var moveFeature = function moveFeature(currentGeoJSON, newGeoJSON, featureLayerI
11479
11672
  return newGeoJSON.features.length - 1;
11480
11673
  }
11481
11674
  if (geometry.type === 'LineString' && geometry.coordinates.length > 2 && reason === NEW_LINESTRING_CREATED) {
11482
- var _lastCoordinate = geometry.coordinates.pop() || [0, 0];
11675
+ var _geometry$coordinates;
11676
+ var _lastCoordinate = (_geometry$coordinates = geometry.coordinates.pop()) !== null && _geometry$coordinates !== void 0 ? _geometry$coordinates : [0, 0];
11483
11677
  var _copyFeature = _objectSpread2(_objectSpread2({}, feature), {}, {
11484
11678
  geometry: _objectSpread2(_objectSpread2({}, geometry), {}, {
11485
11679
  coordinates: [_toConsumableArray(_lastCoordinate), _toConsumableArray(_lastCoordinate)]
@@ -11518,14 +11712,14 @@ var intersectPointGeoJSONS = function intersectPointGeoJSONS(intersectA, interse
11518
11712
  fill: '#0000FF',
11519
11713
  'fill-opacity': 1.0
11520
11714
  };
11521
- var featureA = turf.feature(intersectA.features[0].geometry);
11522
- var featureB = turf.feature(intersectB.features[0].geometry);
11715
+ var featureA = feature(intersectA.features[0].geometry);
11716
+ var featureB = feature(intersectB.features[0].geometry);
11523
11717
  var options = {
11524
11718
  tolerance: 0.001,
11525
11719
  highQuality: true
11526
11720
  };
11527
- var simplifiedB = turf.simplify(featureB, options);
11528
- var isInside = turf.booleanPointInPolygon(intersectA.features[0].geometry, simplifiedB);
11721
+ var simplifiedB = simplify(featureB, options);
11722
+ var isInside = booleanPointInPolygon(intersectA.features[0].geometry, simplifiedB);
11529
11723
  return addFeatureProperties({
11530
11724
  type: 'FeatureCollection',
11531
11725
  features: !isInside ? [{
@@ -11540,13 +11734,71 @@ var intersectPointGeoJSONS = function intersectPointGeoJSONS(intersectA, interse
11540
11734
  }] : [featureA]
11541
11735
  }, geoJSONProperties);
11542
11736
  };
11737
+ // Helper functions for projection matching
11738
+ function makeProjectorsFromCode(epsg) {
11739
+ if (!epsg || epsg === 'EPSG:4326') {
11740
+ var id = function id(ft) {
11741
+ return ft;
11742
+ };
11743
+ return {
11744
+ project: id,
11745
+ unproject: id
11746
+ };
11747
+ }
11748
+ // 3857-variants
11749
+ if (['EPSG:3857', 'EPSG:3785', 'EPSG:900913', 'EPSG:102100'].includes(epsg)) {
11750
+ return {
11751
+ project: function project(feature) {
11752
+ return toMercator(feature);
11753
+ },
11754
+ unproject: function unproject(feature) {
11755
+ return toWgs84(feature);
11756
+ }
11757
+ };
11758
+ }
11759
+ var fwd = proj4('EPSG:4326', epsg); // WGS84 -> target SRS
11760
+ var project = function project(feat) {
11761
+ var out = cloneDeep(feat);
11762
+ coordEach(out, function (coords) {
11763
+ var _fwd$forward = fwd.forward([coords[0], coords[1]]),
11764
+ _fwd$forward2 = _slicedToArray(_fwd$forward, 2),
11765
+ x = _fwd$forward2[0],
11766
+ y = _fwd$forward2[1];
11767
+ // eslint-disable-next-line no-param-reassign
11768
+ coords[0] = x;
11769
+ // eslint-disable-next-line no-param-reassign
11770
+ coords[1] = y;
11771
+ });
11772
+ return out;
11773
+ };
11774
+ var unproject = function unproject(feat) {
11775
+ var out = cloneDeep(feat);
11776
+ coordEach(out, function (coords) {
11777
+ var _fwd$inverse = fwd.inverse([coords[0], coords[1]]),
11778
+ _fwd$inverse2 = _slicedToArray(_fwd$inverse, 2),
11779
+ lon = _fwd$inverse2[0],
11780
+ lat = _fwd$inverse2[1];
11781
+ // eslint-disable-next-line no-param-reassign
11782
+ coords[0] = lon;
11783
+ // eslint-disable-next-line no-param-reassign
11784
+ coords[1] = lat;
11785
+ });
11786
+ return out;
11787
+ };
11788
+ return {
11789
+ project: project,
11790
+ unproject: unproject
11791
+ };
11792
+ }
11543
11793
  /**
11544
11794
  * Returns the intersection of two (multi) polygon features. In case of a polygon, only the first feature is used.
11545
11795
  * @param intersectA Feature A
11546
11796
  * @param intersectB Feature B
11547
11797
  * @returns The intersection of the two features.
11548
11798
  */
11549
- var intersectPolygonGeoJSONS = function intersectPolygonGeoJSONS(intersectA, intersectB) {
11799
+ function intersectPolygonGeoJSONS(intersectA,
11800
+ // drawn polygon (WGS84)
11801
+ intersectB) {
11550
11802
  var geoJSONProperties = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
11551
11803
  stroke: '#FF0000',
11552
11804
  'stroke-width': 10.0,
@@ -11554,29 +11806,45 @@ var intersectPolygonGeoJSONS = function intersectPolygonGeoJSONS(intersectA, int
11554
11806
  fill: '#0000FF',
11555
11807
  'fill-opacity': 1.0
11556
11808
  };
11557
- var featureA = turf.feature(intersectA.features[0].geometry);
11558
- var featureB = turf.feature(intersectB.features[0].geometry);
11559
- var options = {
11560
- tolerance: 0.001,
11561
- highQuality: true
11809
+ var projectionCode = arguments.length > 3 ? arguments[3] : undefined;
11810
+ // Pull geometry
11811
+ var drawnPolygon = intersectA.features[0];
11812
+ var firPolygon = intersectB.features[0];
11813
+ // Projector based on active map projection
11814
+ var _makeProjectorsFromCo = makeProjectorsFromCode(projectionCode),
11815
+ project = _makeProjectorsFromCo.project,
11816
+ unproject = _makeProjectorsFromCo.unproject;
11817
+ var drawnInMap = project(drawnPolygon);
11818
+ var firInMap = project(firPolygon);
11819
+ // Intersect in map projection
11820
+ var pair = {
11821
+ type: 'FeatureCollection',
11822
+ features: [drawnInMap, firInMap]
11562
11823
  };
11563
- var simplifiedA = turf.simplify(featureA, options);
11564
- var simplifiedB = turf.simplify(featureB, options);
11565
- var intersection = turf.intersect(turf.featureCollection([simplifiedA, simplifiedB]));
11824
+ var intersectionInMapProj = intersect(pair);
11825
+ if (!intersectionInMapProj) {
11826
+ return addFeatureProperties({
11827
+ type: 'FeatureCollection',
11828
+ features: [{
11829
+ type: 'Feature',
11830
+ properties: {
11831
+ selectionType: 'poly'
11832
+ },
11833
+ geometry: {
11834
+ type: 'Polygon',
11835
+ coordinates: [[]]
11836
+ }
11837
+ }]
11838
+ }, geoJSONProperties);
11839
+ }
11840
+ // Back to WGS84 for rendering
11841
+ var intersectionWgs84 = unproject(intersectionInMapProj);
11842
+ var intersectionWgs84Cleaned = cleanCoords(intersectionWgs84);
11566
11843
  return addFeatureProperties({
11567
11844
  type: 'FeatureCollection',
11568
- features: intersection === null ? [{
11569
- type: 'Feature',
11570
- properties: {
11571
- selectionType: 'poly'
11572
- },
11573
- geometry: {
11574
- type: 'Polygon',
11575
- coordinates: [[]]
11576
- }
11577
- }] : [intersection]
11845
+ features: [intersectionWgs84Cleaned]
11578
11846
  }, geoJSONProperties);
11579
- };
11847
+ }
11580
11848
  var isPointFeatureCollection = function isPointFeatureCollection(geojson) {
11581
11849
  return geojson.features[0].geometry.type === 'Point';
11582
11850
  };
@@ -11593,12 +11861,13 @@ var createInterSections = function createInterSections(geojson, otherGeoJSON) {
11593
11861
  fill: '#f24a00',
11594
11862
  'fill-opacity': 0.5
11595
11863
  };
11864
+ var proj = arguments.length > 3 ? arguments[3] : undefined;
11596
11865
  var intersections = produce(geojson, function () {
11597
11866
  try {
11598
11867
  if (isPointFeatureCollection(geojson)) {
11599
11868
  return addFeatureProperties(intersectPointGeoJSONS(geojson, otherGeoJSON), geoJSONproperties);
11600
11869
  }
11601
- return addFeatureProperties(intersectPolygonGeoJSONS(geojson, otherGeoJSON), geoJSONproperties);
11870
+ return addFeatureProperties(intersectPolygonGeoJSONS(geojson, otherGeoJSON, defaultGeoJSONStyleProperties, proj), geoJSONproperties);
11602
11871
  } catch (_error) {
11603
11872
  return addFeatureProperties(geojson, geoJSONproperties);
11604
11873
  }
@@ -11704,7 +11973,7 @@ var addSelectionTypeToGeoJSON = function addSelectionTypeToGeoJSON(geoJSON, sele
11704
11973
  });
11705
11974
  };
11706
11975
  var getFeatureExtent = function getFeatureExtent(geoJSON) {
11707
- var turfBbox = turf.bbox(geoJSON);
11976
+ var turfBbox = bbox(geoJSON);
11708
11977
  return {
11709
11978
  left: turfBbox[0],
11710
11979
  bottom: turfBbox[1],
@@ -11834,7 +12103,8 @@ var useMapDrawTool = function useMapDrawTool(_ref) {
11834
12103
  _ref$geoJSONIntersect = _ref.geoJSONIntersectionLayerId,
11835
12104
  geoJSONIntersectionLayerId = _ref$geoJSONIntersect === void 0 ? 'intersection-layer' : _ref$geoJSONIntersect,
11836
12105
  _ref$geoJSONIntersect2 = _ref.geoJSONIntersectionBoundsLayerId,
11837
- geoJSONIntersectionBoundsLayerId = _ref$geoJSONIntersect2 === void 0 ? 'static-layer' : _ref$geoJSONIntersect2;
12106
+ geoJSONIntersectionBoundsLayerId = _ref$geoJSONIntersect2 === void 0 ? 'static-layer' : _ref$geoJSONIntersect2,
12107
+ projection = _ref.projection;
11838
12108
  // geoJSON feature collections
11839
12109
  var _React$useState = React__default.useState(defaultGeoJSON),
11840
12110
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -11922,7 +12192,7 @@ var useMapDrawTool = function useMapDrawTool(_ref) {
11922
12192
  }
11923
12193
  setGeoJSON(newGeoJSON);
11924
12194
  if (geoJSONIntersectionBounds) {
11925
- var newIntersection = createInterSections(newGeoJSON, geoJSONIntersectionBounds, defaultGeoJSONIntersectionProperties);
12195
+ var newIntersection = createInterSections(newGeoJSON, geoJSONIntersectionBounds, defaultGeoJSONIntersectionProperties, projection);
11926
12196
  setGeoJSONIntersection(newIntersection);
11927
12197
  return [newGeoJSON, newIntersection];
11928
12198
  }
@@ -14052,6 +14322,8 @@ var TimeawareImageSourceWMSLayer = function TimeawareImageSourceWMSLayer(_ref) {
14052
14322
  // Assign olSource in wmlayer for metronome
14053
14323
  wmLayer.olSource = olLayer === null || olLayer === void 0 ? void 0 : olLayer.getSource();
14054
14324
  return function () {
14325
+ var _olLayer$getSource;
14326
+ olLayer === null || olLayer === void 0 || (_olLayer$getSource = olLayer.getSource()) === null || _olLayer$getSource === void 0 || _olLayer$getSource.cancelPrefetch();
14055
14327
  wmLayer.olSource = null;
14056
14328
  map.removeLayer(olLayer);
14057
14329
  olLayer.dispose();
@@ -15467,50 +15739,8 @@ var OpenLayersFeatureLayer = function OpenLayersFeatureLayer(_ref) {
15467
15739
  });
15468
15740
  };
15469
15741
 
15470
- /* *
15471
- * Licensed under the Apache License, Version 2.0 (the "License");
15472
- * you may not use this file except in compliance with the License.
15473
- * You may obtain a copy of the License at
15474
- *
15475
- * http://www.apache.org/licenses/LICENSE-2.0
15476
- *
15477
- * Unless required by applicable law or agreed to in writing, software
15478
- * distributed under the License is distributed on an "AS IS" BASIS,
15479
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15480
- * See the License for the specific language governing permissions and
15481
- * limitations under the License.
15482
- *
15483
- * Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
15484
- * Copyright 2025 - Finnish Meteorological Institute (FMI)
15485
- * Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
15486
- * */
15487
- var coverageCollectionToFeatureCollection = function coverageCollectionToFeatureCollection(cov, parameterNames) {
15488
- var _cov$coverages;
15489
- var latLonValues = (cov === null || cov === void 0 || (_cov$coverages = cov.coverages) === null || _cov$coverages === void 0 ? void 0 : _cov$coverages.map(function (coverage) {
15490
- var paramValues = parameterNames.split(',').reduce(function (obj, parameterName) {
15491
- var _coverage$ranges$para;
15492
- return _objectSpread2(_objectSpread2({}, obj), {}, _defineProperty({}, parameterName, (_coverage$ranges$para = coverage.ranges[parameterName]) === null || _coverage$ranges$para === void 0 ? void 0 : _coverage$ranges$para.values[0]));
15493
- }, {});
15494
- return {
15495
- type: 'Feature',
15496
- properties: {
15497
- values: _objectSpread2({}, paramValues)
15498
- },
15499
- geometry: {
15500
- coordinates: [coverage.domain.axes.x.values[0], coverage.domain.axes.y.values[0]],
15501
- type: 'Point'
15502
- }
15503
- };
15504
- })) || [];
15505
- var featurePoint = {
15506
- type: 'FeatureCollection',
15507
- features: latLonValues
15508
- };
15509
- return featurePoint;
15510
- };
15511
-
15512
15742
  var TimeAwareEDRLocationLayer = function TimeAwareEDRLocationLayer(_ref) {
15513
- var _wmLayer$getDimension;
15743
+ var _wmLayer$getDimension, _wmLayer$getDimension2;
15514
15744
  var edrBaseUrl = _ref.edrBaseUrl,
15515
15745
  parameter = _ref.parameter,
15516
15746
  style = _ref.style,
@@ -15522,30 +15752,23 @@ var TimeAwareEDRLocationLayer = function TimeAwareEDRLocationLayer(_ref) {
15522
15752
  visible = _ref$visible === void 0 ? true : _ref$visible,
15523
15753
  onInitializeLayer = _ref.onInitializeLayer;
15524
15754
  // get a wmLayer instance
15525
- var wmLayer = useGetEDRLayerInstance(edrBaseUrl, parameter, layerId, onInitializeLayer);
15755
+ var wmLayer = useEDRWMLayer(edrBaseUrl, parameter, layerId, onInitializeLayer);
15526
15756
  // dimensionsValues is a key/value dictionary with dimension names specifically for WMS GetMap requests. We re-use it here for EDR.
15527
15757
  var dimensionsValues = getDimensionParamsForWMS(dimensions, wmLayer);
15528
- var timeValue = dimensionsValues && dimensionsValues['TIME'];
15529
- var _React$useState = React__default.useState({
15530
- features: [],
15531
- type: 'FeatureCollection'
15532
- }),
15533
- _React$useState2 = _slicedToArray(_React$useState, 2),
15534
- featurePoints = _React$useState2[0],
15535
- setFeaturePoints = _React$useState2[1];
15536
- var edrQueryDateTime = (wmLayer === null || wmLayer === void 0 || (_wmLayer$getDimension = wmLayer.getDimension('time')) === null || _wmLayer$getDimension === void 0 ? void 0 : _wmLayer$getDimension.getClosestValue(timeValue)) || timeValue;
15537
- var result = useEDRLayerCollectionCube(edrBaseUrl, parameter, edrQueryDateTime);
15538
- React__default.useEffect(function () {
15539
- var featurePoint = coverageCollectionToFeatureCollection(result.data, parameter);
15540
- if (!featurePoint) {
15541
- return;
15542
- }
15543
- setFeaturePoints(featurePoint);
15544
- }, [parameter, result.data]);
15758
+ var timeValue = dimensionsValues === null || dimensionsValues === void 0 ? void 0 : dimensionsValues['TIME'];
15759
+ var edrQueryDateTime = (_wmLayer$getDimension = wmLayer === null || wmLayer === void 0 || (_wmLayer$getDimension2 = wmLayer.getDimension('time')) === null || _wmLayer$getDimension2 === void 0 ? void 0 : _wmLayer$getDimension2.getClosestValue(timeValue)) !== null && _wmLayer$getDimension !== void 0 ? _wmLayer$getDimension : timeValue;
15760
+ var _useEDRGetParameterDa = useEDRGetParameterData(edrBaseUrl, parameter, edrQueryDateTime),
15761
+ featurePoints = _useEDRGetParameterDa.data,
15762
+ isFetching = _useEDRGetParameterDa.isFetching;
15545
15763
  var loadingStyle = parameter !== null && parameter !== void 0 && parameter.includes(',') ? makeFeatureStyleMultiParamLoading : makeFeatureStyleLoading;
15764
+ // Send empty collection if no API result yet
15765
+ var featureCollection = featurePoints !== null && featurePoints !== void 0 ? featurePoints : {
15766
+ features: [],
15767
+ type: 'FeatureCollection'
15768
+ };
15546
15769
  return jsx(OpenLayersFeatureLayer, {
15547
- featureCollection: featurePoints,
15548
- style: result.isFetching ? loadingStyle : style,
15770
+ featureCollection: featureCollection,
15771
+ style: isFetching ? loadingStyle : style,
15549
15772
  opacity: opacity,
15550
15773
  zIndex: zIndex,
15551
15774
  declutter: true,
@@ -16752,4 +16975,4 @@ var getLayerUpdateInfo = function getLayerUpdateInfo(wmLayer, mapId) {
16752
16975
  return updateObject;
16753
16976
  };
16754
16977
 
16755
- export { BaseLayerType, ClickOnMapTool, DRAWMODE, DefaultBaseLayers, DimensionSelectButton, DimensionSelectDialog, DimensionSelectSlider, EditModeButton as EditModeButtonField, FEATURE_FILL, FEATURE_FILL_SELECTED, FEATURE_STROKE, FEATURE_STROKE_EDIT, FEATURE_STROKE_SELECTED, FEATURE_VERTICES_EDIT_HANDLES, FEATURE_VERTICE_HANDLE_IMAGE, FEATURE_VERTICE_IMAGE, FeatureLayer, FeatureLayers, GeoJSONTextField, ICON_LOCATIONMARKER, ICON_LOCATIONMARKER_MODIFY, ICON_LOCATIONMARKER_SELECTED, IntersectionSelect, LayerInfoButton, LayerInfoDialog, LayerInfoLegend, LayerInfoList, LayerInfoText, Legend, LegendButton, LegendDialog, LegendLayout, MapContext, MapControlButton, MapControls, MapDimensionSelect, MapFeatureClass, MapTime, MapWarningProperties, NEW_FEATURE_CREATED, NEW_LINESTRING_CREATED, NEW_POINT_CREATED, OpenLayersFeatureLayer, OpenLayersGetFeatureInfo, OpenLayersLayer, OpenLayersMapDraw, OpenLayersMapView, OpenLayersZoomControl, Proj4js, SelectField, StoryLayoutGrid, TimeAwareEDRLocationLayer, TimeContext, TimeawareImageSource, TimeawareImageSourceWMSLayer, WEBMAP_REACT_NAMESPACE, WMSLayer, WMTSLayer, XYZLayer, ZoomControls, addFeatureProperties, addGeoJSONProperties, addSelectionTypeToGeoJSON, basicExampleDrawOptions, basicExampleMultipleShapeDrawOptions, basicExampleMultipleShapeWithValuesDrawOptions, basicExampleSmoothLineOptions, catmullRomSpline, clearImageCacheForAllMaps, colorMaps, createIconStyle, createInterSections, currentlySupportedDrawModes, defaultBox, defaultDelete, defaultEdrStyles, defaultGeoJSONStyleProperties, defaultIntersectionStyleProperties, defaultLayers, defaultModes, defaultPoint, defaultPolygon, defaultTimeFormat, dimensionConfig, drawPolyStoryStyles, drawStyles, emptyGeoJSON, endToolExampleConfig, exampleIntersectionOptions, exampleIntersectionWithShapeOptions, exampleIntersections, exampleIntersectionsMultiDrawTool, fakeEdrLayerApiHandlers, featureBox, featureMultiPoint, featurePoint, featurePolygon, fillOptions, firSelectionType, formatTime, generateImageFromLegend, genericOpenLayersFeatureStyle, geowebColorToOpenLayersColor, getDimensionIcon, getDimensionLabel, getDimensionValue, getDimensionsList, getDoubleControlToolIcon, getFeatureCollection, getFeatureExtent, getFirTitle, getGeoJSONPropertyValue, getGeoJson, getIcon, getIntersectionToolIcon, getIsInsideAcceptanceTime, getLastEmptyFeatureIndex, getLayerBbox, getLayerStyles, getLayerUpdateInfo, getLegendClass, getProj4, getTimeDimension, getToolIcon, initializeOpenLayersProjections, inlineFeatureStyle, intersectPointGeoJSONS, intersectPolygonGeoJSONS, intersectionFeatureBE, intersectionFeatureNL, isGeoJSONFeatureCreatedByTool, isGeoJSONGeometryEmpty, isPointFeatureCollection, lineString, lineStringCollection, makeFeatureStyleDisc, makeFeatureStyleLoading, makeFeatureStyleMultiParam, makeFeatureStyleMultiParamLoading, makeFeatureStyleWind, makeLegendFromColorMap, makeLegendFromStyleName, makeTimeList, makeView, marksByDimension, modifyStyles, moveFeature, multiLineStringLabelStyle, multiPolygonLabelStyle, opacityOptions, openLayersGetMapImageStore, precipitationMMLegendColorsWoW, projectorCache, publicLayers, publicServices, rewindGeometry, selectPreferredWMSProjection, setMapCenter, setViewFromExtent, setViewFromFeature, simpleBoxGeoJSON, simpleBoxGeoJSONWrongOrder, simpleFlightRouteLineStringGeoJSON, simpleFlightRoutePointsGeoJSON, simpleGeometryCollectionGeoJSON, simpleLineStringGeoJSON, simpleMultiPolygon, simplePointsGeojson, simplePolygonGeoJSON, simpleSmallLineStringGeoJSON, startToolExampleConfig, strokeWidthOptions, styleNameToStyleLike, temperatureLegendColorsCWK, temperatureLegendColorsWoW, textLabelStyle, textStyle, textStyleWithMargin, updateEditModeButtonsWithFir, useAnimationForLayer, useEDRLayerCollection, useEDRLayerCollectionCube, useGeoJSON, useGetEDRLayerInstance, useGetWMLayerInstance, useGetWMSLayerStyleList, useIconStyle, useMapDrawTool, useProjection, useQueryGetWMSGetCapabilities, useQueryGetWMSLayer, useQueryGetWMSLayers, useQueryGetWMSLayersTree, useQueryGetWMSServiceInfo, useQueryWMTSGetCapabilities, useSetIntervalWhenVisible, useViewFromLayer, viewUtils, webmapReactTranslations };
16978
+ export { BaseLayerType, ClickOnMapTool, DRAWMODE, DefaultBaseLayers, DimensionSelectButton, DimensionSelectDialog, DimensionSelectSlider, EditModeButton as EditModeButtonField, FEATURE_FILL, FEATURE_FILL_SELECTED, FEATURE_STROKE, FEATURE_STROKE_EDIT, FEATURE_STROKE_SELECTED, FEATURE_VERTICES_EDIT_HANDLES, FEATURE_VERTICE_HANDLE_IMAGE, FEATURE_VERTICE_IMAGE, FeatureLayer, FeatureLayers, GeoJSONTextField, ICON_LOCATIONMARKER, ICON_LOCATIONMARKER_MODIFY, ICON_LOCATIONMARKER_SELECTED, IntersectionSelect, LayerInfoButton, LayerInfoDialog, LayerInfoLegend, LayerInfoList, LayerInfoText, Legend, LegendButton, LegendDialog, LegendLayout, MapContext, MapControlButton, MapControls, MapDimensionSelect, MapFeatureClass, MapTime, MapWarningProperties, NEW_FEATURE_CREATED, NEW_LINESTRING_CREATED, NEW_POINT_CREATED, OpenLayersFeatureLayer, OpenLayersGetFeatureInfo, OpenLayersLayer, OpenLayersMapDraw, OpenLayersMapView, OpenLayersZoomControl, Proj4js, SelectField, StoryLayoutGrid, TimeAwareEDRLocationLayer, TimeContext, TimeawareImageSource, TimeawareImageSourceWMSLayer, WEBMAP_REACT_NAMESPACE, WMSLayer, WMTSLayer, XYZLayer, ZoomControls, addFeatureProperties, addGeoJSONProperties, addSelectionTypeToGeoJSON, basicExampleDrawOptions, basicExampleMultipleShapeDrawOptions, basicExampleMultipleShapeWithValuesDrawOptions, basicExampleSmoothLineOptions, catmullRomSpline, clearImageCacheForAllMaps, colorMaps, createIconStyle, createInterSections, currentlySupportedDrawModes, defaultBox, defaultDelete, defaultEdrStyles, defaultGeoJSONStyleProperties, defaultIntersectionStyleProperties, defaultLayers, defaultModes, defaultPoint, defaultPolygon, defaultTimeFormat, dimensionConfig, drawPolyStoryStyles, drawStyles, emptyGeoJSON, endToolExampleConfig, exampleIntersectionOptions, exampleIntersectionWithShapeOptions, exampleIntersections, exampleIntersectionsMultiDrawTool, fakeEdrLayerApiHandlers, featureBox, featureMultiPoint, featurePoint, featurePolygon, fillOptions, firSelectionType, formatTime, generateImageFromLegend, genericOpenLayersFeatureStyle, geowebColorToOpenLayersColor, getDimensionIcon, getDimensionLabel, getDimensionValue, getDimensionsList, getDoubleControlToolIcon, getFeatureCollection, getFeatureExtent, getFirTitle, getGeoJSONPropertyValue, getGeoJson, getIcon, getIntersectionToolIcon, getIsInsideAcceptanceTime, getLastEmptyFeatureIndex, getLayerBbox, getLayerStyles, getLayerUpdateInfo, getLegendClass, getProj4, getTimeDimension, getToolIcon, initializeOpenLayersProjections, inlineFeatureStyle, intersectPointGeoJSONS, intersectPolygonGeoJSONS, intersectionFeatureBE, intersectionFeatureNL, isGeoJSONFeatureCreatedByTool, isGeoJSONGeometryEmpty, isPointFeatureCollection, lineString, lineStringCollection, makeFeatureStyleDisc, makeFeatureStyleLoading, makeFeatureStyleMultiParam, makeFeatureStyleMultiParamLoading, makeFeatureStyleWind, makeLegendFromColorMap, makeLegendFromStyleName, makeTimeList, makeView, marksByDimension, modifyStyles, moveFeature, multiLineStringLabelStyle, multiPolygonLabelStyle, opacityOptions, openLayersGetMapImageStore, precipitationMMLegendColorsWoW, projectorCache, publicLayers, publicServices, rewindGeometry, selectPreferredWMSProjection, setMapCenter, setViewFromExtent, setViewFromFeature, simpleBoxGeoJSON, simpleBoxGeoJSONWrongOrder, simpleFlightRouteLineStringGeoJSON, simpleFlightRoutePointsGeoJSON, simpleGeometryCollectionGeoJSON, simpleLineStringGeoJSON, simpleMultiPolygon, simplePointsGeojson, simplePolygonGeoJSON, simpleSmallLineStringGeoJSON, startToolExampleConfig, strokeWidthOptions, styleNameToStyleLike, temperatureLegendColorsCWK, temperatureLegendColorsWoW, textLabelStyle, textStyle, textStyleWithMargin, updateEditModeButtonsWithFir, useAnimationForLayer, useEDRGetCollectionDetails, useEDRGetParameterData, useEDRWMLayer, useGeoJSON, useGetWMLayerInstance, useGetWMSLayerStyleList, useIconStyle, useMapDrawTool, useProjection, useQueryGetWMSGetCapabilities, useQueryGetWMSLayer, useQueryGetWMSLayers, useQueryGetWMSLayersTree, useQueryGetWMSServiceInfo, useQueryWMTSGetCapabilities, useSetIntervalWhenVisible, useViewFromLayer, viewUtils, webmapEDRQueryOptions, webmapReactTranslations };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/webmap-react",
3
- "version": "14.0.0",
3
+ "version": "14.1.0",
4
4
  "description": "GeoWeb react wrapper for webmap",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -8,9 +8,9 @@
8
8
  "url": "git@gitlab.com:opengeoweb/opengeoweb.git"
9
9
  },
10
10
  "dependencies": {
11
- "@opengeoweb/webmap": "14.0.0",
12
- "@opengeoweb/theme": "14.0.0",
13
- "@opengeoweb/shared": "14.0.0",
11
+ "@opengeoweb/webmap": "14.1.0",
12
+ "@opengeoweb/theme": "14.1.0",
13
+ "@opengeoweb/shared": "14.1.0",
14
14
  "lodash": "^4.17.21",
15
15
  "ol": "^10.4.0",
16
16
  "proj4": "^2.9.2",
@@ -1,3 +1,4 @@
1
+ import { Feature, Polygon, MultiPolygon } from 'geojson';
1
2
  import { DRAWMODE } from '../OpenLayers/draw/types';
2
3
  export type DrawModeValue = DRAWMODE | 'DELETE' | '';
3
4
  type DefaultSelectionTypes = 'poly' | 'point' | 'box' | 'linestring';
@@ -10,4 +11,6 @@ export interface DrawMode {
10
11
  isSelectable: boolean;
11
12
  selectionType: SelectionType;
12
13
  }
14
+ export type ProjectFn = (feat: Feature<Polygon | MultiPolygon>) => Feature<Polygon | MultiPolygon>;
15
+ export type UnprojectFn = (feat: Feature<Polygon | MultiPolygon>) => Feature<Polygon | MultiPolygon>;
13
16
  export {};
@@ -40,6 +40,7 @@ export interface MapDrawToolOptions {
40
40
  geoJSONLayerId?: string;
41
41
  geoJSONIntersectionLayerId?: string;
42
42
  geoJSONIntersectionBoundsLayerId?: string;
43
+ projection?: string | undefined;
43
44
  }
44
45
  export declare const getIcon: (selectionType: SelectionType) => React.ReactElement | null;
45
46
  export declare const defaultPoint: DrawMode;
@@ -49,5 +50,5 @@ export declare const defaultLineString: DrawMode;
49
50
  export declare const defaultDelete: DrawMode;
50
51
  export declare const defaultModes: DrawMode[];
51
52
  export declare const currentlySupportedDrawModes: DrawMode[];
52
- export declare const useMapDrawTool: ({ defaultDrawModes, shouldAllowMultipleShapes, defaultGeoJSON, defaultGeoJSONIntersection, defaultGeoJSONIntersectionBounds, defaultGeoJSONIntersectionProperties, geoJSONLayerId, geoJSONIntersectionLayerId, geoJSONIntersectionBoundsLayerId, }: MapDrawToolOptions) => MapDrawToolProps;
53
+ export declare const useMapDrawTool: ({ defaultDrawModes, shouldAllowMultipleShapes, defaultGeoJSON, defaultGeoJSONIntersection, defaultGeoJSONIntersectionBounds, defaultGeoJSONIntersectionProperties, geoJSONLayerId, geoJSONIntersectionLayerId, geoJSONIntersectionBoundsLayerId, projection, }: MapDrawToolOptions) => MapDrawToolProps;
53
54
  export {};
@@ -1,6 +1,6 @@
1
- import { FeatureCollection, GeoJsonProperties, Point } from 'geojson';
2
- import { Bbox } from '@opengeoweb/webmap';
3
- import { DrawMode, SelectionType } from './types';
1
+ import type { FeatureCollection, GeoJsonProperties, Point, Geometry } from 'geojson';
2
+ import type { Bbox } from '@opengeoweb/webmap';
3
+ import type { DrawMode, SelectionType } from './types';
4
4
  /**
5
5
  * Adds properties to the first geojson feature based on the given property object.
6
6
  * It only extends or changes the properties which are defined in styleConfig,
@@ -48,20 +48,16 @@ export declare const intersectPointGeoJSONS: (intersectA: GeoJSON.FeatureCollect
48
48
  * @param intersectB Feature B
49
49
  * @returns The intersection of the two features.
50
50
  */
51
- export declare const intersectPolygonGeoJSONS: (intersectA: GeoJSON.FeatureCollection, intersectB: GeoJSON.FeatureCollection, geoJSONProperties?: {
52
- stroke: string;
53
- 'stroke-width': number;
54
- 'stroke-opacity': number;
55
- fill: string;
56
- 'fill-opacity': number;
57
- }) => GeoJSON.FeatureCollection;
51
+ export declare function intersectPolygonGeoJSONS(intersectA: FeatureCollection<Geometry, GeoJsonProperties>, // drawn polygon (WGS84)
52
+ intersectB: FeatureCollection<Geometry, GeoJsonProperties>, // FIR polygon (WGS84)
53
+ geoJSONProperties?: GeoJsonProperties, projectionCode?: string): FeatureCollection<Geometry, GeoJsonProperties>;
58
54
  export declare const isPointFeatureCollection: (geojson: GeoJSON.FeatureCollection) => geojson is GeoJSON.FeatureCollection<Point>;
59
55
  /**
60
56
  * Adds the intersectionStart and intersectionEnd properties to the GeoJSONS structure
61
57
  * @param geoJSONs
62
58
  * @returns GeoJSONS extend with intersections
63
59
  */
64
- export declare const createInterSections: (geojson: GeoJSON.FeatureCollection, otherGeoJSON: GeoJSON.FeatureCollection, geoJSONproperties?: GeoJSON.GeoJsonProperties) => GeoJSON.FeatureCollection;
60
+ export declare const createInterSections: (geojson: GeoJSON.FeatureCollection, otherGeoJSON: GeoJSON.FeatureCollection, geoJSONproperties?: GeoJSON.GeoJsonProperties, proj?: string) => GeoJSON.FeatureCollection;
65
61
  export declare const getGeoJson: (geojson: GeoJSON.FeatureCollection, shouldAllowMultipleShapes: boolean) => GeoJSON.FeatureCollection;
66
62
  export declare const getLastEmptyFeatureIndex: (geoJSONFeatureCollection: GeoJSON.FeatureCollection) => number | undefined;
67
63
  export declare const getFeatureCollection: (geoJSONFeature: GeoJSON.Feature | GeoJSON.FeatureCollection, shouldAllowMultipleShapes: boolean, geoJSONFeatureCollection?: GeoJSON.FeatureCollection) => GeoJSON.FeatureCollection;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import { Dimension } from '@opengeoweb/webmap';
3
- import { OpenLayersFeatureLayerProps } from './OpenLayersFeatureLayer';
4
- import { OnInitializeLayerProps } from '../utils/types';
2
+ import type { Dimension } from '@opengeoweb/webmap';
3
+ import type { OpenLayersFeatureLayerProps } from './OpenLayersFeatureLayer';
4
+ import type { OnInitializeLayerProps } from '../utils/types';
5
5
  interface TimeAwareEDRLocationLayerProps extends OpenLayersFeatureLayerProps {
6
6
  layerId?: string;
7
7
  edrBaseUrl: string;
@@ -43,6 +43,7 @@ export declare class TimeawareImageSource extends ImageSource {
43
43
  private _loadImagery;
44
44
  private prefetch;
45
45
  triggerPrefetch(): void;
46
+ cancelPrefetch(): void;
46
47
  getImage(extent: Extent, resolution: number, pixelRatio: number, projection: Projection): ImageWrapper;
47
48
  setDimProps(params: Record<string, string>): void;
48
49
  /**
@@ -1,4 +1,7 @@
1
- import { CoverageCollection, EDRInstance } from '@opengeoweb/shared';
1
+ import { Coverage, CoverageCollection, EDRInstance, PointDomain, PointSeriesDomain } from '@opengeoweb/shared';
2
+ export declare const handleResponse: (response: Response) => Promise<any>;
2
3
  export declare const joinUrlParams: (params: string[]) => string;
3
- export declare const fetchEDRLayerCollection: (edrBaseUrlWithCollection: string, instanceId?: string) => Promise<EDRInstance>;
4
- export declare const fetchEDRLayerCollectionCube: (edrBaseUrlWithCollection: string, parameterName: string, datetime?: string, instanceId?: string, bbox?: string) => Promise<CoverageCollection>;
4
+ export declare const fetchEDRCollectionDetails: (edrBaseUrlWithCollection: string, instanceId?: string) => Promise<EDRInstance>;
5
+ export declare const fetchEDRCube: (edrBaseUrlWithCollection: string, parameterName: string, datetime?: string, instanceId?: string, bbox?: string) => Promise<CoverageCollection<PointDomain | PointSeriesDomain> | Coverage<PointDomain | PointSeriesDomain>>;
6
+ export declare const fetchEDRArea: (edrBaseUrlWithCollection: string, parameterName: string, datetime?: string, instanceId?: string, coords?: string) => Promise<CoverageCollection<PointDomain | PointSeriesDomain> | Coverage<PointDomain | PointSeriesDomain>>;
7
+ export declare const fetchEDRParameter: (collection: EDRInstance | undefined, edrBaseUrlWithCollection: string, parameterName: string, datetime?: string, instanceId?: string) => Promise<CoverageCollection<PointDomain | PointSeriesDomain> | Coverage<PointDomain | PointSeriesDomain> | undefined>;
@@ -1,9 +1,14 @@
1
- import { EDRInstance, CoverageCollection, EdrParameters } from '@opengeoweb/shared';
2
1
  import { UseQueryResult } from '@tanstack/react-query';
3
- export interface EdrLayerInstance extends EDRInstance {
4
- parameter_names?: EdrParameters;
5
- title?: string;
6
- description?: string;
7
- }
8
- export declare const useEDRLayerCollection: (edrBaseUrlWithCollection: string, instanceId?: string, enabled?: boolean) => UseQueryResult<EdrLayerInstance, Error>;
9
- export declare const useEDRLayerCollectionCube: (edrBaseUrlWithCollection: string, parameterName: string, datetime?: string, instanceId?: string, bbox?: string) => UseQueryResult<CoverageCollection, Error>;
2
+ import { EDRInstance } from '@opengeoweb/shared';
3
+ export declare const webmapEDRQueryOptions: {
4
+ readonly getCollectionDetailsQuery: (edrBaseUrlWithCollection: string, enabled: boolean, instanceId?: string) => import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<EDRInstance, Error, EDRInstance, string[]>, "queryFn"> & {
5
+ queryFn?: import("@tanstack/react-query").QueryFunction<EDRInstance, string[], never> | undefined;
6
+ } & {
7
+ queryKey: string[] & {
8
+ [dataTagSymbol]: EDRInstance;
9
+ [dataTagErrorSymbol]: Error;
10
+ };
11
+ };
12
+ };
13
+ export declare const useEDRGetCollectionDetails: (edrBaseUrlWithCollection: string, instanceId?: string, enabled?: boolean) => UseQueryResult<EDRInstance>;
14
+ export declare const useEDRGetParameterData: (edrBaseUrlWithCollection: string, parameterName: string, datetime?: string, instanceId?: string) => UseQueryResult<GeoJSON.FeatureCollection | undefined>;
@@ -1,4 +1,4 @@
1
1
  export * from './hooks';
2
2
  export * from './colormaps';
3
- export { useGetEDRLayerInstance } from './utils/useGetEDRLayerInstance';
3
+ export { useEDRWMLayer } from './utils/useEDRWMLayer';
4
4
  export { fakeEdrLayerApiHandlers } from './fakeApi';
@@ -0,0 +1,2 @@
1
+ import type { Coverage, CoverageCollection, PointDomain, PointSeriesDomain } from '@opengeoweb/shared';
2
+ export declare const coverageCollectionToFeatureCollection: (cov: CoverageCollection<PointDomain | PointSeriesDomain> | Coverage<PointDomain | PointSeriesDomain> | undefined, parameterNames: string) => GeoJSON.FeatureCollection;
@@ -0,0 +1,11 @@
1
+ import { WMLayer } from '@opengeoweb/webmap';
2
+ import type { OnInitializeLayerProps } from '../../components/OpenLayers/utils/types';
3
+ /**
4
+ * Returns WMLayer instance in EDR mode. The layer will contains parsed dimensions and styles and keeps a state for these properties.
5
+ *
6
+ * @param {string} serviceUrl
7
+ * @param {string} name
8
+ * @returns {(WMLayer | null)}
9
+ */
10
+ export declare const useCreateEDRWMLayer: (serviceUrl: string, name: string, id?: string, onLayerError?: (layerId: string, message: string) => void) => WMLayer | null;
11
+ export declare const useEDRWMLayer: (edrBaseUrl: string, parameter: string, layerId?: string, onInitializeLayer?: (payload: OnInitializeLayerProps) => void) => WMLayer | null;
@@ -1,2 +0,0 @@
1
- import { CoverageCollection } from '@opengeoweb/shared';
2
- export declare const coverageCollectionToFeatureCollection: (cov: CoverageCollection | undefined, parameterNames: string) => GeoJSON.FeatureCollection;
@@ -1,17 +0,0 @@
1
- import * as React from 'react';
2
- declare const _default: {
3
- title: string;
4
- };
5
- export default _default;
6
- export declare const EdrLayerAPICollection: {
7
- (): React.ReactElement;
8
- storyName: string;
9
- };
10
- export declare const EdrLayerAPICubeOnObs: {
11
- (): React.ReactElement;
12
- storyName: string;
13
- };
14
- export declare const EdrLayerAPIGetParameters: {
15
- (): React.ReactElement;
16
- storyName: string;
17
- };
@@ -1,11 +0,0 @@
1
- import { WMLayer } from '@opengeoweb/webmap';
2
- import { OnInitializeLayerProps } from '../../components/OpenLayers/utils/types';
3
- /**
4
- * Returns WMLayer instance in EDR mode. The layer will contains parsed dimensions and styles and keeps a state for these properties.
5
- *
6
- * @param {string} serviceUrl
7
- * @param {string} name
8
- * @returns {(WMLayer | null)}
9
- */
10
- export declare const useGetEDRWMLayerInstance: (serviceUrl: string, name: string, id?: string, onLayerError?: (layerId: string, message: string) => void) => WMLayer | null;
11
- export declare const useGetEDRLayerInstance: (edrBaseUrl: string, parameter: string, layerId?: string, onInitializeLayer?: (payload: OnInitializeLayerProps) => void) => WMLayer | null;