@opengeoweb/webmap-react 20.1.0-nightly-20261018 → 20.2.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
@@ -1,6 +1,6 @@
1
1
  import { WMInvalidDateValues, getCorrectWMSDimName, WMImageStore, WMImageStoreLoadType, WMJSDimension, webmapUtils, WMLayer, LayerType, legendImageStore, WMImageEventType, getLegendGraphicURLForLayer, WEBMAP_NAMESPACE, WMProj4Defs, privateWebMapUtils, wmDetermineDimensionMode, WMJSMAP_LONLAT_EPSGCODE, WMDefaultStyleName, tilesettings } from '@opengeoweb/webmap';
2
2
  export { WEBMAP_NAMESPACE, webmapTranslations } from '@opengeoweb/webmap';
3
- import React, { createContext, useMemo, useRef, useState, useEffect, useCallback, useContext, useLayoutEffect } from 'react';
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
5
  import { equals, containsExtent as containsExtent$1, buffer, boundingExtent, containsCoordinate, getCenter } from 'ol/extent';
6
6
  import ImageState from 'ol/ImageState';
@@ -26,14 +26,14 @@ import 'ol/ol.css';
26
26
  import { listen, unlistenByKey } from 'ol/events';
27
27
  import { unByKey } from 'ol/Observable';
28
28
  import EventType from 'ol/pointer/EventType';
29
- import { toLonLat, fromLonLat, transformExtent, transform } from 'ol/proj';
29
+ import { toLonLat, get, equivalent, fromLonLat, transformExtent, transform } from 'ol/proj';
30
30
  import { equals as equals$1, closestOnSegment } from 'ol/coordinate';
31
31
  import { noModifierKeys, never, platformModifierKeyOnly, always } from 'ol/events/condition';
32
32
  import Modify from 'ol/interaction/Modify';
33
33
  import Style$1, { createDefaultStyle } from 'ol/style/Style';
34
34
  import GeoJSON from 'ol/format/GeoJSON';
35
35
  import Translate from 'ol/interaction/Translate';
36
- import { lineSplit, cleanCoords, featureCollection, difference, bbox, feature, simplify, booleanPointInPolygon, intersect, polygonToLine, booleanClockwise, rewind, toWgs84, toMercator, coordEach } from '@turf/turf';
36
+ import { lineSplit, cleanCoords, featureCollection, round, difference, bbox, feature, simplify, booleanPointInPolygon, intersect, polygonToLine, booleanClockwise, rewind, toWgs84, toMercator, coordEach } from '@turf/turf';
37
37
  import proj4 from 'proj4';
38
38
  import { register } from 'ol/proj/proj4';
39
39
  import { produce } from 'immer';
@@ -4383,10 +4383,6 @@ var NEW_LINESTRING_CREATED = 'new point in LineString created';
4383
4383
  var NEW_FEATURE_CREATED = 'new feature created';
4384
4384
  var NEW_POINT_CREATED = 'new point created';
4385
4385
  var COORDINATE_DECIMALS = 5;
4386
- var roundToDecimals = function roundToDecimals(value, decimals) {
4387
- var factor = Math.pow(10, decimals);
4388
- return Math.round(value * factor) / factor;
4389
- };
4390
4386
  var roundCoordinates = function roundCoordinates(coords) {
4391
4387
  if (!Array.isArray(coords)) {
4392
4388
  return coords;
@@ -4396,7 +4392,7 @@ var roundCoordinates = function roundCoordinates(coords) {
4396
4392
  return value.map(_mapCoords);
4397
4393
  }
4398
4394
  if (typeof value === 'number') {
4399
- return roundToDecimals(value, COORDINATE_DECIMALS);
4395
+ return round(value, COORDINATE_DECIMALS);
4400
4396
  }
4401
4397
  return value;
4402
4398
  };
@@ -6221,6 +6217,59 @@ var selectPreferredWMSProjection = function selectPreferredWMSProjection(viewSrs
6221
6217
  }
6222
6218
  return 'EPSG:3857';
6223
6219
  };
6220
+ /**
6221
+ * Returns the identifier of a linked tile matrix set whose CRS matches the view SRS.
6222
+ * The view SRS is preferred; if it has no match, configured WMProj4Defs are checked
6223
+ * in order. Matrix sets without a known CRS or tiles are ignored.
6224
+ *
6225
+ * @param capabilities WMTS capabilities to search.
6226
+ * @param layerName Identifier of the layer to search.
6227
+ * @param viewSrs Projection code of the current map view.
6228
+ * @returns The matching tile matrix set identifier, or null if no match is available.
6229
+ */
6230
+ var selectPreferredWMTSTileMatrixSet = function selectPreferredWMTSTileMatrixSet(capabilities, layerName, viewSrs) {
6231
+ var _contents$Layer, _layer$TileMatrixSetL;
6232
+ if (!viewSrs) {
6233
+ return null;
6234
+ }
6235
+ var contents = capabilities === null || capabilities === void 0 ? void 0 : capabilities.Contents;
6236
+ var layer = contents === null || contents === void 0 || (_contents$Layer = contents.Layer) === null || _contents$Layer === void 0 ? void 0 : _contents$Layer.find(function (candidate) {
6237
+ return candidate.Identifier === layerName;
6238
+ });
6239
+ var candidates = ((_layer$TileMatrixSetL = layer === null || layer === void 0 ? void 0 : layer.TileMatrixSetLink) !== null && _layer$TileMatrixSetL !== void 0 ? _layer$TileMatrixSetL : []).flatMap(function (link) {
6240
+ var _contents$TileMatrixS, _matrixSet$TileMatrix;
6241
+ var matrixSet = contents === null || contents === void 0 || (_contents$TileMatrixS = contents.TileMatrixSet) === null || _contents$TileMatrixS === void 0 ? void 0 : _contents$TileMatrixS.find(function (candidate) {
6242
+ return candidate.Identifier === link.TileMatrixSet;
6243
+ });
6244
+ var projection = matrixSet !== null && matrixSet !== void 0 && matrixSet.SupportedCRS ? get(matrixSet.SupportedCRS) : null;
6245
+ return matrixSet !== null && matrixSet !== void 0 && matrixSet.Identifier && (_matrixSet$TileMatrix = matrixSet.TileMatrix) !== null && _matrixSet$TileMatrix !== void 0 && _matrixSet$TileMatrix.length && projection ? [{
6246
+ identifier: matrixSet.Identifier,
6247
+ projection: projection
6248
+ }] : [];
6249
+ });
6250
+ var _loop = function _loop() {
6251
+ var code = _arr[_i];
6252
+ var projection = get(code);
6253
+ var match = projection && candidates.find(function (candidate) {
6254
+ return equivalent(candidate.projection, projection);
6255
+ });
6256
+ if (match) {
6257
+ return {
6258
+ v: match.identifier
6259
+ };
6260
+ }
6261
+ },
6262
+ _ret;
6263
+ for (var _i = 0, _arr = [viewSrs].concat(_toConsumableArray(WMProj4Defs.map(function (_ref5) {
6264
+ var _ref6 = _slicedToArray(_ref5, 1),
6265
+ srs = _ref6[0];
6266
+ return srs;
6267
+ }))); _i < _arr.length; _i++) {
6268
+ _ret = _loop();
6269
+ if (_ret) return _ret.v;
6270
+ }
6271
+ return null;
6272
+ };
6224
6273
  var useProjection = function useProjection() {
6225
6274
  var _useContext = useContext(MapContext),
6226
6275
  map = _useContext.map;
@@ -7634,7 +7683,6 @@ var WMTSDimensionsFromDimensions = function WMTSDimensionsFromDimensions(dimensi
7634
7683
  var WMTSLayer = function WMTSLayer(_ref) {
7635
7684
  var getCapsURL = _ref.getCapsURL,
7636
7685
  layerName = _ref.layerName,
7637
- tileMatrixSet = _ref.tileMatrixSet,
7638
7686
  layerOptions = _ref.layerOptions,
7639
7687
  layerProps = _ref.layerProps;
7640
7688
  var _useContext = useContext(MapContext),
@@ -7651,17 +7699,26 @@ var WMTSLayer = function WMTSLayer(_ref) {
7651
7699
  wmtsCaps = _useQueryWMTSGetCapab.data,
7652
7700
  isLoading = _useQueryWMTSGetCapab.isLoading,
7653
7701
  isError = _useQueryWMTSGetCapab.isError;
7702
+ var projectionName = useProjection();
7654
7703
  var wmtsLayer = useMemo(function () {
7655
- if (isLoading || isError || !wmtsCaps) {
7704
+ if (isLoading || isError || !wmtsCaps || !projectionName) {
7656
7705
  return null;
7657
7706
  }
7658
- var parser = new WMTSCapabilities();
7659
- var capabilities = parser.read(wmtsCaps);
7660
- return optionsFromCapabilities(capabilities, {
7661
- layer: layerName,
7662
- matrixSet: tileMatrixSet
7663
- });
7664
- }, [wmtsCaps, isLoading, isError, layerName, tileMatrixSet]);
7707
+ try {
7708
+ var capabilities = new WMTSCapabilities().read(wmtsCaps);
7709
+ var matrixSet = selectPreferredWMTSTileMatrixSet(capabilities, layerName, projectionName);
7710
+ if (!matrixSet) {
7711
+ return null;
7712
+ }
7713
+ return optionsFromCapabilities(capabilities, {
7714
+ layer: layerName,
7715
+ matrixSet: matrixSet
7716
+ });
7717
+ } catch (e) {
7718
+ console.error('Error parsing WMTS capabilities:', e);
7719
+ return null;
7720
+ }
7721
+ }, [isLoading, isError, wmtsCaps, layerName, projectionName]);
7665
7722
  useEffect(function () {
7666
7723
  if (!map || !wmtsLayer) {
7667
7724
  return function () {};
@@ -7678,6 +7735,7 @@ var WMTSLayer = function WMTSLayer(_ref) {
7678
7735
  return function () {
7679
7736
  map.removeLayer(layer);
7680
7737
  setLayer(undefined);
7738
+ setSource(undefined);
7681
7739
  };
7682
7740
  // eslint-disable-next-line react-hooks/exhaustive-deps
7683
7741
  }, [map, wmtsLayer]);
@@ -8061,8 +8119,7 @@ var DefaultBaseLayers = function DefaultBaseLayers(_ref) {
8061
8119
  getCapsURL: "https://services.arcgisonline.com/arcgis/rest/services/World_Topo_Map/MapServer/WMTS?SERVICE=WMTS&REQUEST=GetCapabilities",
8062
8120
  layerName: "World_Topo_Map",
8063
8121
  layerOptions: layerOptions,
8064
- layerProps: layerProps,
8065
- tileMatrixSet: "GoogleMapsCompatible"
8122
+ layerProps: layerProps
8066
8123
  });
8067
8124
  case BaseLayerType.LIGHT_GREY_CANVAS:
8068
8125
  default:
@@ -10635,7 +10692,6 @@ var TimeAwareWMTSLayer = function TimeAwareWMTSLayer(_ref) {
10635
10692
  onLayerError = _ref.onLayerError,
10636
10693
  _ref$visible = _ref.visible,
10637
10694
  visible = _ref$visible === void 0 ? true : _ref$visible;
10638
- var tileMatrixSet = 'EPSG:3857';
10639
10695
  var _useContext = useContext(MapContext),
10640
10696
  map = _useContext.map;
10641
10697
  var _useState = useState(),
@@ -10646,6 +10702,7 @@ var TimeAwareWMTSLayer = function TimeAwareWMTSLayer(_ref) {
10646
10702
  _useState4 = _slicedToArray(_useState3, 2),
10647
10703
  source = _useState4[0],
10648
10704
  setSource = _useState4[1];
10705
+ var projectionName = useProjection();
10649
10706
  // get a wmLayer instance
10650
10707
  var _useGetWMLayerInstanc = useGetWMLayerInstance({
10651
10708
  service: getCapsURL,
@@ -10655,18 +10712,12 @@ var TimeAwareWMTSLayer = function TimeAwareWMTSLayer(_ref) {
10655
10712
  }),
10656
10713
  wmLayer = _useGetWMLayerInstanc.wmLayer,
10657
10714
  errorMessage = _useGetWMLayerInstanc.errorMessage;
10658
- if (errorMessage && onLayerError) {
10659
- onLayerError(layerId || '', errorMessage);
10660
- }
10661
10715
  // dimensionsValues is a key/value dictionary with dimension names specifically for WMS GetMap requests
10662
10716
  var dimensionsValues = getDimensionParamsForWMS(dimensions, wmLayer);
10663
10717
  // This string can be used safely in a useEffect or other React hook to check if the contents changed
10664
10718
  var dimensionsValuesEffectCheck = dimensionsValues && Object.entries(dimensionsValues).map(function (dimensionNameAndCurrentValue) {
10665
10719
  return "".concat(dimensionNameAndCurrentValue[0], ":").concat(dimensionNameAndCurrentValue[1]);
10666
10720
  }).join(',');
10667
- useEffect(function () {
10668
- onLayerReady && wmLayer && layerId && onLayerReady(layerId);
10669
- }, [layerId, wmLayer, onLayerReady]);
10670
10721
  // Initialize layer for GeoWeb, call onInitializeLayer
10671
10722
  useEffect(function () {
10672
10723
  var initializeLayer = /*#__PURE__*/function () {
@@ -10738,23 +10789,54 @@ var TimeAwareWMTSLayer = function TimeAwareWMTSLayer(_ref) {
10738
10789
  var _useQueryWMTSGetCapab = useQueryWMTSGetCapabilities(getCapsURL),
10739
10790
  wmtsCaps = _useQueryWMTSGetCapab.data,
10740
10791
  isLoading = _useQueryWMTSGetCapab.isLoading,
10741
- isError = _useQueryWMTSGetCapab.isError;
10742
- var TimeAwareWMTSLayer = useMemo(function () {
10743
- if (isLoading || isError || !wmtsCaps) {
10744
- return null;
10792
+ isError = _useQueryWMTSGetCapab.isError,
10793
+ error = _useQueryWMTSGetCapab.error;
10794
+ var _useMemo = useMemo(function () {
10795
+ if (isLoading || isError || !wmtsCaps || !projectionName) {
10796
+ return {
10797
+ options: null
10798
+ };
10799
+ }
10800
+ try {
10801
+ var capabilities = new WMTSCapabilities().read(wmtsCaps);
10802
+ var matrixSet = selectPreferredWMTSTileMatrixSet(capabilities, layerName, projectionName);
10803
+ if (!matrixSet) {
10804
+ return {
10805
+ options: null
10806
+ };
10807
+ }
10808
+ return {
10809
+ options: optionsFromCapabilities(capabilities, {
10810
+ layer: layerName,
10811
+ matrixSet: matrixSet
10812
+ })
10813
+ };
10814
+ } catch (e) {
10815
+ return {
10816
+ options: null,
10817
+ error: "Error parsing WMTS capabilities: ".concat(e instanceof Error ? e.message : String(e))
10818
+ };
10819
+ }
10820
+ }, [wmtsCaps, isLoading, isError, layerName, projectionName]),
10821
+ wmtsOptions = _useMemo.options,
10822
+ parsingError = _useMemo.error;
10823
+ var layerError = errorMessage || isError && "Error fetching WMTS capabilities: ".concat((error === null || error === void 0 ? void 0 : error.message) || 'Unknown error') || parsingError;
10824
+ var isLayerReady = !!wmLayer && !!wmtsOptions;
10825
+ var reportLayerStatus = useEffectEvent(function () {
10826
+ if (layerError) {
10827
+ onLayerError === null || onLayerError === void 0 || onLayerError(layerId || '', layerError);
10828
+ } else if (isLayerReady && layerId) {
10829
+ onLayerReady === null || onLayerReady === void 0 || onLayerReady(layerId);
10745
10830
  }
10746
- var parser = new WMTSCapabilities();
10747
- var capabilities = parser.read(wmtsCaps);
10748
- return optionsFromCapabilities(capabilities, {
10749
- layer: layerName,
10750
- matrixSet: tileMatrixSet
10751
- });
10752
- }, [wmtsCaps, isLoading, isError, layerName, tileMatrixSet]);
10831
+ });
10753
10832
  useEffect(function () {
10754
- if (!map || !TimeAwareWMTSLayer) {
10833
+ reportLayerStatus();
10834
+ }, [layerError, isLayerReady, layerId]);
10835
+ useEffect(function () {
10836
+ if (!map || !wmtsOptions) {
10755
10837
  return function () {};
10756
10838
  }
10757
- var source = new WMTS(_objectSpread2(_objectSpread2({}, TimeAwareWMTSLayer), dimensions ? {
10839
+ var source = new WMTS(_objectSpread2(_objectSpread2({}, wmtsOptions), dimensions ? {
10758
10840
  dimensions: WMTSDimensionsFromDimensions(dimensions)
10759
10841
  } : {}));
10760
10842
  var layer = new TileLayer({
@@ -10769,12 +10851,13 @@ var TimeAwareWMTSLayer = function TimeAwareWMTSLayer(_ref) {
10769
10851
  return function () {
10770
10852
  map.removeLayer(layer);
10771
10853
  setLayer(undefined);
10854
+ setSource(undefined);
10772
10855
  if (wmLayer) {
10773
10856
  wmLayer.olSource = null;
10774
10857
  }
10775
10858
  };
10776
10859
  // eslint-disable-next-line react-hooks/exhaustive-deps
10777
- }, [map, TimeAwareWMTSLayer, wmLayer]);
10860
+ }, [map, wmtsOptions, wmLayer]);
10778
10861
  useEffect(function () {
10779
10862
  if (dimensions) {
10780
10863
  source === null || source === void 0 || source.updateDimensions(WMTSDimensionsFromDimensions(dimensions));
@@ -11505,6 +11588,13 @@ var OpenLayersLayer = function OpenLayersLayer(layerProps) {
11505
11588
  urlTemplate: urlTemplate
11506
11589
  });
11507
11590
  }
11591
+ } else if (type === 'wmts' && _name && _service) {
11592
+ return jsx(WMTSLayer, {
11593
+ getCapsURL: "".concat(_service, "?SERVICE=WMTS&REQUEST=GetCapabilities"),
11594
+ layerName: _name,
11595
+ layerOptions: layerOptions,
11596
+ layerProps: layerProps
11597
+ });
11508
11598
  } else if (_name && _service) {
11509
11599
  return jsx(WMSLayer, {
11510
11600
  layerName: _name,
@@ -11774,6 +11864,7 @@ var OpenLayersMapDraw = function OpenLayersMapDraw(_ref) {
11774
11864
  updateGeojson = _ref.updateGeojson,
11775
11865
  onViewOnlyFeatureClick = _ref.onViewOnlyFeatureClick,
11776
11866
  onNoFeatureClick = _ref.onNoFeatureClick,
11867
+ onEscape = _ref.onEscape,
11777
11868
  boxSelect = _ref.boxSelect;
11778
11869
  var _React$useContext = React.useContext(MapContext),
11779
11870
  map = _React$useContext.map;
@@ -11782,11 +11873,13 @@ var OpenLayersMapDraw = function OpenLayersMapDraw(_ref) {
11782
11873
  var updateGeojsonRef = React.useRef(updateGeojson);
11783
11874
  var onViewOnlyFeatureClickRef = React.useRef(onViewOnlyFeatureClick);
11784
11875
  var onNoFeatureClickRef = React.useRef(onNoFeatureClick);
11876
+ var onEscapeRef = React.useRef(onEscape);
11785
11877
  var boxSelectRef = React.useRef(boxSelect);
11786
11878
  exitDrawModeCallbackRef.current = exitDrawModeCallback;
11787
11879
  updateGeojsonRef.current = updateGeojson;
11788
11880
  onViewOnlyFeatureClickRef.current = onViewOnlyFeatureClick;
11789
11881
  onNoFeatureClickRef.current = onNoFeatureClick;
11882
+ onEscapeRef.current = onEscape;
11790
11883
  boxSelectRef.current = boxSelect;
11791
11884
  React.useEffect(function () {
11792
11885
  var _geojson$features$sel;
@@ -12375,6 +12468,7 @@ var OpenLayersMapDraw = function OpenLayersMapDraw(_ref) {
12375
12468
  };
12376
12469
  var abortOnEsc = function abortOnEsc(evt) {
12377
12470
  if (evt.key === 'Escape') {
12471
+ var _onEscapeRef$current;
12378
12472
  evt.preventDefault();
12379
12473
  draw.finishDrawing();
12380
12474
  if (selectedFeatureHasGeometry) {
@@ -12383,6 +12477,7 @@ var OpenLayersMapDraw = function OpenLayersMapDraw(_ref) {
12383
12477
  } else {
12384
12478
  draw.abortDrawing();
12385
12479
  }
12480
+ (_onEscapeRef$current = onEscapeRef.current) === null || _onEscapeRef$current === void 0 || _onEscapeRef$current.call(onEscapeRef);
12386
12481
  }
12387
12482
  };
12388
12483
  var onlyAllowMoving = actualDrawMode === DRAWMODE.CIRCLE || actualDrawMode === DRAWMODE.OVAL || actualDrawMode === DRAWMODE.FREEHANDLINE;
@@ -14852,4 +14947,4 @@ var getLayerUpdateInfo = function getLayerUpdateInfo(wmLayer, mapId) {
14852
14947
  return updateObject;
14853
14948
  };
14854
14949
 
14855
- export { BaseLayerType, CLASSNAME_MAP_MEASURE_TOOLTIP, CONSTRAINED_SELECTION_TYPES, COORDINATE_DECIMALS, ClickOnMapTool, Clock, DEFAULT_GEOJSON_STYLE_FILL_OPACITY, DRAWMODE, DefaultBaseLayers, DimensionSelectButton, DimensionSelectDialog, DimensionSelectSlider, EditModeButton as EditModeButtonField, FEATURE_DRAW_FILL_COLOR, FEATURE_DRAW_FILL_COLOR_TRANSPARENT, FEATURE_DRAW_SECONDARY_FILL_COLOR, FEATURE_DRAW_SECONDARY_STROKE_COLOR, FEATURE_DRAW_STROKE_COLOR, 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, IntersectionSelect, LayerInfoButton, LayerInfoDialog, LayerInfoLegend, LayerInfoList, LayerInfoText, Legend, LegendButton, LegendDialog, LegendLayout, MIN_HEIGHT, MIN_WIDTH, MapContext, MapControlButton, MapControls, MapDimensionSelect, MapFeatureClass, MapMeasure, MapTime, MapWarningProperties, NEW_FEATURE_CREATED, NEW_LINESTRING_CREATED, NEW_POINT_CREATED, OpenLayersFeatureLayer, OpenLayersGetFeatureInfo, OpenLayersLayer, OpenLayersMapDraw, OpenLayersMapView, OpenLayersZoomControl, POINTER_CLICK_TOLERANCE_PX, SELECTED_FEATURE_COLOR, SELECTED_POINT_HALO_STYLE, STAC_ASSET_STYLE_PREFIX, STAC_ITEM_PAGE_LIMIT, STAC_ITEM_SEARCH_FIELDS_CONFORMANCE, STAC_TEMPORAL_STEP_SAMPLE_LIMIT, SelectField, StoryLayoutGrid, TRANSIENT_FEATURE_PROPERTIES, TimeAwareEDRLocationLayer, TimeAwareGeoTIFFLayer, TimeAwareWMTSLayer, TimeContext, TimeawareImageSource, TimeawareImageSourceWMSLayer, WEBMAP_REACT_NAMESPACE, WMSLayer, WMTSLayer, XYZLayer, ZoomControls, addFeatureProperties, addGeoJSONProperties, addSelectionTypeToGeoJSON, asNewFeature, basicExampleDrawOptions, basicExampleMultipleShapeDrawOptions, basicExampleMultipleShapeWithValuesDrawOptions, basicExampleSharedVertexDrawOptions, calculateBoxSelection, calculateNewSelection, catmullRomSpline, clearImageCacheForAllMaps, colorMaps, connectSharedVertices, createBoxBasedOnModifiedVertex, createIconStyle, createInterSections, createModifyFeatures, createMoveFeatures, createOval, currentlySupportedDrawModes, defaultBox, defaultCircle, defaultDelete, defaultEdrStyles, defaultFreehandLine, defaultGeoJSONStyleProperties, defaultIntersectionStyleProperties, defaultLayers, defaultLineString, defaultLocation, defaultModes, defaultOval, defaultPoint, defaultPolygon, defaultRotatableBox, defaultSmoothLine, defaultSplit, defaultSquare, defaultTimeFormat, dimensionConfig, drawPolyStoryStyles, drawStyles, emptyGeoJSON, endToolExampleConfig, exampleIntersectionOptions, exampleIntersectionWithShapeOptions, exampleIntersections, exampleIntersectionsMultiDrawTool, featureMultiPoint, featurePoint, featurePolygon, fetchEDRArea, fetchEDRCollectionDetails, fetchEDRCube, fetchEDRJson, fetchEDRParameter, fetchStacCatalogCollections, fetchStacCatalogRoot, fetchStacCollection, fetchStacItem, fetchStacItems, fetchStacItemsPage, fetchStacItemsWithPagination, fillOptions, firSelectionType, formatTime, generateImageFromLegend, genericOpenLayersFeatureStyle, geowebColorToOpenLayersColor, getAffectedIndices, getBoxRotateHandlePoints, getBoxSelectPreviewStyle, getDimensionIcon, getDimensionLabel, getDimensionValue, getDimensionsList, getDoubleControlToolIcon, getDrawModeIdFromSelectionType, getFeatureCollection, getFeatureExtent, getFeaturePointStyle, getFirTitle, getGeoJSONPropertyValue, getGeoJson, getIcon, getIntersectionToolIcon, getIsInsideAcceptanceTime, getLastEmptyFeatureIndex, getLayerBbox, getLayerExtentForProjection, getLayerStyles, getLayerUpdateInfo, getLegendClass, getOlFeatureKey, getProj4, getRendersAsStyles, getStacAssetKeyFromStyle, getStacAssetStyles, getStacCollectionStyles, getStacFrameItemsToRender, getStacItemLookupWindowForTimes, getStacItemSearchUrl, getStacItemsUrl, getTimeDimension, getToolIcon, handleResponse, hasEditableVertices, initializeOpenLayersProjections, inlineFeatureStyle, intersectPointGeoJSONS, intersectPolygonGeoJSONS, intersectionFeatureBE, intersectionFeatureNL, isBrowserReadableGeoTIFFAsset, isClickFromDrag, isDefaultModifiable, isDefaultMovable, isGeoJSONFeatureCreatedByTool, isGeoJSONGeometryEmpty, isGeoTIFFAsset, isPointFeatureCollection, joinUrlParams, keepIdentityOnFirstSplitFeature, labelOptions, lineString, lineStringCollection, makeFeatureStyleDisc, makeFeatureStyleLoading, makeFeatureStyleMultiParam, makeFeatureStyleMultiParamLoading, makeFeatureStyleWind, makeLegendFromColorMap, makeLegendFromStyleName, makeTimeList, makeView, marksByDimension, measureResultStyle, measureToolStyle, modifyHandleStyle$1 as modifyHandleStyle, modifyStyles, moveFeature, multiLineStringLabelStyle, multiPolygonLabelStyle, normalizeEDRLabel, opacityOptions, openLayersGetMapImageStore, polygonCleanDangling, polygonCleanDanglingCoords, polygonFeatureCollectionCleanDangling, precipitationMMLegendColorsWoW, projectorCache, publicLayers, publicServices, removeFeatureProperties, removeOverlappingLines, removeTransientFeatureProperties, resolvePreferredStyleName$1 as resolvePreferredStyleName, resolveStacAssetKey, rewindGeometry, roundCoordinates, roundFeatureCoordinates, selectPreferredWMSProjection, setMapCenter, setViewFromExtent, setViewFromFeature, shouldEnterEditMode, shouldExitEditModeForMultiSelect, simpleBoxGeoJSON, simpleBoxGeoJSONWrongOrder, simpleFlightRouteLineStringGeoJSON, simpleFlightRoutePointsGeoJSON, simpleGeometryCollectionGeoJSON, simpleLineStringGeoJSON, simpleMultiPolygon, simplePointsGeojson, simplePolygonGeoJSON, simpleSmallLineStringGeoJSON, splitLine, splitPolygon, splitStyle, stacCatalogCollectionToLayerProps, stacColormapToOlStyle, stacGrayscaleOlStyle, stacNormalizedGrayscaleOlStyle, startToolExampleConfig, strokeWidthOptions, styleNameToStyleLike, temperatureLegendColorsCWK, temperatureLegendColorsWoW, textLabelStyle, textStyle, textStyleWithMargin, toMovedFeatures, updateEditModeButtonsWithFir, useAnimationForLayer, useEDRGetCollectionDetails, useEDRGetParameterData, useEDRWMLayer, useGeoJSON, useGetWMLayerInstance, useGetWMSLayerStyleList, useIconStyle, useMapDrawTool, useModifyFeatures, useMoveFeatures, useProjection, useQueryGetWMSGetCapabilities, useQueryGetWMSLayer, useQueryGetWMSLayers, useQueryGetWMSLayersTree, useQueryGetWMSServiceInfo, useQueryWMTSGetCapabilities, useSetIntervalWhenVisible, useStacCatalogRoot, useStacCollection, useStacItems, useStacOverviewItems, useStacTemporalStepItems, useViewFromLayer, viewUtils, webmapEDRQueryOptions, webmapReactTranslations };
14950
+ export { BaseLayerType, CLASSNAME_MAP_MEASURE_TOOLTIP, CONSTRAINED_SELECTION_TYPES, COORDINATE_DECIMALS, ClickOnMapTool, Clock, DEFAULT_GEOJSON_STYLE_FILL_OPACITY, DRAWMODE, DefaultBaseLayers, DimensionSelectButton, DimensionSelectDialog, DimensionSelectSlider, EditModeButton as EditModeButtonField, FEATURE_DRAW_FILL_COLOR, FEATURE_DRAW_FILL_COLOR_TRANSPARENT, FEATURE_DRAW_SECONDARY_FILL_COLOR, FEATURE_DRAW_SECONDARY_STROKE_COLOR, FEATURE_DRAW_STROKE_COLOR, 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, IntersectionSelect, LayerInfoButton, LayerInfoDialog, LayerInfoLegend, LayerInfoList, LayerInfoText, Legend, LegendButton, LegendDialog, LegendLayout, MIN_HEIGHT, MIN_WIDTH, MapContext, MapControlButton, MapControls, MapDimensionSelect, MapFeatureClass, MapMeasure, MapTime, MapWarningProperties, NEW_FEATURE_CREATED, NEW_LINESTRING_CREATED, NEW_POINT_CREATED, OpenLayersFeatureLayer, OpenLayersGetFeatureInfo, OpenLayersLayer, OpenLayersMapDraw, OpenLayersMapView, OpenLayersZoomControl, POINTER_CLICK_TOLERANCE_PX, SELECTED_FEATURE_COLOR, SELECTED_POINT_HALO_STYLE, STAC_ASSET_STYLE_PREFIX, STAC_ITEM_PAGE_LIMIT, STAC_ITEM_SEARCH_FIELDS_CONFORMANCE, STAC_TEMPORAL_STEP_SAMPLE_LIMIT, SelectField, StoryLayoutGrid, TRANSIENT_FEATURE_PROPERTIES, TimeAwareEDRLocationLayer, TimeAwareGeoTIFFLayer, TimeAwareWMTSLayer, TimeContext, TimeawareImageSource, TimeawareImageSourceWMSLayer, WEBMAP_REACT_NAMESPACE, WMSLayer, WMTSLayer, XYZLayer, ZoomControls, addFeatureProperties, addGeoJSONProperties, addSelectionTypeToGeoJSON, asNewFeature, basicExampleDrawOptions, basicExampleMultipleShapeDrawOptions, basicExampleMultipleShapeWithValuesDrawOptions, basicExampleSharedVertexDrawOptions, calculateBoxSelection, calculateNewSelection, catmullRomSpline, clearImageCacheForAllMaps, colorMaps, connectSharedVertices, createBoxBasedOnModifiedVertex, createIconStyle, createInterSections, createModifyFeatures, createMoveFeatures, createOval, currentlySupportedDrawModes, defaultBox, defaultCircle, defaultDelete, defaultEdrStyles, defaultFreehandLine, defaultGeoJSONStyleProperties, defaultIntersectionStyleProperties, defaultLayers, defaultLineString, defaultLocation, defaultModes, defaultOval, defaultPoint, defaultPolygon, defaultRotatableBox, defaultSmoothLine, defaultSplit, defaultSquare, defaultTimeFormat, dimensionConfig, drawPolyStoryStyles, drawStyles, emptyGeoJSON, endToolExampleConfig, exampleIntersectionOptions, exampleIntersectionWithShapeOptions, exampleIntersections, exampleIntersectionsMultiDrawTool, featureMultiPoint, featurePoint, featurePolygon, fetchEDRArea, fetchEDRCollectionDetails, fetchEDRCube, fetchEDRJson, fetchEDRParameter, fetchStacCatalogCollections, fetchStacCatalogRoot, fetchStacCollection, fetchStacItem, fetchStacItems, fetchStacItemsPage, fetchStacItemsWithPagination, fillOptions, firSelectionType, formatTime, generateImageFromLegend, genericOpenLayersFeatureStyle, geowebColorToOpenLayersColor, getAffectedIndices, getBoxRotateHandlePoints, getBoxSelectPreviewStyle, getDimensionIcon, getDimensionLabel, getDimensionValue, getDimensionsList, getDoubleControlToolIcon, getDrawModeIdFromSelectionType, getFeatureCollection, getFeatureExtent, getFeaturePointStyle, getFirTitle, getGeoJSONPropertyValue, getGeoJson, getIcon, getIntersectionToolIcon, getIsInsideAcceptanceTime, getLastEmptyFeatureIndex, getLayerBbox, getLayerExtentForProjection, getLayerStyles, getLayerUpdateInfo, getLegendClass, getOlFeatureKey, getProj4, getRendersAsStyles, getStacAssetKeyFromStyle, getStacAssetStyles, getStacCollectionStyles, getStacFrameItemsToRender, getStacItemLookupWindowForTimes, getStacItemSearchUrl, getStacItemsUrl, getTimeDimension, getToolIcon, handleResponse, hasEditableVertices, initializeOpenLayersProjections, inlineFeatureStyle, intersectPointGeoJSONS, intersectPolygonGeoJSONS, intersectionFeatureBE, intersectionFeatureNL, isBrowserReadableGeoTIFFAsset, isClickFromDrag, isDefaultModifiable, isDefaultMovable, isGeoJSONFeatureCreatedByTool, isGeoJSONGeometryEmpty, isGeoTIFFAsset, isPointFeatureCollection, joinUrlParams, keepIdentityOnFirstSplitFeature, labelOptions, lineString, lineStringCollection, makeFeatureStyleDisc, makeFeatureStyleLoading, makeFeatureStyleMultiParam, makeFeatureStyleMultiParamLoading, makeFeatureStyleWind, makeLegendFromColorMap, makeLegendFromStyleName, makeTimeList, makeView, marksByDimension, measureResultStyle, measureToolStyle, modifyHandleStyle$1 as modifyHandleStyle, modifyStyles, moveFeature, multiLineStringLabelStyle, multiPolygonLabelStyle, normalizeEDRLabel, opacityOptions, openLayersGetMapImageStore, polygonCleanDangling, polygonCleanDanglingCoords, polygonFeatureCollectionCleanDangling, precipitationMMLegendColorsWoW, projectorCache, publicLayers, publicServices, removeFeatureProperties, removeOverlappingLines, removeTransientFeatureProperties, resolvePreferredStyleName$1 as resolvePreferredStyleName, resolveStacAssetKey, rewindGeometry, roundCoordinates, roundFeatureCoordinates, selectPreferredWMSProjection, selectPreferredWMTSTileMatrixSet, setMapCenter, setViewFromExtent, setViewFromFeature, shouldEnterEditMode, shouldExitEditModeForMultiSelect, simpleBoxGeoJSON, simpleBoxGeoJSONWrongOrder, simpleFlightRouteLineStringGeoJSON, simpleFlightRoutePointsGeoJSON, simpleGeometryCollectionGeoJSON, simpleLineStringGeoJSON, simpleMultiPolygon, simplePointsGeojson, simplePolygonGeoJSON, simpleSmallLineStringGeoJSON, splitLine, splitPolygon, splitStyle, stacCatalogCollectionToLayerProps, stacColormapToOlStyle, stacGrayscaleOlStyle, stacNormalizedGrayscaleOlStyle, startToolExampleConfig, strokeWidthOptions, styleNameToStyleLike, temperatureLegendColorsCWK, temperatureLegendColorsWoW, textLabelStyle, textStyle, textStyleWithMargin, toMovedFeatures, updateEditModeButtonsWithFir, useAnimationForLayer, useEDRGetCollectionDetails, useEDRGetParameterData, useEDRWMLayer, useGeoJSON, useGetWMLayerInstance, useGetWMSLayerStyleList, useIconStyle, useMapDrawTool, useModifyFeatures, useMoveFeatures, useProjection, useQueryGetWMSGetCapabilities, useQueryGetWMSLayer, useQueryGetWMSLayers, useQueryGetWMSLayersTree, useQueryGetWMSServiceInfo, useQueryWMTSGetCapabilities, useSetIntervalWhenVisible, useStacCatalogRoot, useStacCollection, useStacItems, useStacOverviewItems, useStacTemporalStepItems, useViewFromLayer, viewUtils, webmapEDRQueryOptions, webmapReactTranslations };
@@ -16,6 +16,8 @@ export interface OpenLayersMapDrawProps {
16
16
  updateGeojson?: (geoJson: GeoJSON.FeatureCollection, text: string) => void;
17
17
  onViewOnlyFeatureClick?: (feature: Feature<Geometry>[], isShiftClick?: boolean) => void;
18
18
  onNoFeatureClick?: () => void;
19
+ /** Called after the map handled Escape in edit or draw mode */
20
+ onEscape?: () => void;
19
21
  boxSelect?: BoxSelect;
20
22
  }
21
23
  /**
@@ -3,7 +3,6 @@ import type { LayerFoundation } from '@opengeoweb/webmap';
3
3
  export interface WMTSLayerProps {
4
4
  getCapsURL: string;
5
5
  layerName: string;
6
- tileMatrixSet: string;
7
6
  layerOptions: ConstructorParameters<typeof TileLayer>[0];
8
7
  layerProps?: LayerFoundation;
9
8
  }
@@ -1 +1,2 @@
1
+ export declare const createWMTSCapabilities: (codes: string[]) => string;
1
2
  export declare const fakeWMTSLayerApiHandlers: import("msw").HttpHandler[];
@@ -13,4 +13,31 @@ export declare const initializeOpenLayersProjections: () => void;
13
13
  * @returns
14
14
  */
15
15
  export declare const selectPreferredWMSProjection: (viewSrs: string, layerProps: LayerProps | null) => string;
16
+ interface WMTSCapabilitiesContents {
17
+ Contents?: {
18
+ Layer?: {
19
+ Identifier: string;
20
+ TileMatrixSetLink?: {
21
+ TileMatrixSet: string;
22
+ }[];
23
+ }[];
24
+ TileMatrixSet?: {
25
+ Identifier: string;
26
+ SupportedCRS?: string;
27
+ TileMatrix?: unknown[];
28
+ }[];
29
+ };
30
+ }
31
+ /**
32
+ * Returns the identifier of a linked tile matrix set whose CRS matches the view SRS.
33
+ * The view SRS is preferred; if it has no match, configured WMProj4Defs are checked
34
+ * in order. Matrix sets without a known CRS or tiles are ignored.
35
+ *
36
+ * @param capabilities WMTS capabilities to search.
37
+ * @param layerName Identifier of the layer to search.
38
+ * @param viewSrs Projection code of the current map view.
39
+ * @returns The matching tile matrix set identifier, or null if no match is available.
40
+ */
41
+ export declare const selectPreferredWMTSTileMatrixSet: (capabilities: WMTSCapabilitiesContents | null, layerName: string, viewSrs: string | undefined) => string | null;
16
42
  export declare const useProjection: () => string | undefined;
43
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/webmap-react",
3
- "version": "20.1.0-nightly-20261018",
3
+ "version": "20.2.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": "20.1.0-nightly-20261018",
24
- "@opengeoweb/theme": "20.1.0-nightly-20261018",
25
- "@opengeoweb/shared": "20.1.0-nightly-20261018",
23
+ "@opengeoweb/webmap": "20.2.0",
24
+ "@opengeoweb/theme": "20.2.0",
25
+ "@opengeoweb/shared": "20.2.0",
26
26
  "lodash": "^4.18.1",
27
27
  "ol": "^10.4.0",
28
28
  "proj4": "^2.9.2",