@opengeoweb/webmap-react 21.2.0-nightly-20261126 → 21.3.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/dist/index.esm.js CHANGED
@@ -2,7 +2,7 @@ import { WMInvalidDateValues, getCorrectWMSDimName, WMImageStore, WMImageStoreLo
2
2
  export { WEBMAP_NAMESPACE, webmapTranslations } from '@opengeoweb/webmap';
3
3
  import React, { createContext, useMemo, useRef, useState, useEffect, useCallback, useContext, useLayoutEffect, useEffectEvent } from 'react';
4
4
  import { memoize, range, without, isEqual, throttle, debounce, cloneDeep } from 'lodash';
5
- import { equals, containsExtent as containsExtent$1, buffer, boundingExtent, containsCoordinate, getCenter } from 'ol/extent';
5
+ import { equals, containsExtent as containsExtent$1, buffer, boundingExtent, containsCoordinate, getIntersection, isEmpty, wrapAndSliceX, createEmpty, extend, getCenter } from 'ol/extent';
6
6
  import ImageState from 'ol/ImageState';
7
7
  import LayerProperty from 'ol/layer/Property';
8
8
  import { fromResolutionLike } from 'ol/resolution';
@@ -882,7 +882,9 @@ var timeSpanToTimeList = function timeSpanToTimeList(timespan) {
882
882
  var makeTimeList = memoize(timeSpanToTimeList);
883
883
 
884
884
  var openLayersGetMapImageStore = new WMImageStore(NUM_IMAGES_TO_CACHE, {
885
- id: 'ol'
885
+ id: 'ol',
886
+ // Let playback consume a completed frame before it becomes stale again.
887
+ zeroMaxAgeGraceSeconds: 2
886
888
  });
887
889
  var clearImageCacheForAllMaps = function clearImageCacheForAllMaps() {
888
890
  openLayersGetMapImageStore.clear();
@@ -935,7 +937,8 @@ var TimeAwareImageWrapper = /*#__PURE__*/function (_ImageWrapper) {
935
937
  function TimeAwareImageWrapper(extent, resolution, pixelRatio) {
936
938
  var _this;
937
939
  _classCallCheck(this, TimeAwareImageWrapper);
938
- _this = _callSuper(this, TimeAwareImageWrapper, [extent, resolution, pixelRatio, ImageState.IDLE]);
940
+ // GetMap requests use pixel ratio 1, including on HiDPI displays.
941
+ _this = _callSuper(this, TimeAwareImageWrapper, [extent, resolution, 1, ImageState.IDLE]);
939
942
  _this._paramsToLoad = {};
940
943
  _this._dimPropsToLoad = {};
941
944
  _this._getMapUrl = null;
@@ -1116,13 +1119,17 @@ var TimeAwareImageWrapper = /*#__PURE__*/function (_ImageWrapper) {
1116
1119
  isLoaded: imageEl.isLoaded(),
1117
1120
  isLoadedWithoutErrors: imageEl.isLoadedWithoutErrors(),
1118
1121
  hasError: imageEl.hasError(),
1119
- isLoading: imageEl.isLoading()
1122
+ isLoading: imageEl.isLoading(),
1123
+ hasCompletedImage: imageEl._loadedAtTime !== undefined
1120
1124
  };
1121
1125
  }
1122
1126
  var completeImages = images;
1127
+ var hasCompletedImage = completeImages.every(function (image) {
1128
+ return image._loadedAtTime !== undefined && !image.hasError();
1129
+ });
1123
1130
  if (!completeImages.every(function (image) {
1124
1131
  return image.isLoaded();
1125
- })) {
1132
+ }) && !hasCompletedImage) {
1126
1133
  return false;
1127
1134
  }
1128
1135
  var image = this.createCompositeImage(completeImages, requests);
@@ -1135,7 +1142,9 @@ var TimeAwareImageWrapper = /*#__PURE__*/function (_ImageWrapper) {
1135
1142
  return request.extent;
1136
1143
  })),
1137
1144
  resolution: requests[0].resolution,
1138
- isLoaded: true,
1145
+ isLoaded: completeImages.every(function (loadedImage) {
1146
+ return loadedImage.isLoaded();
1147
+ }),
1139
1148
  isLoadedWithoutErrors: completeImages.every(function (loadedImage) {
1140
1149
  return loadedImage.isLoadedWithoutErrors();
1141
1150
  }),
@@ -1144,7 +1153,8 @@ var TimeAwareImageWrapper = /*#__PURE__*/function (_ImageWrapper) {
1144
1153
  }),
1145
1154
  isLoading: completeImages.some(function (loadedImage) {
1146
1155
  return loadedImage.isLoading();
1147
- })
1156
+ }),
1157
+ hasCompletedImage: hasCompletedImage
1148
1158
  };
1149
1159
  }
1150
1160
  }, {
@@ -1633,6 +1643,11 @@ var TimeawareImageSource = /*#__PURE__*/function (_ImageSource) {
1633
1643
  this._lastRequestedPixelRatio = pixelRatio;
1634
1644
  this._lastRequestedProjection = projection;
1635
1645
  this.throttledImageLoad();
1646
+ if (hasExactImage && !hasExactImage.isLoaded && !hasExactImage.hasError && hasExactImage.hasCompletedImage && requestedImageHasWantedExtent) {
1647
+ // Keep the decoded frame visible while its expired response is revalidated.
1648
+ this._imWrapperForAltImage.setGeoReferencedImage(hasExactImage);
1649
+ return this._imWrapperForAltImage;
1650
+ }
1636
1651
  // While we are loading, check if there is an alternative image available
1637
1652
  return this._getAltImageOrEmpty(this._lastRequestedExtent, this._lastRequestedResolution, this._lastRequestedPixelRatio, this._lastRequestedProjection, requestDimProperties);
1638
1653
  }
@@ -8622,7 +8637,7 @@ var getDrawModeIdFromSelectionType = function getDrawModeIdFromSelectionType(sel
8622
8637
  * */
8623
8638
  initializeOpenLayersProjections();
8624
8639
  var setViewFromExtent = function setViewFromExtent(view, bbox) {
8625
- if (!bbox || !Number(bbox.left) || !isFinite(bbox.left) || isNaN(bbox.left)) {
8640
+ if (!bbox || ![bbox.left, bbox.bottom, bbox.right, bbox.top].every(Number.isFinite)) {
8626
8641
  view.setCenter([0, 0]);
8627
8642
  view.setZoom(1);
8628
8643
  return;
@@ -9364,6 +9379,7 @@ var WMSLayer = function WMSLayer(_ref) {
9364
9379
  }
9365
9380
  var layer = new ImageLayer({
9366
9381
  source: new ImageSource({
9382
+ projection: projection,
9367
9383
  loader: createLoader({
9368
9384
  url: url,
9369
9385
  params: {
@@ -9625,32 +9641,50 @@ var useSetIntervalWhenVisible = function useSetIntervalWhenVisible(autoUpdate, r
9625
9641
  }, [refetch, refetchIfTimeHasPassed, refetchInterval, shouldAutoFetch]);
9626
9642
  };
9627
9643
 
9628
- /* *
9629
- * Licensed under the Apache License, Version 2.0 (the "License");
9630
- * you may not use this file except in compliance with the License.
9631
- * You may obtain a copy of the License at
9632
- *
9633
- * http://www.apache.org/licenses/LICENSE-2.0
9634
- *
9635
- * Unless required by applicable law or agreed to in writing, software
9636
- * distributed under the License is distributed on an "AS IS" BASIS,
9637
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9638
- * See the License for the specific language governing permissions and
9639
- * limitations under the License.
9640
- *
9641
- * Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
9642
- * Copyright 2025 - Finnish Meteorological Institute (FMI)
9643
- * Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
9644
- * */
9645
9644
  initializeOpenLayersProjections();
9646
9645
  var getLayerExtentForProjection = function getLayerExtentForProjection(wmLayer, projectionCode) {
9646
+ var _crs$bbox, _extent;
9647
9647
  var crs = wmLayer.getCRSByName(projectionCode);
9648
- if (crs !== null && crs !== void 0 && crs.bbox) {
9649
- return crs.bbox.getExtent();
9648
+ var projection = get(projectionCode);
9649
+ var projectionExtent = projection === null || projection === void 0 ? void 0 : projection.getExtent();
9650
+ var extent = crs === null || crs === void 0 || (_crs$bbox = crs.bbox) === null || _crs$bbox === void 0 ? void 0 : _crs$bbox.getExtent();
9651
+ if (extent && projectionExtent) {
9652
+ extent = getIntersection(extent, projectionExtent);
9653
+ }
9654
+ if ((_extent = extent) !== null && _extent !== void 0 && _extent.every(Number.isFinite) && !isEmpty(extent)) {
9655
+ return extent;
9650
9656
  }
9651
9657
  var geo = wmLayer.geographicBoundingBox;
9652
9658
  if (geo) {
9653
- return transformExtent([parseFloat(geo.west), parseFloat(geo.south), parseFloat(geo.east), parseFloat(geo.north)], WMJSMAP_LONLAT_EPSGCODE, projectionCode);
9659
+ var west = parseFloat(geo.west);
9660
+ var east = parseFloat(geo.east);
9661
+ var geographicExtent = [west, parseFloat(geo.south), east < west ? east + 360 : east, parseFloat(geo.north)];
9662
+ if (geographicExtent.every(Number.isFinite) && !isEmpty(geographicExtent)) {
9663
+ // Split wrapped longitudes so clipping does not discard either side.
9664
+ var sourceExtents = wrapAndSliceX(geographicExtent, get(WMJSMAP_LONLAT_EPSGCODE));
9665
+ var worldExtent = projection === null || projection === void 0 ? void 0 : projection.getWorldExtent();
9666
+ extent = createEmpty();
9667
+ var _iterator = _createForOfIteratorHelper(sourceExtents),
9668
+ _step;
9669
+ try {
9670
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
9671
+ var sourceExtent = _step.value;
9672
+ // Clip before transforming: poles are outside Mercator's supported area.
9673
+ var clippedSource = worldExtent ? getIntersection(sourceExtent, worldExtent) : sourceExtent;
9674
+ if (!isEmpty(clippedSource)) {
9675
+ var projectedExtent = transformExtent(clippedSource, WMJSMAP_LONLAT_EPSGCODE, projectionCode);
9676
+ extend(extent, projectionExtent ? getIntersection(projectedExtent, projectionExtent) : projectedExtent);
9677
+ }
9678
+ }
9679
+ } catch (err) {
9680
+ _iterator.e(err);
9681
+ } finally {
9682
+ _iterator.f();
9683
+ }
9684
+ if (extent.every(Number.isFinite) && !isEmpty(extent)) {
9685
+ return extent;
9686
+ }
9687
+ }
9654
9688
  }
9655
9689
  return undefined;
9656
9690
  };
@@ -18,6 +18,7 @@ interface TimeAwareGeoreferencedImage {
18
18
  hasError: boolean;
19
19
  isLoadedWithoutErrors: boolean;
20
20
  isLoading: boolean;
21
+ hasCompletedImage?: boolean;
21
22
  }
22
23
  type TimeAwareGeoreferencedImageRequest = TimeAwareGeoreferencedImageSrc;
23
24
  declare class TimeAwareImageWrapper extends ImageWrapper {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/webmap-react",
3
- "version": "21.2.0-nightly-20261126",
3
+ "version": "21.3.0",
4
4
  "description": "GeoWeb react wrapper for webmap",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -20,9 +20,9 @@
20
20
  }
21
21
  },
22
22
  "dependencies": {
23
- "@opengeoweb/webmap": "21.2.0-nightly-20261126",
24
- "@opengeoweb/theme": "21.2.0-nightly-20261126",
25
- "@opengeoweb/shared": "21.2.0-nightly-20261126",
23
+ "@opengeoweb/webmap": "21.3.0",
24
+ "@opengeoweb/theme": "21.3.0",
25
+ "@opengeoweb/shared": "21.3.0",
26
26
  "lodash": "^4.18.1",
27
27
  "ol": "^10.4.0",
28
28
  "geotiff": "^3.0.5",