@opengeoweb/webmap-react 14.0.1 → 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 +385 -164
- package/package.json +4 -4
- package/src/lib/components/MapDrawTool/types.d.ts +3 -0
- package/src/lib/components/MapDrawTool/useMapDrawTool.d.ts +2 -1
- package/src/lib/components/MapDrawTool/utils.d.ts +7 -11
- package/src/lib/components/OpenLayers/layers/TimeAwareEDRLocationLayer.d.ts +3 -3
- package/src/lib/components/OpenLayers/utils/TimeawareImageSource.d.ts +1 -0
- package/src/lib/edr-layer-api/api.d.ts +6 -3
- package/src/lib/edr-layer-api/hooks.d.ts +13 -8
- package/src/lib/edr-layer-api/index.d.ts +1 -1
- package/src/lib/edr-layer-api/utils/coverageCollectionToFeatureCollection.d.ts +2 -0
- package/src/lib/edr-layer-api/utils/useEDRWMLayer.d.ts +11 -0
- package/src/lib/edr-layer-api/utils/useEDRWMLayer.spec.d.ts +1 -0
- package/src/lib/components/OpenLayers/utils/coverageCollectionToFeatureCollection.d.ts +0 -2
- package/src/lib/components/TanStackDemo/EDRLayerApi.stories.d.ts +0 -17
- package/src/lib/edr-layer-api/utils/useGetEDRLayerInstance.d.ts +0 -11
- /package/src/lib/components/{OpenLayers/utils/coverageCollectionToFeatureCollection.spec.d.ts → MapDrawTool/utils.spec.d.ts} +0 -0
- /package/src/lib/edr-layer-api/utils/{useGetEDRLayerInstance.spec.d.ts → coverageCollectionToFeatureCollection.spec.d.ts} +0 -0
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
|
|
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) {
|
|
@@ -1555,12 +1560,40 @@ var LegendLayout = function LegendLayout(_ref) {
|
|
|
1555
1560
|
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
1556
1561
|
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
1557
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
|
+
};
|
|
1558
1591
|
var joinUrlParams = function joinUrlParams(params) {
|
|
1559
1592
|
return params.filter(function (x) {
|
|
1560
1593
|
return x !== undefined && x.length > 0;
|
|
1561
1594
|
}).join('/');
|
|
1562
1595
|
};
|
|
1563
|
-
var
|
|
1596
|
+
var fetchEDRCollectionDetails = /*#__PURE__*/function () {
|
|
1564
1597
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(edrBaseUrlWithCollection) {
|
|
1565
1598
|
var instanceId,
|
|
1566
1599
|
_args = arguments;
|
|
@@ -1568,31 +1601,24 @@ var fetchEDRLayerCollection = /*#__PURE__*/function () {
|
|
|
1568
1601
|
while (1) switch (_context.prev = _context.next) {
|
|
1569
1602
|
case 0:
|
|
1570
1603
|
instanceId = _args.length > 1 && _args[1] !== undefined ? _args[1] : '';
|
|
1571
|
-
_context.
|
|
1572
|
-
|
|
1573
|
-
case 3:
|
|
1574
|
-
_context.next = 5;
|
|
1575
|
-
return _context.sent.json();
|
|
1576
|
-
case 5:
|
|
1577
|
-
return _context.abrupt("return", _context.sent);
|
|
1578
|
-
case 6:
|
|
1604
|
+
return _context.abrupt("return", fetch(joinUrlParams([edrBaseUrlWithCollection, instanceId])).then(handleResponse));
|
|
1605
|
+
case 2:
|
|
1579
1606
|
case "end":
|
|
1580
1607
|
return _context.stop();
|
|
1581
1608
|
}
|
|
1582
1609
|
}, _callee);
|
|
1583
1610
|
}));
|
|
1584
|
-
return function
|
|
1611
|
+
return function fetchEDRCollectionDetails(_x) {
|
|
1585
1612
|
return _ref.apply(this, arguments);
|
|
1586
1613
|
};
|
|
1587
1614
|
}();
|
|
1588
|
-
var
|
|
1615
|
+
var fetchEDRCube = /*#__PURE__*/function () {
|
|
1589
1616
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(edrBaseUrlWithCollection, parameterName) {
|
|
1590
1617
|
var datetime,
|
|
1591
1618
|
instanceId,
|
|
1592
1619
|
bbox,
|
|
1593
1620
|
queryParams,
|
|
1594
1621
|
url,
|
|
1595
|
-
response,
|
|
1596
1622
|
_args2 = arguments;
|
|
1597
1623
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1598
1624
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -1605,68 +1631,229 @@ var fetchEDRLayerCollectionCube = /*#__PURE__*/function () {
|
|
|
1605
1631
|
queryParams.append('parameter-name', parameterName);
|
|
1606
1632
|
datetime && queryParams.append('datetime', datetime);
|
|
1607
1633
|
url = "".concat(joinUrlParams([edrBaseUrlWithCollection, instanceId, 'cube']), "?").concat(queryParams.toString());
|
|
1608
|
-
_context2.
|
|
1609
|
-
|
|
1610
|
-
case 10:
|
|
1611
|
-
response = _context2.sent;
|
|
1612
|
-
_context2.next = 13;
|
|
1613
|
-
return response.json();
|
|
1614
|
-
case 13:
|
|
1615
|
-
return _context2.abrupt("return", _context2.sent);
|
|
1616
|
-
case 14:
|
|
1634
|
+
return _context2.abrupt("return", fetch(url).then(handleResponse));
|
|
1635
|
+
case 9:
|
|
1617
1636
|
case "end":
|
|
1618
1637
|
return _context2.stop();
|
|
1619
1638
|
}
|
|
1620
1639
|
}, _callee2);
|
|
1621
1640
|
}));
|
|
1622
|
-
return function
|
|
1641
|
+
return function fetchEDRCube(_x2, _x3) {
|
|
1623
1642
|
return _ref2.apply(this, arguments);
|
|
1624
1643
|
};
|
|
1625
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
|
+
};
|
|
1626
1799
|
|
|
1627
1800
|
var DEFAULT_STALE_TIME = 60000; // One minute
|
|
1628
|
-
|
|
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) {
|
|
1629
1833
|
var instanceId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
1630
1834
|
var enabled = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
1631
|
-
return useQuery(
|
|
1632
|
-
staleTime: DEFAULT_STALE_TIME,
|
|
1633
|
-
queryKey: [edrBaseUrlWithCollection, instanceId, 'useEDRLayerCollection'],
|
|
1634
|
-
queryFn: function () {
|
|
1635
|
-
var _queryFn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
1636
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1637
|
-
while (1) switch (_context.prev = _context.next) {
|
|
1638
|
-
case 0:
|
|
1639
|
-
return _context.abrupt("return", fetchEDRLayerCollection(edrBaseUrlWithCollection, instanceId));
|
|
1640
|
-
case 1:
|
|
1641
|
-
case "end":
|
|
1642
|
-
return _context.stop();
|
|
1643
|
-
}
|
|
1644
|
-
}, _callee);
|
|
1645
|
-
}));
|
|
1646
|
-
function queryFn() {
|
|
1647
|
-
return _queryFn.apply(this, arguments);
|
|
1648
|
-
}
|
|
1649
|
-
return queryFn;
|
|
1650
|
-
}(),
|
|
1651
|
-
enabled: edrBaseUrlWithCollection.length > 0 && enabled
|
|
1652
|
-
});
|
|
1835
|
+
return useQuery(webmapEDRQueryOptions.getCollectionDetailsQuery(edrBaseUrlWithCollection, enabled, instanceId));
|
|
1653
1836
|
};
|
|
1654
|
-
var
|
|
1837
|
+
var useEDRGetParameterData = function useEDRGetParameterData(edrBaseUrlWithCollection, parameterName) {
|
|
1655
1838
|
var datetime = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
1656
1839
|
var instanceId = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
|
|
1657
|
-
var
|
|
1658
|
-
|
|
1659
|
-
var queryKey = [].concat(params, [bbox, parameterName, datetime]);
|
|
1840
|
+
var _useEDRGetCollectionD = useEDRGetCollectionDetails(edrBaseUrlWithCollection, instanceId),
|
|
1841
|
+
collection = _useEDRGetCollectionD.data;
|
|
1660
1842
|
return useQuery({
|
|
1661
1843
|
staleTime: DEFAULT_STALE_TIME,
|
|
1662
|
-
queryKey:
|
|
1844
|
+
queryKey: generateWebmapQueryKeys(['get-parameter-data', edrBaseUrlWithCollection, instanceId, parameterName, datetime]),
|
|
1663
1845
|
queryFn: function () {
|
|
1664
1846
|
var _queryFn2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
1847
|
+
var data;
|
|
1665
1848
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1666
1849
|
while (1) switch (_context2.prev = _context2.next) {
|
|
1667
1850
|
case 0:
|
|
1668
|
-
|
|
1669
|
-
|
|
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:
|
|
1670
1857
|
case "end":
|
|
1671
1858
|
return _context2.stop();
|
|
1672
1859
|
}
|
|
@@ -1677,7 +1864,7 @@ var useEDRLayerCollectionCube = function useEDRLayerCollectionCube(edrBaseUrlWit
|
|
|
1677
1864
|
}
|
|
1678
1865
|
return queryFn;
|
|
1679
1866
|
}(),
|
|
1680
|
-
enabled: parameterName.length > 0
|
|
1867
|
+
enabled: collection !== undefined && parameterName.length > 0 && datetime.length > 0
|
|
1681
1868
|
});
|
|
1682
1869
|
};
|
|
1683
1870
|
|
|
@@ -1971,7 +2158,7 @@ var makeFeatureStyleMultiParam = function makeFeatureStyleMultiParam(feature) {
|
|
|
1971
2158
|
var paramValues = Object.values(values);
|
|
1972
2159
|
// Determine offset between columns (long strings need more space)
|
|
1973
2160
|
var maxLength = Math.max.apply(Math, _toConsumableArray(paramValues.map(function (el) {
|
|
1974
|
-
return el
|
|
2161
|
+
return el ? el.toString().length : 1;
|
|
1975
2162
|
})));
|
|
1976
2163
|
var factor = maxLength > 5 ? 1.4 : 1;
|
|
1977
2164
|
var offsetValues = getOffsetValues(factor);
|
|
@@ -2125,12 +2312,12 @@ var defaultEdrStyles = [{
|
|
|
2125
2312
|
* @param {string} name
|
|
2126
2313
|
* @returns {(WMLayer | null)}
|
|
2127
2314
|
*/
|
|
2128
|
-
var
|
|
2315
|
+
var useCreateEDRWMLayer = function useCreateEDRWMLayer(serviceUrl, name, id, onLayerError) {
|
|
2129
2316
|
var _React$useState = React__default.useState(null),
|
|
2130
2317
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
2131
2318
|
layer = _React$useState2[0],
|
|
2132
2319
|
setLayer = _React$useState2[1];
|
|
2133
|
-
var refId = useRef(id
|
|
2320
|
+
var refId = useRef(id !== null && id !== void 0 ? id : webmapUtils.generateLayerId());
|
|
2134
2321
|
React__default.useEffect(function () {
|
|
2135
2322
|
var layerId = refId.current;
|
|
2136
2323
|
// Check if the layer is already registered
|
|
@@ -2155,23 +2342,23 @@ var useGetEDRWMLayerInstance = function useGetEDRWMLayerInstance(serviceUrl, nam
|
|
|
2155
2342
|
}, [name, onLayerError, serviceUrl]);
|
|
2156
2343
|
return layer;
|
|
2157
2344
|
};
|
|
2158
|
-
var
|
|
2159
|
-
var wmLayer =
|
|
2160
|
-
var collectionInfo =
|
|
2345
|
+
var useEDRWMLayer = function useEDRWMLayer(edrBaseUrl, parameter, layerId, onInitializeLayer) {
|
|
2346
|
+
var wmLayer = useCreateEDRWMLayer(edrBaseUrl, parameter, layerId);
|
|
2347
|
+
var collectionInfo = useEDRGetCollectionDetails(edrBaseUrl);
|
|
2161
2348
|
var _React$useState3 = React__default.useState(undefined),
|
|
2162
2349
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
2163
2350
|
timeRangeDuration = _React$useState4[0],
|
|
2164
2351
|
setTimeRangeDuration = _React$useState4[1];
|
|
2165
2352
|
React__default.useEffect(function () {
|
|
2166
2353
|
if (wmLayer && collectionInfo.data && collectionInfo.isFetched) {
|
|
2167
|
-
var _collectionInfo$data, _collectionInfo$data2;
|
|
2168
|
-
// TODO: Extract
|
|
2169
|
-
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");
|
|
2170
2357
|
if (!wmLayer.getDimension('time')) {
|
|
2171
|
-
var _collectionInfo$
|
|
2358
|
+
var _collectionInfo$data5;
|
|
2172
2359
|
var dim = new WMJSDimension({
|
|
2173
2360
|
name: 'time',
|
|
2174
|
-
currentValue: (_collectionInfo$
|
|
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],
|
|
2175
2362
|
units: 'ISO8601',
|
|
2176
2363
|
values: timeRangeDurationFromEdrCollection
|
|
2177
2364
|
});
|
|
@@ -2184,7 +2371,7 @@ var useGetEDRLayerInstance = function useGetEDRLayerInstance(edrBaseUrl, paramet
|
|
|
2184
2371
|
setTimeRangeDuration(timeRangeDurationFromEdrCollection);
|
|
2185
2372
|
wmLayer.isConfigured = true;
|
|
2186
2373
|
}
|
|
2187
|
-
}, [collectionInfo.data, collectionInfo.isFetched, wmLayer]);
|
|
2374
|
+
}, [collectionInfo.data, collectionInfo.isFetched, wmLayer, edrBaseUrl]);
|
|
2188
2375
|
React__default.useEffect(function () {
|
|
2189
2376
|
var initializeLayer = /*#__PURE__*/function () {
|
|
2190
2377
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
@@ -2215,7 +2402,7 @@ var useGetEDRLayerInstance = function useGetEDRLayerInstance(edrBaseUrl, paramet
|
|
|
2215
2402
|
}),
|
|
2216
2403
|
style: ''
|
|
2217
2404
|
};
|
|
2218
|
-
onInitializeLayer
|
|
2405
|
+
onInitializeLayer === null || onInitializeLayer === void 0 || onInitializeLayer(layerProps);
|
|
2219
2406
|
}
|
|
2220
2407
|
case 1:
|
|
2221
2408
|
case "end":
|
|
@@ -11418,7 +11605,8 @@ var addFeatureProperties = function addFeatureProperties(geojson, featurePropert
|
|
|
11418
11605
|
return null;
|
|
11419
11606
|
}
|
|
11420
11607
|
return produce(geojson, function (draft) {
|
|
11421
|
-
|
|
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) {
|
|
11422
11610
|
Object.keys(featureProperties).forEach(function (key) {
|
|
11423
11611
|
draft.features[featureIndex].properties[key] = featureProperties[key];
|
|
11424
11612
|
});
|
|
@@ -11441,16 +11629,19 @@ var getGeoJSONPropertyValue = function getGeoJSONPropertyValue(property, propert
|
|
|
11441
11629
|
var defaultProperties = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : defaultGeoJSONStyleProperties;
|
|
11442
11630
|
// if a shape is set, extract the style from there
|
|
11443
11631
|
if (properties[property] !== undefined) {
|
|
11632
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
11444
11633
|
return properties[property];
|
|
11445
11634
|
}
|
|
11446
11635
|
// if active polygon tool is preset, retreive style from there
|
|
11447
11636
|
if (polygonDrawMode) {
|
|
11448
11637
|
var polygonDrawModeProperty = polygonDrawMode.shape.type === 'Feature' && polygonDrawMode.shape.properties[property];
|
|
11449
11638
|
if (polygonDrawModeProperty !== undefined) {
|
|
11639
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
11450
11640
|
return polygonDrawModeProperty;
|
|
11451
11641
|
}
|
|
11452
11642
|
}
|
|
11453
11643
|
// otherwise get values from defaultStyle
|
|
11644
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
11454
11645
|
return defaultProperties[property];
|
|
11455
11646
|
};
|
|
11456
11647
|
/**
|
|
@@ -11481,7 +11672,8 @@ var moveFeature = function moveFeature(currentGeoJSON, newGeoJSON, featureLayerI
|
|
|
11481
11672
|
return newGeoJSON.features.length - 1;
|
|
11482
11673
|
}
|
|
11483
11674
|
if (geometry.type === 'LineString' && geometry.coordinates.length > 2 && reason === NEW_LINESTRING_CREATED) {
|
|
11484
|
-
var
|
|
11675
|
+
var _geometry$coordinates;
|
|
11676
|
+
var _lastCoordinate = (_geometry$coordinates = geometry.coordinates.pop()) !== null && _geometry$coordinates !== void 0 ? _geometry$coordinates : [0, 0];
|
|
11485
11677
|
var _copyFeature = _objectSpread2(_objectSpread2({}, feature), {}, {
|
|
11486
11678
|
geometry: _objectSpread2(_objectSpread2({}, geometry), {}, {
|
|
11487
11679
|
coordinates: [_toConsumableArray(_lastCoordinate), _toConsumableArray(_lastCoordinate)]
|
|
@@ -11520,14 +11712,14 @@ var intersectPointGeoJSONS = function intersectPointGeoJSONS(intersectA, interse
|
|
|
11520
11712
|
fill: '#0000FF',
|
|
11521
11713
|
'fill-opacity': 1.0
|
|
11522
11714
|
};
|
|
11523
|
-
var featureA =
|
|
11524
|
-
var featureB =
|
|
11715
|
+
var featureA = feature(intersectA.features[0].geometry);
|
|
11716
|
+
var featureB = feature(intersectB.features[0].geometry);
|
|
11525
11717
|
var options = {
|
|
11526
11718
|
tolerance: 0.001,
|
|
11527
11719
|
highQuality: true
|
|
11528
11720
|
};
|
|
11529
|
-
var simplifiedB =
|
|
11530
|
-
var isInside =
|
|
11721
|
+
var simplifiedB = simplify(featureB, options);
|
|
11722
|
+
var isInside = booleanPointInPolygon(intersectA.features[0].geometry, simplifiedB);
|
|
11531
11723
|
return addFeatureProperties({
|
|
11532
11724
|
type: 'FeatureCollection',
|
|
11533
11725
|
features: !isInside ? [{
|
|
@@ -11542,13 +11734,71 @@ var intersectPointGeoJSONS = function intersectPointGeoJSONS(intersectA, interse
|
|
|
11542
11734
|
}] : [featureA]
|
|
11543
11735
|
}, geoJSONProperties);
|
|
11544
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
|
+
}
|
|
11545
11793
|
/**
|
|
11546
11794
|
* Returns the intersection of two (multi) polygon features. In case of a polygon, only the first feature is used.
|
|
11547
11795
|
* @param intersectA Feature A
|
|
11548
11796
|
* @param intersectB Feature B
|
|
11549
11797
|
* @returns The intersection of the two features.
|
|
11550
11798
|
*/
|
|
11551
|
-
|
|
11799
|
+
function intersectPolygonGeoJSONS(intersectA,
|
|
11800
|
+
// drawn polygon (WGS84)
|
|
11801
|
+
intersectB) {
|
|
11552
11802
|
var geoJSONProperties = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
11553
11803
|
stroke: '#FF0000',
|
|
11554
11804
|
'stroke-width': 10.0,
|
|
@@ -11556,29 +11806,45 @@ var intersectPolygonGeoJSONS = function intersectPolygonGeoJSONS(intersectA, int
|
|
|
11556
11806
|
fill: '#0000FF',
|
|
11557
11807
|
'fill-opacity': 1.0
|
|
11558
11808
|
};
|
|
11559
|
-
var
|
|
11560
|
-
|
|
11561
|
-
var
|
|
11562
|
-
|
|
11563
|
-
|
|
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]
|
|
11564
11823
|
};
|
|
11565
|
-
var
|
|
11566
|
-
|
|
11567
|
-
|
|
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);
|
|
11568
11843
|
return addFeatureProperties({
|
|
11569
11844
|
type: 'FeatureCollection',
|
|
11570
|
-
features:
|
|
11571
|
-
type: 'Feature',
|
|
11572
|
-
properties: {
|
|
11573
|
-
selectionType: 'poly'
|
|
11574
|
-
},
|
|
11575
|
-
geometry: {
|
|
11576
|
-
type: 'Polygon',
|
|
11577
|
-
coordinates: [[]]
|
|
11578
|
-
}
|
|
11579
|
-
}] : [intersection]
|
|
11845
|
+
features: [intersectionWgs84Cleaned]
|
|
11580
11846
|
}, geoJSONProperties);
|
|
11581
|
-
}
|
|
11847
|
+
}
|
|
11582
11848
|
var isPointFeatureCollection = function isPointFeatureCollection(geojson) {
|
|
11583
11849
|
return geojson.features[0].geometry.type === 'Point';
|
|
11584
11850
|
};
|
|
@@ -11595,12 +11861,13 @@ var createInterSections = function createInterSections(geojson, otherGeoJSON) {
|
|
|
11595
11861
|
fill: '#f24a00',
|
|
11596
11862
|
'fill-opacity': 0.5
|
|
11597
11863
|
};
|
|
11864
|
+
var proj = arguments.length > 3 ? arguments[3] : undefined;
|
|
11598
11865
|
var intersections = produce(geojson, function () {
|
|
11599
11866
|
try {
|
|
11600
11867
|
if (isPointFeatureCollection(geojson)) {
|
|
11601
11868
|
return addFeatureProperties(intersectPointGeoJSONS(geojson, otherGeoJSON), geoJSONproperties);
|
|
11602
11869
|
}
|
|
11603
|
-
return addFeatureProperties(intersectPolygonGeoJSONS(geojson, otherGeoJSON), geoJSONproperties);
|
|
11870
|
+
return addFeatureProperties(intersectPolygonGeoJSONS(geojson, otherGeoJSON, defaultGeoJSONStyleProperties, proj), geoJSONproperties);
|
|
11604
11871
|
} catch (_error) {
|
|
11605
11872
|
return addFeatureProperties(geojson, geoJSONproperties);
|
|
11606
11873
|
}
|
|
@@ -11706,7 +11973,7 @@ var addSelectionTypeToGeoJSON = function addSelectionTypeToGeoJSON(geoJSON, sele
|
|
|
11706
11973
|
});
|
|
11707
11974
|
};
|
|
11708
11975
|
var getFeatureExtent = function getFeatureExtent(geoJSON) {
|
|
11709
|
-
var turfBbox =
|
|
11976
|
+
var turfBbox = bbox(geoJSON);
|
|
11710
11977
|
return {
|
|
11711
11978
|
left: turfBbox[0],
|
|
11712
11979
|
bottom: turfBbox[1],
|
|
@@ -11836,7 +12103,8 @@ var useMapDrawTool = function useMapDrawTool(_ref) {
|
|
|
11836
12103
|
_ref$geoJSONIntersect = _ref.geoJSONIntersectionLayerId,
|
|
11837
12104
|
geoJSONIntersectionLayerId = _ref$geoJSONIntersect === void 0 ? 'intersection-layer' : _ref$geoJSONIntersect,
|
|
11838
12105
|
_ref$geoJSONIntersect2 = _ref.geoJSONIntersectionBoundsLayerId,
|
|
11839
|
-
geoJSONIntersectionBoundsLayerId = _ref$geoJSONIntersect2 === void 0 ? 'static-layer' : _ref$geoJSONIntersect2
|
|
12106
|
+
geoJSONIntersectionBoundsLayerId = _ref$geoJSONIntersect2 === void 0 ? 'static-layer' : _ref$geoJSONIntersect2,
|
|
12107
|
+
projection = _ref.projection;
|
|
11840
12108
|
// geoJSON feature collections
|
|
11841
12109
|
var _React$useState = React__default.useState(defaultGeoJSON),
|
|
11842
12110
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -11924,7 +12192,7 @@ var useMapDrawTool = function useMapDrawTool(_ref) {
|
|
|
11924
12192
|
}
|
|
11925
12193
|
setGeoJSON(newGeoJSON);
|
|
11926
12194
|
if (geoJSONIntersectionBounds) {
|
|
11927
|
-
var newIntersection = createInterSections(newGeoJSON, geoJSONIntersectionBounds, defaultGeoJSONIntersectionProperties);
|
|
12195
|
+
var newIntersection = createInterSections(newGeoJSON, geoJSONIntersectionBounds, defaultGeoJSONIntersectionProperties, projection);
|
|
11928
12196
|
setGeoJSONIntersection(newIntersection);
|
|
11929
12197
|
return [newGeoJSON, newIntersection];
|
|
11930
12198
|
}
|
|
@@ -14054,6 +14322,8 @@ var TimeawareImageSourceWMSLayer = function TimeawareImageSourceWMSLayer(_ref) {
|
|
|
14054
14322
|
// Assign olSource in wmlayer for metronome
|
|
14055
14323
|
wmLayer.olSource = olLayer === null || olLayer === void 0 ? void 0 : olLayer.getSource();
|
|
14056
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();
|
|
14057
14327
|
wmLayer.olSource = null;
|
|
14058
14328
|
map.removeLayer(olLayer);
|
|
14059
14329
|
olLayer.dispose();
|
|
@@ -15469,50 +15739,8 @@ var OpenLayersFeatureLayer = function OpenLayersFeatureLayer(_ref) {
|
|
|
15469
15739
|
});
|
|
15470
15740
|
};
|
|
15471
15741
|
|
|
15472
|
-
/* *
|
|
15473
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
15474
|
-
* you may not use this file except in compliance with the License.
|
|
15475
|
-
* You may obtain a copy of the License at
|
|
15476
|
-
*
|
|
15477
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
15478
|
-
*
|
|
15479
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
15480
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15481
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15482
|
-
* See the License for the specific language governing permissions and
|
|
15483
|
-
* limitations under the License.
|
|
15484
|
-
*
|
|
15485
|
-
* Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
15486
|
-
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
15487
|
-
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
15488
|
-
* */
|
|
15489
|
-
var coverageCollectionToFeatureCollection = function coverageCollectionToFeatureCollection(cov, parameterNames) {
|
|
15490
|
-
var _cov$coverages;
|
|
15491
|
-
var latLonValues = (cov === null || cov === void 0 || (_cov$coverages = cov.coverages) === null || _cov$coverages === void 0 ? void 0 : _cov$coverages.map(function (coverage) {
|
|
15492
|
-
var paramValues = parameterNames.split(',').reduce(function (obj, parameterName) {
|
|
15493
|
-
var _coverage$ranges$para;
|
|
15494
|
-
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]));
|
|
15495
|
-
}, {});
|
|
15496
|
-
return {
|
|
15497
|
-
type: 'Feature',
|
|
15498
|
-
properties: {
|
|
15499
|
-
values: _objectSpread2({}, paramValues)
|
|
15500
|
-
},
|
|
15501
|
-
geometry: {
|
|
15502
|
-
coordinates: [coverage.domain.axes.x.values[0], coverage.domain.axes.y.values[0]],
|
|
15503
|
-
type: 'Point'
|
|
15504
|
-
}
|
|
15505
|
-
};
|
|
15506
|
-
})) || [];
|
|
15507
|
-
var featurePoint = {
|
|
15508
|
-
type: 'FeatureCollection',
|
|
15509
|
-
features: latLonValues
|
|
15510
|
-
};
|
|
15511
|
-
return featurePoint;
|
|
15512
|
-
};
|
|
15513
|
-
|
|
15514
15742
|
var TimeAwareEDRLocationLayer = function TimeAwareEDRLocationLayer(_ref) {
|
|
15515
|
-
var _wmLayer$getDimension;
|
|
15743
|
+
var _wmLayer$getDimension, _wmLayer$getDimension2;
|
|
15516
15744
|
var edrBaseUrl = _ref.edrBaseUrl,
|
|
15517
15745
|
parameter = _ref.parameter,
|
|
15518
15746
|
style = _ref.style,
|
|
@@ -15524,30 +15752,23 @@ var TimeAwareEDRLocationLayer = function TimeAwareEDRLocationLayer(_ref) {
|
|
|
15524
15752
|
visible = _ref$visible === void 0 ? true : _ref$visible,
|
|
15525
15753
|
onInitializeLayer = _ref.onInitializeLayer;
|
|
15526
15754
|
// get a wmLayer instance
|
|
15527
|
-
var wmLayer =
|
|
15755
|
+
var wmLayer = useEDRWMLayer(edrBaseUrl, parameter, layerId, onInitializeLayer);
|
|
15528
15756
|
// dimensionsValues is a key/value dictionary with dimension names specifically for WMS GetMap requests. We re-use it here for EDR.
|
|
15529
15757
|
var dimensionsValues = getDimensionParamsForWMS(dimensions, wmLayer);
|
|
15530
|
-
var timeValue = dimensionsValues
|
|
15531
|
-
var
|
|
15532
|
-
|
|
15533
|
-
|
|
15534
|
-
|
|
15535
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
15536
|
-
featurePoints = _React$useState2[0],
|
|
15537
|
-
setFeaturePoints = _React$useState2[1];
|
|
15538
|
-
var edrQueryDateTime = (wmLayer === null || wmLayer === void 0 || (_wmLayer$getDimension = wmLayer.getDimension('time')) === null || _wmLayer$getDimension === void 0 ? void 0 : _wmLayer$getDimension.getClosestValue(timeValue)) || timeValue;
|
|
15539
|
-
var result = useEDRLayerCollectionCube(edrBaseUrl, parameter, edrQueryDateTime);
|
|
15540
|
-
React__default.useEffect(function () {
|
|
15541
|
-
var featurePoint = coverageCollectionToFeatureCollection(result.data, parameter);
|
|
15542
|
-
if (!featurePoint) {
|
|
15543
|
-
return;
|
|
15544
|
-
}
|
|
15545
|
-
setFeaturePoints(featurePoint);
|
|
15546
|
-
}, [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;
|
|
15547
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
|
+
};
|
|
15548
15769
|
return jsx(OpenLayersFeatureLayer, {
|
|
15549
|
-
featureCollection:
|
|
15550
|
-
style:
|
|
15770
|
+
featureCollection: featureCollection,
|
|
15771
|
+
style: isFetching ? loadingStyle : style,
|
|
15551
15772
|
opacity: opacity,
|
|
15552
15773
|
zIndex: zIndex,
|
|
15553
15774
|
declutter: true,
|
|
@@ -16754,4 +16975,4 @@ var getLayerUpdateInfo = function getLayerUpdateInfo(wmLayer, mapId) {
|
|
|
16754
16975
|
return updateObject;
|
|
16755
16976
|
};
|
|
16756
16977
|
|
|
16757
|
-
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,
|
|
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
|
|
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
|
|
12
|
-
"@opengeoweb/theme": "14.0
|
|
13
|
-
"@opengeoweb/shared": "14.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
|
|
52
|
-
|
|
53
|
-
|
|
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
|
|
4
|
-
export declare const
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
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>;
|
|
@@ -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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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;
|
|
File without changes
|