@opengeoweb/webmap 10.1.0 → 10.2.1-spike-ol.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js CHANGED
@@ -470,6 +470,7 @@ var WMEmptyLayerTitle = 'empty layer';
470
470
  var WMDateOutSideRange = 'outside range';
471
471
  var WMDateTooEarlyString = 'date too early';
472
472
  var WMDateTooLateString = 'date too late';
473
+ var WMDateUnit = 'ISO8601';
473
474
  var WMInvalidDateValues = new Set([WMDateOutSideRange, WMDateTooEarlyString, WMDateTooLateString]);
474
475
  var WMSJSMAP_MINIMUM_MAP_WIDTH = 4;
475
476
  var WMSJSMAP_MINIMUM_MAP_HEIGHT = 4;
@@ -478,7 +479,7 @@ var WMSVersion = {
478
479
  version111: '1.1.1',
479
480
  version130: '1.3.0'
480
481
  };
481
- var WMProj4Defs = [[PROJECTION.EPSG_4326.value, '+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees'], [PROJECTION.EPSG_4269.value, '+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees'], [PROJECTION.EPSG_3575.value, '+proj=laea +lat_0=90 +lon_0=10 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs'], [PROJECTION.EPSG_3785.value, '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs'], [PROJECTION.EPSG_3857.value, '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs'], [PROJECTION.EPSG_3411.value, '+proj=stere +lat_0=90 +lat_ts=70 +lon_0=-45 +k=1 +x_0=0 +y_0=0 +a=6378273 +b=6356889.449 +units=m +no_defs'], [PROJECTION.EPSG_3412.value, '+proj=stere +lat_0=-90 +lat_ts=-70 +lon_0=0 +k=1 +x_0=0 +y_0=0 +a=6378273 +b=6356889.449 +units=m +no_defs'], [PROJECTION.EPSG_28992.value, '+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +units=m +no_defs <>'], [PROJECTION.EPSG_32661.value, '+proj=stere +lat_0=90 +lat_ts=90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +ellps=WGS84 +datum=WGS84 +units=m +no_defs'], [PROJECTION.EPSG_102100.value, '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs'], [PROJECTION.EPSG_3067.value, '+proj=utm +zone=35 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs']];
482
+ var WMProj4Defs = [[PROJECTION.EPSG_4326.value, '+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees'], [PROJECTION.EPSG_4269.value, '+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees'], [PROJECTION.EPSG_3575.value, '+proj=laea +lat_0=90 +lon_0=10 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs'], [PROJECTION.EPSG_3785.value, '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs'], [PROJECTION.EPSG_3857.value, '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs'], [PROJECTION.EPSG_3411.value, '+proj=stere +lat_0=90 +lat_ts=70 +lon_0=-45 +k=1 +x_0=0 +y_0=0 +a=6378273 +b=6356889.449 +units=m +no_defs'], [PROJECTION.EPSG_3412.value, '+proj=stere +lat_0=-90 +lat_ts=-70 +lon_0=0 +k=1 +x_0=0 +y_0=0 +a=6378273 +b=6356889.449 +units=m +no_defs'], [PROJECTION.EPSG_28992.value, '+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +units=m +no_defs <>'], [PROJECTION.EPSG_32661.value, '+proj=stere +lat_0=90 +lat_ts=90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +ellps=WGS84 +datum=WGS84 +units=m +no_defs'], [PROJECTION.EPSG_102100.value, '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs'], [PROJECTION.EPSG_3067.value, '+proj=utm +zone=35 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs'], [PROJECTION.EPSG_54030.value, '+proj=robin +lon_0=0 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs +type=crs']];
482
483
  var mapImageStoreLength = 1000;
483
484
  var bgImageStoreLength = 360;
484
485
  var legendImageStoreLength = 500;
@@ -486,6 +487,206 @@ var EVENT_GETCAPABILITIES_START = 'onstartgetcapabilities';
486
487
  var EVENT_GETCAPABILITIES_READY = 'onreadygetcapabilities';
487
488
  var WMJSMAP_LONLAT_EPSGCODE = PROJECTION.EPSG_4326.value;
488
489
 
490
+ /* *
491
+ * Licensed under the Apache License, Version 2.0 (the "License");
492
+ * you may not use this file except in compliance with the License.
493
+ * You may obtain a copy of the License at
494
+ *
495
+ * http://www.apache.org/licenses/LICENSE-2.0
496
+ *
497
+ * Unless required by applicable law or agreed to in writing, software
498
+ * distributed under the License is distributed on an "AS IS" BASIS,
499
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
500
+ * See the License for the specific language governing permissions and
501
+ * limitations under the License.
502
+ *
503
+ * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
504
+ * Copyright 2023 - Finnish Meteorological Institute (FMI)
505
+ * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
506
+ * */
507
+ var generatedLayerIds = 0;
508
+ var generateLayerId = function generateLayerId() {
509
+ generatedLayerIds += 1;
510
+ return "layerid_" + generatedLayerIds;
511
+ };
512
+ var generatedMapIds = 0;
513
+ var generateMapId = function generateMapId() {
514
+ generatedMapIds += 1;
515
+ return "mapid_" + generatedMapIds;
516
+ };
517
+ var generatedTimesliderIds = 0;
518
+ var generateTimesliderId = function generateTimesliderId() {
519
+ generatedTimesliderIds += 1;
520
+ return "timesliderid_" + generatedTimesliderIds;
521
+ };
522
+ /**
523
+ * Map for registering wmlayers with their id's
524
+ */
525
+ var registeredWMLayersForReactLayerId = {};
526
+ /**
527
+ * Registers a WMJSLayer in a lookuptable with a layerId
528
+ * @param {WMLayer} wmLayer
529
+ * @param {string} layerId
530
+ */
531
+ var registerWMLayer = function registerWMLayer(wmLayer, layerId) {
532
+ registeredWMLayersForReactLayerId[layerId] = wmLayer;
533
+ };
534
+ /**
535
+ * Get the WMLayer from the lookuptable with layerId
536
+ * @param {string} layerId
537
+ */
538
+ var getWMLayerById = function getWMLayerById(layerId) {
539
+ return registeredWMLayersForReactLayerId[layerId];
540
+ };
541
+ var unRegisterWMJSLayer = function unRegisterWMJSLayer(layerId) {
542
+ var layer = registeredWMLayersForReactLayerId[layerId];
543
+ if (layer) {
544
+ delete registeredWMLayersForReactLayerId[layerId];
545
+ }
546
+ };
547
+ var unRegisterAllWMJSLayersAndMaps = function unRegisterAllWMJSLayersAndMaps() {
548
+ var allLayerIds = Object.keys(registeredWMLayersForReactLayerId);
549
+ allLayerIds.forEach(function (layerId) {
550
+ unRegisterWMJSLayer(layerId);
551
+ });
552
+ var allMapIds = Object.keys(registeredWMMapForReactMapId);
553
+ allMapIds.forEach(function (mapId) {
554
+ unRegisterWMJSMap(mapId);
555
+ });
556
+ };
557
+ /**
558
+ * Map for registering wmlayers with their id's
559
+ */
560
+ var registeredWMMapForReactMapId = {};
561
+ /**
562
+ * Registers a IWMJSMap in a lookuptable with a wmjsMapId
563
+ * @param {IWMJSMap} wmjsMap
564
+ * @param {string} wmjsMapId
565
+ */
566
+ var registerWMJSMap = function registerWMJSMap(wmjsMap, wmjsMapId) {
567
+ if (registeredWMMapForReactMapId[wmjsMapId]) {
568
+ console.warn("Map with id " + wmjsMapId + " already made");
569
+ }
570
+ registeredWMMapForReactMapId[wmjsMapId] = wmjsMap;
571
+ };
572
+ var unRegisterWMJSMap = function unRegisterWMJSMap(wmjsMapId) {
573
+ var wmjsMap = registeredWMMapForReactMapId[wmjsMapId];
574
+ if (wmjsMap) {
575
+ wmjsMap.getListener().suspendEvents();
576
+ try {
577
+ wmjsMap.stopAnimating && wmjsMap.stopAnimating();
578
+ } catch (e) {
579
+ console.warn(e);
580
+ }
581
+ Object.keys(registeredWMLayersForReactLayerId).forEach(function (layerId) {
582
+ var wmLayer = getWMLayerById(layerId);
583
+ if (wmLayer.parentMap === wmjsMap) {
584
+ unRegisterWMJSLayer(layerId);
585
+ }
586
+ });
587
+ wmjsMap.destroy();
588
+ delete registeredWMMapForReactMapId[wmjsMapId];
589
+ }
590
+ };
591
+ /**
592
+ * Get the wmjsMap from the lookuptable with wmjsMapId
593
+ * @param {string} wmjsMapId
594
+ */
595
+ var getWMJSMapById = function getWMJSMapById(wmjsMapId) {
596
+ return registeredWMMapForReactMapId[wmjsMapId];
597
+ };
598
+ /**
599
+ * Get all wmjsMap id's from the lookuptable with wmjsMapId
600
+ * @param {string} wmjsMapId
601
+ */
602
+ var getWMJSMapIds = function getWMJSMapIds() {
603
+ return Object.keys(registeredWMMapForReactMapId);
604
+ };
605
+ /**
606
+ * Returns the WMJSDimension object for given layerId and dimension name
607
+ * @param layerId The layerId
608
+ * @param dimensionName The dimension to lookup
609
+ */
610
+ var getWMJSDimensionForLayerAndDimension = function getWMJSDimensionForLayerAndDimension(layerId, dimensionName) {
611
+ var wmLayer = getWMLayerById(layerId);
612
+ if (!wmLayer || !dimensionName) {
613
+ return undefined;
614
+ }
615
+ var wmjsDimension = wmLayer.getDimension(dimensionName);
616
+ if (!wmjsDimension) {
617
+ return undefined;
618
+ }
619
+ return wmjsDimension;
620
+ };
621
+ /**
622
+ * Gets the WMJSTimeDimension for given activeLayerId and dimensions list
623
+ * @param layerId: The layer id to search the WMJSDimension for
624
+ * @return: The WMJSDimension if found, otherwise null
625
+ */
626
+ var getWMJSTimeDimensionForLayerId = function getWMJSTimeDimensionForLayerId(layerId) {
627
+ var wmLayer = getWMLayerById(layerId);
628
+ if (!wmLayer) {
629
+ return null;
630
+ }
631
+ return wmLayer.getDimension('time');
632
+ };
633
+ /**
634
+ * Clears the image store for all maps
635
+ */
636
+ var clearImageCacheForAllMaps = function clearImageCacheForAllMaps() {
637
+ getWMJSMapIds().forEach(function (id) {
638
+ var map = getWMJSMapById(id);
639
+ if (map && !map.isDestroyed) {
640
+ map.clearImageCache();
641
+ }
642
+ });
643
+ };
644
+ var roundWithTimeStep = function roundWithTimeStep(unixTime, timeStep, type) {
645
+ var adjustedTimeStep = timeStep * 60;
646
+ if (!type || type === 'round') {
647
+ return Math.round(unixTime / adjustedTimeStep) * adjustedTimeStep;
648
+ }
649
+ if (type === 'floor') {
650
+ return Math.floor(unixTime / adjustedTimeStep) * adjustedTimeStep;
651
+ }
652
+ if (type === 'ceil') {
653
+ return Math.ceil(unixTime / adjustedTimeStep) * adjustedTimeStep;
654
+ }
655
+ return undefined;
656
+ };
657
+ /* Adds DIM_ for certain dims */
658
+ var getCorrectWMSDimName = function getCorrectWMSDimName(origDimName) {
659
+ /* Adds DIM_ for dimensions other than height or time */
660
+ var upperCaseDimName = origDimName.toUpperCase();
661
+ if (upperCaseDimName === 'TIME') {
662
+ return upperCaseDimName;
663
+ }
664
+ if (upperCaseDimName === 'ELEVATION') {
665
+ return upperCaseDimName;
666
+ }
667
+ return "DIM_" + upperCaseDimName;
668
+ };
669
+
670
+ var utils = /*#__PURE__*/Object.freeze({
671
+ __proto__: null,
672
+ clearImageCacheForAllMaps: clearImageCacheForAllMaps,
673
+ generateLayerId: generateLayerId,
674
+ generateMapId: generateMapId,
675
+ generateTimesliderId: generateTimesliderId,
676
+ getCorrectWMSDimName: getCorrectWMSDimName,
677
+ getWMJSDimensionForLayerAndDimension: getWMJSDimensionForLayerAndDimension,
678
+ getWMJSMapById: getWMJSMapById,
679
+ getWMJSMapIds: getWMJSMapIds,
680
+ getWMJSTimeDimensionForLayerId: getWMJSTimeDimensionForLayerId,
681
+ getWMLayerById: getWMLayerById,
682
+ registerWMJSMap: registerWMJSMap,
683
+ registerWMLayer: registerWMLayer,
684
+ roundWithTimeStep: roundWithTimeStep,
685
+ unRegisterAllWMJSLayersAndMaps: unRegisterAllWMJSLayersAndMaps,
686
+ unRegisterWMJSLayer: unRegisterWMJSLayer,
687
+ unRegisterWMJSMap: unRegisterWMJSMap
688
+ });
689
+
489
690
  /* debug helper */
490
691
  var enableConsoleDebugging = false;
491
692
  var DebugType;
@@ -600,29 +801,16 @@ var URLEncode = function URLEncode(plaintext) {
600
801
  }
601
802
  return encoded;
602
803
  };
603
- /* Adds DIM_ for certain dims */
604
- var getCorrectWMSDimName = function getCorrectWMSDimName(origDimName) {
605
- /* Adds DIM_ for dimensions other than height or time */
606
- var upperCaseDimName = origDimName.toUpperCase();
607
- if (upperCaseDimName === 'TIME') {
608
- return upperCaseDimName;
609
- }
610
- if (upperCaseDimName === 'ELEVATION') {
611
- return upperCaseDimName;
612
- }
613
- return "DIM_" + upperCaseDimName;
614
- };
615
804
  /* Returns all dimensions with its current values as URL */
616
805
  var getMapDimURL = function getMapDimURL(layer, dimensionOverride) {
617
- var request = '';
806
+ var request = new URLSearchParams();
618
807
  layer.dimensions.forEach(function (layerDimension) {
619
808
  var overrideDim = dimensionOverride && dimensionOverride.find(function (d) {
620
809
  return d.name === layerDimension.name;
621
810
  });
622
811
  var dimension = layerDimension;
623
812
  var currentValue = overrideDim && dimension.getClosestValue(overrideDim.currentValue, true) || dimension.currentValue;
624
- request += "&" + getCorrectWMSDimName(dimension.name);
625
- request += "=" + URLEncode(currentValue);
813
+ request.append(getCorrectWMSDimName(dimension.name), currentValue);
626
814
  if (currentValue === WMDateOutSideRange || currentValue === WMDateTooEarlyString || currentValue === WMDateTooLateString) {
627
815
  throw new Error(WMDateOutSideRange);
628
816
  }
@@ -880,6 +1068,9 @@ var makeNodeLayerFromWMSGetCapabilityLayer = function makeNodeLayerFromWMSGetCap
880
1068
  crs: crs
881
1069
  };
882
1070
  };
1071
+ var getFirstPartOfDimensionValueSet = function getFirstPartOfDimensionValueSet(inputValue) {
1072
+ return (inputValue == null ? void 0 : inputValue.indexOf('/')) === -1 ? inputValue : inputValue.split('/')[0];
1073
+ };
883
1074
 
884
1075
  /**
885
1076
  * Returns the current time in ms
@@ -2054,7 +2245,7 @@ var getLegendGraphicURLForLayer = function getLegendGraphicURLForLayer(layer, wi
2054
2245
  }
2055
2246
  try {
2056
2247
  if (layer.legendIsDimensionDependent === true) {
2057
- legendURL += getMapDimURL(layer) + "&";
2248
+ legendURL += getMapDimURL(layer).toString() + "&";
2058
2249
  }
2059
2250
  if (layer.sldURL) {
2060
2251
  legendURL += "&SLD=" + URLEncode(layer.sldURL);
@@ -2312,6 +2503,7 @@ var WMBBOX = /*#__PURE__*/function () {
2312
2503
  this.setBBOX = this.setBBOX.bind(this);
2313
2504
  this.equals = this.equals.bind(this);
2314
2505
  this.toString = this.toString.bind(this);
2506
+ this.getExtent = this.getExtent.bind(this);
2315
2507
  this.setBBOX(left, bottom, right, top);
2316
2508
  }
2317
2509
  /**
@@ -2394,6 +2586,9 @@ var WMBBOX = /*#__PURE__*/function () {
2394
2586
  _proto.toString = function toString() {
2395
2587
  return this.left + "," + this.bottom + "," + this.right + "," + this.top;
2396
2588
  };
2589
+ _proto.getExtent = function getExtent() {
2590
+ return [this.left, this.bottom, this.right, this.top];
2591
+ };
2397
2592
  return WMBBOX;
2398
2593
  }();
2399
2594
 
@@ -3097,7 +3292,7 @@ var buildWMSGetMapRequest = function buildWMSGetMapRequest(layer, projection, di
3097
3292
  }
3098
3293
  // Handle dimensions
3099
3294
  try {
3100
- request += getMapDimURL(layer, dimensionOverride);
3295
+ request += getMapDimURL(layer, dimensionOverride).toString();
3101
3296
  } catch (e) {
3102
3297
  return undefined;
3103
3298
  }
@@ -3204,7 +3399,7 @@ var getWMSGetFeatureInfoRequestURL = function getWMSGetFeatureInfoRequestURL(lay
3204
3399
  request += "&INFO_FORMAT=" + format;
3205
3400
  request += '&STYLES=';
3206
3401
  try {
3207
- request += "&" + getMapDimURL(layer);
3402
+ request += "&" + getMapDimURL(layer).toString();
3208
3403
  } catch (e) {
3209
3404
  return undefined;
3210
3405
  }
@@ -4045,6 +4240,9 @@ var WMJSDimension = /*#__PURE__*/function () {
4045
4240
  this.getValueForIndex = this.getValueForIndex.bind(this);
4046
4241
  this.get = this.get.bind(this);
4047
4242
  this.getFirstValue = this.getFirstValue.bind(this);
4243
+ this.getMiddleValue = this.getMiddleValue.bind(this);
4244
+ this.getValueForSpecialString = this.getValueForSpecialString.bind(this);
4245
+ this.getExactMatchingValue = this.getExactMatchingValue.bind(this);
4048
4246
  this.getLastValue = this.getLastValue.bind(this);
4049
4247
  this.getDimInterval = this.getDimInterval.bind(this);
4050
4248
  this.getIndexForValue = this.getIndexForValue.bind(this);
@@ -4062,6 +4260,13 @@ var WMJSDimension = /*#__PURE__*/function () {
4062
4260
  }
4063
4261
  if (isDefined(config.values)) {
4064
4262
  this.values = config.values;
4263
+ if (!this.units) {
4264
+ // If unit was not set, check if this is a ISO8601 period.
4265
+ var lastItem = this.values.split('/').at(-1);
4266
+ if (lastItem != null && lastItem.startsWith('P') && (lastItem == null ? void 0 : lastItem.indexOf('T')) !== -1) {
4267
+ this.units = WMDateUnit;
4268
+ }
4269
+ }
4065
4270
  }
4066
4271
  if (isDefined(config.currentValue)) {
4067
4272
  this.currentValue = config.currentValue;
@@ -4417,48 +4622,54 @@ var WMJSDimension = /*#__PURE__*/function () {
4417
4622
  var timeToFind = new Date(timeStamp).toISOString().substring(0, 19) + "Z";
4418
4623
  return this.getClosestValue(timeToFind);
4419
4624
  };
4420
- _proto.getClosestValue = function getClosestValue(inputValue, evenWhenOutsideRange) {
4421
- if (evenWhenOutsideRange === void 0) {
4422
- evenWhenOutsideRange = false;
4423
- }
4424
- this.initialize();
4425
- if (!this._initialized) {
4426
- return inputValue;
4427
- }
4428
- var newValue = (inputValue == null ? void 0 : inputValue.indexOf('/')) === -1 ? inputValue : inputValue.split('/')[0];
4429
- switch (newValue) {
4625
+ _proto.getValueForSpecialString = function getValueForSpecialString(inputValue) {
4626
+ // Check for special cases like: 'current', 'default, '', 'middle', 'earliest' and 'latest'
4627
+ switch (inputValue) {
4430
4628
  case 'current':
4431
4629
  case 'default':
4432
4630
  case '':
4433
4631
  return this.defaultValue;
4434
4632
  case 'middle':
4435
- {
4436
- var middleIndex = Math.ceil(this.size() / 2) - 1;
4437
- return this.getValueForIndex(middleIndex > 0 ? middleIndex : 0);
4438
- }
4633
+ return this.getMiddleValue();
4439
4634
  case 'earliest':
4635
+ case WMDateTooEarlyString:
4440
4636
  return this.getFirstValue();
4441
4637
  case 'latest':
4638
+ case WMDateTooLateString:
4442
4639
  return this.getLastValue();
4443
4640
  }
4444
- var value = WMDateOutSideRange;
4641
+ return inputValue;
4642
+ };
4643
+ _proto.getExactMatchingValue = function getExactMatchingValue(inputValue) {
4445
4644
  try {
4446
- value = this.getValueForIndex(this.getIndexForValue(newValue) || -1);
4645
+ var index = this.getIndexForValue(inputValue);
4646
+ return this.getValueForIndex(index);
4447
4647
  } catch (e) {
4448
4648
  if (typeof e.message === 'number') {
4449
4649
  if (e.message === '0') {
4450
- value = WMDateTooEarlyString;
4451
- } else {
4452
- value = WMDateTooLateString;
4650
+ return WMDateTooEarlyString;
4453
4651
  }
4652
+ return WMDateTooLateString;
4454
4653
  }
4455
4654
  }
4456
- if (evenWhenOutsideRange && value === WMDateTooLateString) {
4457
- value = this.getLastValue();
4458
- } else if (evenWhenOutsideRange && value === WMDateTooEarlyString) {
4459
- value = this.getValueForIndex(0);
4655
+ return WMDateOutSideRange;
4656
+ };
4657
+ _proto.getClosestValue = function getClosestValue(inputValue, evenWhenOutsideRange) {
4658
+ if (evenWhenOutsideRange === void 0) {
4659
+ evenWhenOutsideRange = false;
4660
+ }
4661
+ this.initialize();
4662
+ if (!this._initialized || inputValue === undefined || inputValue === null) {
4663
+ return inputValue;
4460
4664
  }
4461
- return value;
4665
+ // Just make sure to return the first part if accidently start/stop/res was given.
4666
+ var firstPartValue = getFirstPartOfDimensionValueSet(inputValue);
4667
+ // Handle 'current', 'default, '', 'middle', 'earliest' and 'latest'
4668
+ var newValue = this.getValueForSpecialString(firstPartValue);
4669
+ // Get the exact value as present in the dimension values
4670
+ var matchingValue = this.getExactMatchingValue(newValue);
4671
+ // Handle 'current', 'default, '', 'middle', 'earliest' and 'latest'
4672
+ return evenWhenOutsideRange ? this.getValueForSpecialString(matchingValue) : matchingValue;
4462
4673
  }
4463
4674
  /**
4464
4675
  * Get dimension value for specified index
@@ -4528,6 +4739,10 @@ var WMJSDimension = /*#__PURE__*/function () {
4528
4739
  */;
4529
4740
  _proto.getFirstValue = function getFirstValue() {
4530
4741
  return this.get(0);
4742
+ };
4743
+ _proto.getMiddleValue = function getMiddleValue() {
4744
+ var middleIndex = Math.ceil(this.size() / 2) - 1;
4745
+ return this.getValueForIndex(middleIndex > 0 ? middleIndex : 0);
4531
4746
  }
4532
4747
  /**
4533
4748
  * Returns the last dimension value
@@ -7404,7 +7619,8 @@ var consoleErrorMessages = {
7404
7619
  serviceHasError: '--- service has an error ---',
7405
7620
  serviceUrlEmpty: 'Service URL is empty',
7406
7621
  unableToConnectServer: 'Unable to connect to the service.',
7407
- wmsServiceExceptionCode: 'WMS Service exception with code'
7622
+ wmsServiceExceptionCode: 'WMS Service exception with code',
7623
+ layerNotFoundInService: 'WMS Layer was not found in service'
7408
7624
  };
7409
7625
 
7410
7626
  /* *
@@ -8162,6 +8378,7 @@ var queryWMSLayer = /*#__PURE__*/function () {
8162
8378
  var WMLayer = /*#__PURE__*/function () {
8163
8379
  function WMLayer(options) {
8164
8380
  var _this = this;
8381
+ this.olSource = null; // Reference to olSource. Need to check if animation can go forward.
8165
8382
  this.init = this.init.bind(this);
8166
8383
  this.getLayerName = this.getLayerName.bind(this);
8167
8384
  this.toggleAutoUpdate = this.toggleAutoUpdate.bind(this);
@@ -8410,24 +8627,30 @@ var WMLayer = /*#__PURE__*/function () {
8410
8627
  /** ***************** Go through geographicBoundingBox **************** */
8411
8628
  configureGeographicBoundingBox(jsonlayer, this);
8412
8629
  this.queryable = jsonlayer.queryable || false;
8413
- this.getmapURL = privateGetWMSServiceInfo(getCapabilitiesJson, this.service).getmapURL;
8630
+ var serviceInfo = privateGetWMSServiceInfo(getCapabilitiesJson, this.service);
8631
+ this.getmapURL = serviceInfo.getmapURL;
8632
+ this.version = serviceInfo.version || WMSVersion.version130;
8414
8633
  this.title = jsonlayer.title;
8415
8634
  if (jsonlayer.crs) {
8416
- jsonlayer.crs.forEach(function (p) {
8635
+ jsonlayer.crs.forEach(function (projection) {
8417
8636
  var wmProjection = new WMProjection();
8418
- wmProjection.srs = p.name || '';
8419
- if (p.bbox) {
8637
+ wmProjection.srs = projection.name || '';
8638
+ if (projection.bbox) {
8420
8639
  var swapBBOX = _this4.version === WMSVersion.version130 && wmProjection.srs === PROJECTION.EPSG_4326.value && _this4.wms130bboxcompatibilitymode === false;
8421
8640
  if (swapBBOX) {
8422
- wmProjection.bbox.setBBOX(p.bbox.bottom, p.bbox.left, p.bbox.top, p.bbox.right);
8641
+ wmProjection.bbox.setBBOX(projection.bbox.bottom, projection.bbox.left, projection.bbox.top, projection.bbox.right);
8423
8642
  } else {
8424
- wmProjection.bbox.setBBOX(p.bbox.left, p.bbox.bottom, p.bbox.right, p.bbox.top);
8643
+ wmProjection.bbox.setBBOX(projection.bbox.left, projection.bbox.bottom, projection.bbox.right, projection.bbox.top);
8425
8644
  }
8426
8645
  }
8427
8646
  _this4.projectionProperties.push(wmProjection);
8428
8647
  });
8429
8648
  }
8430
8649
  this.isConfigured = true;
8650
+ } else {
8651
+ this.hasError = true;
8652
+ this.lastError = consoleErrorMessages.layerNotFoundInService + " - " + this.name;
8653
+ throw new Error(this.lastError);
8431
8654
  }
8432
8655
  }
8433
8656
  /** A Promise to parse the layer, it will fetch the WMS GetCapabilities document, configure the layer and resolve to a WMLayer object
@@ -8446,28 +8669,28 @@ var WMLayer = /*#__PURE__*/function () {
8446
8669
  forceReload = false;
8447
8670
  }
8448
8671
  this.hasError = false;
8449
- _context.prev = 2;
8672
+ this.lastError = '';
8673
+ _context.prev = 3;
8450
8674
  if (!forceReload) {
8451
- _context.next = 7;
8675
+ _context.next = 8;
8452
8676
  break;
8453
8677
  }
8454
8678
  // eslint-disable-next-line no-console
8455
8679
  console.log('invalidateWMSGetCapabilities');
8456
- _context.next = 7;
8680
+ _context.next = 8;
8457
8681
  return invalidateWMSGetCapabilities(this.service);
8458
- case 7:
8459
- _context.next = 9;
8682
+ case 8:
8683
+ _context.next = 10;
8460
8684
  return queryWMSGetCapabilities(this.service);
8461
- case 9:
8685
+ case 10:
8462
8686
  getCapabilities = _context.sent;
8463
8687
  this._setWMSGetCapabilities(getCapabilities);
8464
8688
  return _context.abrupt("return", this);
8465
- case 14:
8466
- _context.prev = 14;
8467
- _context.t0 = _context["catch"](2);
8689
+ case 15:
8690
+ _context.prev = 15;
8691
+ _context.t0 = _context["catch"](3);
8468
8692
  this.hasError = true;
8469
- message = consoleErrorMessages.noCapabilityElementFound + "[in " + this.service + "] with message [" + _context.t0.message + "]";
8470
- this.lastError = message;
8693
+ message = !this.lastError.length ? consoleErrorMessages.noCapabilityElementFound + "[in " + this.service + "] with message [" + _context.t0.message + "]" : this.lastError;
8471
8694
  this.title = consoleErrorMessages.serviceHasError;
8472
8695
  if (isDefined(this._options.failure)) {
8473
8696
  this._options.failure(this, message);
@@ -8477,7 +8700,7 @@ var WMLayer = /*#__PURE__*/function () {
8477
8700
  case "end":
8478
8701
  return _context.stop();
8479
8702
  }
8480
- }, _callee, this, [[2, 14]]);
8703
+ }, _callee, this, [[3, 15]]);
8481
8704
  }));
8482
8705
  function parseLayer(_x) {
8483
8706
  return _parseLayer.apply(this, arguments);
@@ -8529,8 +8752,6 @@ var WMLayer = /*#__PURE__*/function () {
8529
8752
  this.currentStyle = this.styles[0].name;
8530
8753
  this.legendGraphic = this.styles[0].legendURL;
8531
8754
  }
8532
- /* Check if this legenURL has already a Layer Property set. If so set the Layer to the name of this layer */
8533
- this.legendGraphic = getUriWithParam(this.legendGraphic);
8534
8755
  };
8535
8756
  _proto.getStyles = function getStyles() {
8536
8757
  if (this.styles) {
@@ -8547,21 +8768,21 @@ var WMLayer = /*#__PURE__*/function () {
8547
8768
  if (isDefined(this.styles) === false) {
8548
8769
  return undefined;
8549
8770
  }
8550
- for (var j = 0; j < this.styles.length; j += 1) {
8551
- if (this.styles[j].name === styleName) {
8771
+ for (var styleIt = 0; styleIt < this.styles.length; styleIt += 1) {
8772
+ if (this.styles[styleIt].name === styleName) {
8552
8773
  if (nextPrev === -1) {
8553
- j -= 1;
8774
+ styleIt -= 1;
8554
8775
  }
8555
8776
  if (nextPrev === 1) {
8556
- j += 1;
8777
+ styleIt += 1;
8557
8778
  }
8558
- if (j < 0) {
8559
- j = this.styles.length - 1;
8779
+ if (styleIt < 0) {
8780
+ styleIt = this.styles.length - 1;
8560
8781
  }
8561
- if (j > this.styles.length - 1) {
8562
- j = 0;
8782
+ if (styleIt > this.styles.length - 1) {
8783
+ styleIt = 0;
8563
8784
  }
8564
- return this.styles[j];
8785
+ return this.styles[styleIt];
8565
8786
  }
8566
8787
  }
8567
8788
  return undefined;
@@ -9731,6 +9952,25 @@ var radarGetCapabilities = {
9731
9952
  }
9732
9953
  };
9733
9954
 
9955
+ /* *
9956
+ * Licensed under the Apache License, Version 2.0 (the "License");
9957
+ * you may not use this file except in compliance with the License.
9958
+ * You may obtain a copy of the License at
9959
+ *
9960
+ * http://www.apache.org/licenses/LICENSE-2.0
9961
+ *
9962
+ * Unless required by applicable law or agreed to in writing, software
9963
+ * distributed under the License is distributed on an "AS IS" BASIS,
9964
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9965
+ * See the License for the specific language governing permissions and
9966
+ * limitations under the License.
9967
+ *
9968
+ * Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
9969
+ * Copyright 2025 - Finnish Meteorological Institute (FMI)
9970
+ * Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
9971
+ * */
9972
+ var WMS130GetCapabilitiesWithoutLegend = "<?xml version=\"1.0\"?>\n<WMS_Capabilities xmlns=\"http://www.opengis.net/wms\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" version=\"1.3.0\" updateSequence=\"1737582762\" xsi:schemaLocation=\"http://www.opengis.net/wms http://schemas.opengis.net/wms/1.3.0/capabilities_1_3_0.xsd\">\n <Service>\n <Name>WMS</Name>\n <Title>WMS Example</Title>\n <Abstract>Example abstract.</Abstract>\n <KeywordList/>\n <OnlineResource xlink:href=\"http://localhost:3000/wms?\" xlink:type=\"simple\"/>\n <Fees>none</Fees>\n <AccessConstraints>none</AccessConstraints>\n <LayerLimit>1</LayerLimit>\n <MaxWidth>8192</MaxWidth>\n <MaxHeight>8192</MaxHeight>\n </Service>\n <Capability>\n <Request>\n <GetCapabilities>\n <Format>text/xml</Format>\n <DCPType>\n <HTTP>\n <Get>\n <OnlineResource xlink:href=\"http://localhost:3000/wms?\" xlink:type=\"simple\"/>\n </Get>\n </HTTP>\n </DCPType>\n </GetCapabilities>\n <GetMap>\n <Format>image/png</Format>\n <DCPType>\n <HTTP>\n <Get>\n <OnlineResource xlink:href=\"http://localhost:3000/wms?\" xlink:type=\"simple\"/>\n </Get>\n </HTTP>\n </DCPType>\n </GetMap>\n </Request>\n <Exception>\n <Format>XML</Format>\n </Exception>\n <Layer>\n <Title>example</Title>\n <CRS>EPSG:3857</CRS>\n <EX_GeographicBoundingBox>\n <westBoundLongitude>-180</westBoundLongitude>\n <eastBoundLongitude>180</eastBoundLongitude>\n <southBoundLatitude>-90</southBoundLatitude>\n <northBoundLatitude>90</northBoundLatitude>\n </EX_GeographicBoundingBox>\n <BoundingBox CRS=\"EPSG:3857\" minx=\"-20037508.34\" miny=\"-20048966.1\" maxx=\"20037508.34\" maxy=\"20048966.1\"/>\n <Layer>\n <Name>my_name</Name>\n <Title>My Title</Title>\n <Abstract>My Abstract</Abstract>\n <Dimension name=\"time\" units=\"ISO8601\">2025-01-22T00:00:00Z</Dimension>\n <Style>\n <Name>standard</Name>\n <Title>Standard</Title>\n <!-- LegendURL>\n <Format>image/png</Format>\n <OnlineResource xlink:href=\"http://localhost:3000/jada\" xlink:type=\"simple\"/>\n </LegendURL -->\n </Style>\n </Layer>\n </Layer>\n </Capability>\n</WMS_Capabilities>\n";
9973
+
9734
9974
  var MOCK_URL_WITH_CHILDREN = 'https://mockUrlWithChildren.nl';
9735
9975
  var MOCK_URL_NO_CHILDREN = 'https://mockUrlNoChildren.nl';
9736
9976
  var MOCK_URL_WITH_NO_TITLE = 'https://mockUrlWithNoTitle.nl';
@@ -9742,6 +9982,8 @@ var MOCK_URL_SLOW_FAILS = 'https://slowreject.nl';
9742
9982
  var MOCK_URL_DEFAULT = 'https://defaultservice.nl';
9743
9983
  var MOCK_URL_DEFAULT2 = 'https://defaultservice2.nl';
9744
9984
  var MOCK_URL_HTTP = 'http://wmsservice.nl';
9985
+ var MOCK_URL_HARMONIE = 'WMS130GetCapabilitiesHarmN25';
9986
+ var MOCK_URL_WMS130_NOLEGEND = 'MOCK_URL_WMS130_NOLEGEND';
9745
9987
  var mockLayersNoChildren = {
9746
9988
  leaf: false,
9747
9989
  name: null,
@@ -10100,7 +10342,7 @@ var mockGetCapabilitiesFetcher = /*#__PURE__*/function () {
10100
10342
  while (1) switch (_context2.prev = _context2.next) {
10101
10343
  case 0:
10102
10344
  _context2.t0 = serviceUrl;
10103
- _context2.next = _context2.t0 === MOCK_URL_NO_CHILDREN ? 3 : _context2.t0 === MOCK_URL_WITH_CHILDREN ? 4 : _context2.t0 === MOCK_URL_WITH_SUBCATEGORY ? 5 : _context2.t0 === MOCK_URL_DEFAULT ? 6 : _context2.t0 === MOCK_URL_DEFAULT2 ? 7 : _context2.t0 === MOCK_URL_WITH_NO_TITLE ? 8 : _context2.t0 === MOCK_URL_WITH_NO_TITLE_OR_NAME ? 9 : _context2.t0 === 'https://testservice' ? 10 : _context2.t0 === 'testservice' ? 11 : _context2.t0 === 'WMS130GetCapabilitiesRadarTestWithoutInheritLayerprops' ? 12 : _context2.t0 === 'WMS130GetCapabilitiesRadarTestWithInheritLayerprops' ? 13 : _context2.t0 === 'WMS130GetCapabilitiesRadarTestWithInheritAndReplaceLayerprops' ? 14 : _context2.t0 === 'WMS111GetCapabilitiesGeoServicesRADAR' ? 15 : _context2.t0 === 'WMSSmartMet' ? 16 : _context2.t0 === 'WMS130GetCapabilitiesHarmN25' ? 17 : _context2.t0 === MOCK_URL_INVALID ? 18 : 19;
10345
+ _context2.next = _context2.t0 === MOCK_URL_NO_CHILDREN ? 3 : _context2.t0 === MOCK_URL_WITH_CHILDREN ? 4 : _context2.t0 === 'https://geoservices.knmi.nl/wms?dataset=RADAR&' ? 4 : _context2.t0 === MOCK_URL_WITH_SUBCATEGORY ? 5 : _context2.t0 === MOCK_URL_DEFAULT ? 6 : _context2.t0 === MOCK_URL_DEFAULT2 ? 7 : _context2.t0 === MOCK_URL_WITH_NO_TITLE ? 8 : _context2.t0 === MOCK_URL_WITH_NO_TITLE_OR_NAME ? 9 : _context2.t0 === 'https://testservice' ? 10 : _context2.t0 === 'testservice' ? 11 : _context2.t0 === 'WMS130GetCapabilitiesRadarTestWithoutInheritLayerprops' ? 12 : _context2.t0 === 'WMS130GetCapabilitiesRadarTestWithInheritLayerprops' ? 13 : _context2.t0 === 'WMS130GetCapabilitiesRadarTestWithInheritAndReplaceLayerprops' ? 14 : _context2.t0 === 'WMS111GetCapabilitiesGeoServicesRADAR' ? 15 : _context2.t0 === 'WMSSmartMet' ? 16 : _context2.t0 === MOCK_URL_HARMONIE ? 17 : _context2.t0 === MOCK_URL_WMS130_NOLEGEND ? 18 : _context2.t0 === MOCK_URL_INVALID ? 19 : 20;
10104
10346
  break;
10105
10347
  case 3:
10106
10348
  return _context2.abrupt("return", mockGetCapNoChilds);
@@ -10133,10 +10375,12 @@ var mockGetCapabilitiesFetcher = /*#__PURE__*/function () {
10133
10375
  case 17:
10134
10376
  return _context2.abrupt("return", WMXMLStringToJson(WMS130GetCapabilitiesHarmN25));
10135
10377
  case 18:
10136
- throw new Error("Url 'https://notawmsservice.nl' is not a wms service.");
10378
+ return _context2.abrupt("return", WMXMLStringToJson(WMS130GetCapabilitiesWithoutLegend));
10137
10379
  case 19:
10138
- return _context2.abrupt("return", mockGetCap);
10380
+ throw new Error("Url 'https://notawmsservice.nl' is not a wms service.");
10139
10381
  case 20:
10382
+ return _context2.abrupt("return", mockGetCap);
10383
+ case 21:
10140
10384
  case "end":
10141
10385
  return _context2.stop();
10142
10386
  }
@@ -10151,6 +10395,7 @@ var getCapabilities = /*#__PURE__*/Object.freeze({
10151
10395
  __proto__: null,
10152
10396
  MOCK_URL_DEFAULT: MOCK_URL_DEFAULT,
10153
10397
  MOCK_URL_DEFAULT2: MOCK_URL_DEFAULT2,
10398
+ MOCK_URL_HARMONIE: MOCK_URL_HARMONIE,
10154
10399
  MOCK_URL_HTTP: MOCK_URL_HTTP,
10155
10400
  MOCK_URL_INVALID: MOCK_URL_INVALID,
10156
10401
  MOCK_URL_NO_CHILDREN: MOCK_URL_NO_CHILDREN,
@@ -10160,6 +10405,7 @@ var getCapabilities = /*#__PURE__*/Object.freeze({
10160
10405
  MOCK_URL_WITH_NO_TITLE: MOCK_URL_WITH_NO_TITLE,
10161
10406
  MOCK_URL_WITH_NO_TITLE_OR_NAME: MOCK_URL_WITH_NO_TITLE_OR_NAME,
10162
10407
  MOCK_URL_WITH_SUBCATEGORY: MOCK_URL_WITH_SUBCATEGORY,
10408
+ MOCK_URL_WMS130_NOLEGEND: MOCK_URL_WMS130_NOLEGEND,
10163
10409
  mockGetCapabilitiesFetcher: mockGetCapabilitiesFetcher,
10164
10410
  mockGetLayersFlattenedFromService: mockGetLayersFlattenedFromService,
10165
10411
  mockGetLayersFromService: mockGetLayersFromService,
@@ -10539,193 +10785,6 @@ var tilesettings = {
10539
10785
  }
10540
10786
  };
10541
10787
 
10542
- /* *
10543
- * Licensed under the Apache License, Version 2.0 (the "License");
10544
- * you may not use this file except in compliance with the License.
10545
- * You may obtain a copy of the License at
10546
- *
10547
- * http://www.apache.org/licenses/LICENSE-2.0
10548
- *
10549
- * Unless required by applicable law or agreed to in writing, software
10550
- * distributed under the License is distributed on an "AS IS" BASIS,
10551
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10552
- * See the License for the specific language governing permissions and
10553
- * limitations under the License.
10554
- *
10555
- * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
10556
- * Copyright 2023 - Finnish Meteorological Institute (FMI)
10557
- * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
10558
- * */
10559
- var generatedLayerIds = 0;
10560
- var generateLayerId = function generateLayerId() {
10561
- generatedLayerIds += 1;
10562
- return "layerid_" + generatedLayerIds;
10563
- };
10564
- var generatedMapIds = 0;
10565
- var generateMapId = function generateMapId() {
10566
- generatedMapIds += 1;
10567
- return "mapid_" + generatedMapIds;
10568
- };
10569
- var generatedTimesliderIds = 0;
10570
- var generateTimesliderId = function generateTimesliderId() {
10571
- generatedTimesliderIds += 1;
10572
- return "timesliderid_" + generatedTimesliderIds;
10573
- };
10574
- /**
10575
- * Map for registering wmlayers with their id's
10576
- */
10577
- var registeredWMLayersForReactLayerId = {};
10578
- /**
10579
- * Registers a WMJSLayer in a lookuptable with a layerId
10580
- * @param {WMLayer} wmLayer
10581
- * @param {string} layerId
10582
- */
10583
- var registerWMLayer = function registerWMLayer(wmLayer, layerId) {
10584
- registeredWMLayersForReactLayerId[layerId] = wmLayer;
10585
- };
10586
- /**
10587
- * Get the WMLayer from the lookuptable with layerId
10588
- * @param {string} layerId
10589
- */
10590
- var getWMLayerById = function getWMLayerById(layerId) {
10591
- return registeredWMLayersForReactLayerId[layerId];
10592
- };
10593
- var unRegisterWMJSLayer = function unRegisterWMJSLayer(layerId) {
10594
- var layer = registeredWMLayersForReactLayerId[layerId];
10595
- if (layer) {
10596
- delete registeredWMLayersForReactLayerId[layerId];
10597
- }
10598
- };
10599
- var unRegisterAllWMJSLayersAndMaps = function unRegisterAllWMJSLayersAndMaps() {
10600
- var allLayerIds = Object.keys(registeredWMLayersForReactLayerId);
10601
- allLayerIds.forEach(function (layerId) {
10602
- unRegisterWMJSLayer(layerId);
10603
- });
10604
- var allMapIds = Object.keys(registeredWMMapForReactMapId);
10605
- allMapIds.forEach(function (mapId) {
10606
- unRegisterWMJSMap(mapId);
10607
- });
10608
- };
10609
- /**
10610
- * Map for registering wmlayers with their id's
10611
- */
10612
- var registeredWMMapForReactMapId = {};
10613
- /**
10614
- * Registers a IWMJSMap in a lookuptable with a wmjsMapId
10615
- * @param {IWMJSMap} wmjsMap
10616
- * @param {string} wmjsMapId
10617
- */
10618
- var registerWMJSMap = function registerWMJSMap(wmjsMap, wmjsMapId) {
10619
- if (registeredWMMapForReactMapId[wmjsMapId]) {
10620
- console.warn("Map with id " + wmjsMapId + " already made");
10621
- }
10622
- registeredWMMapForReactMapId[wmjsMapId] = wmjsMap;
10623
- };
10624
- var unRegisterWMJSMap = function unRegisterWMJSMap(wmjsMapId) {
10625
- var wmjsMap = registeredWMMapForReactMapId[wmjsMapId];
10626
- if (wmjsMap) {
10627
- wmjsMap.getListener().suspendEvents();
10628
- try {
10629
- wmjsMap.stopAnimating && wmjsMap.stopAnimating();
10630
- } catch (e) {
10631
- console.warn(e);
10632
- }
10633
- Object.keys(registeredWMLayersForReactLayerId).forEach(function (layerId) {
10634
- var wmLayer = getWMLayerById(layerId);
10635
- if (wmLayer.parentMap === wmjsMap) {
10636
- unRegisterWMJSLayer(layerId);
10637
- }
10638
- });
10639
- wmjsMap.destroy();
10640
- delete registeredWMMapForReactMapId[wmjsMapId];
10641
- }
10642
- };
10643
- /**
10644
- * Get the wmjsMap from the lookuptable with wmjsMapId
10645
- * @param {string} wmjsMapId
10646
- */
10647
- var getWMJSMapById = function getWMJSMapById(wmjsMapId) {
10648
- return registeredWMMapForReactMapId[wmjsMapId];
10649
- };
10650
- /**
10651
- * Get all wmjsMap id's from the lookuptable with wmjsMapId
10652
- * @param {string} wmjsMapId
10653
- */
10654
- var getWMJSMapIds = function getWMJSMapIds() {
10655
- return Object.keys(registeredWMMapForReactMapId);
10656
- };
10657
- /**
10658
- * Returns the WMJSDimension object for given layerId and dimension name
10659
- * @param layerId The layerId
10660
- * @param dimensionName The dimension to lookup
10661
- */
10662
- var getWMJSDimensionForLayerAndDimension = function getWMJSDimensionForLayerAndDimension(layerId, dimensionName) {
10663
- var wmLayer = getWMLayerById(layerId);
10664
- if (!wmLayer || !dimensionName) {
10665
- return undefined;
10666
- }
10667
- var wmjsDimension = wmLayer.getDimension(dimensionName);
10668
- if (!wmjsDimension) {
10669
- return undefined;
10670
- }
10671
- return wmjsDimension;
10672
- };
10673
- /**
10674
- * Gets the WMJSTimeDimension for given activeLayerId and dimensions list
10675
- * @param layerId: The layer id to search the WMJSDimension for
10676
- * @return: The WMJSDimension if found, otherwise null
10677
- */
10678
- var getWMJSTimeDimensionForLayerId = function getWMJSTimeDimensionForLayerId(layerId) {
10679
- var wmLayer = getWMLayerById(layerId);
10680
- if (!wmLayer) {
10681
- return null;
10682
- }
10683
- return wmLayer.getDimension('time');
10684
- };
10685
- /**
10686
- * Clears the image store for all maps
10687
- */
10688
- var clearImageCacheForAllMaps = function clearImageCacheForAllMaps() {
10689
- getWMJSMapIds().forEach(function (id) {
10690
- var map = getWMJSMapById(id);
10691
- if (map && !map.isDestroyed) {
10692
- map.clearImageCache();
10693
- }
10694
- });
10695
- };
10696
- var roundWithTimeStep = function roundWithTimeStep(unixTime, timeStep, type) {
10697
- var adjustedTimeStep = timeStep * 60;
10698
- if (!type || type === 'round') {
10699
- return Math.round(unixTime / adjustedTimeStep) * adjustedTimeStep;
10700
- }
10701
- if (type === 'floor') {
10702
- return Math.floor(unixTime / adjustedTimeStep) * adjustedTimeStep;
10703
- }
10704
- if (type === 'ceil') {
10705
- return Math.ceil(unixTime / adjustedTimeStep) * adjustedTimeStep;
10706
- }
10707
- return undefined;
10708
- };
10709
-
10710
- var utils = /*#__PURE__*/Object.freeze({
10711
- __proto__: null,
10712
- clearImageCacheForAllMaps: clearImageCacheForAllMaps,
10713
- generateLayerId: generateLayerId,
10714
- generateMapId: generateMapId,
10715
- generateTimesliderId: generateTimesliderId,
10716
- getWMJSDimensionForLayerAndDimension: getWMJSDimensionForLayerAndDimension,
10717
- getWMJSMapById: getWMJSMapById,
10718
- getWMJSMapIds: getWMJSMapIds,
10719
- getWMJSTimeDimensionForLayerId: getWMJSTimeDimensionForLayerId,
10720
- getWMLayerById: getWMLayerById,
10721
- registerWMJSMap: registerWMJSMap,
10722
- registerWMLayer: registerWMLayer,
10723
- roundWithTimeStep: roundWithTimeStep,
10724
- unRegisterAllWMJSLayersAndMaps: unRegisterAllWMJSLayersAndMaps,
10725
- unRegisterWMJSLayer: unRegisterWMJSLayer,
10726
- unRegisterWMJSMap: unRegisterWMJSMap
10727
- });
10728
-
10729
10788
  /* *
10730
10789
  * Licensed under the Apache License, Version 2.0 (the "License");
10731
10790
  * you may not use this file except in compliance with the License.
@@ -11166,4 +11225,4 @@ var privateWebMapUtils = {
11166
11225
  QUERYWMS_GETCAPABILITIES: QUERYWMS_GETCAPABILITIES
11167
11226
  };
11168
11227
 
11169
- export { DateInterval, DebugType, EVENT_GETCAPABILITIES_READY, EVENT_GETCAPABILITIES_START, LayerType, ParseISOTimeRangeDuration, URLDecode, URLEncode, WEBMAP_NAMESPACE, WMBBOX, WMDateOutSideRange, WMDateTooEarlyString, WMDateTooLateString, WMEmptyLayerName, WMEmptyLayerTitle, WMImage, WMImageEventType, WMImageStore, WMInvalidDateValues, WMJSDimension, WMJSMAP_LONLAT_EPSGCODE, WMJSMap, WMJScheckURL, WMLayer, WMListener, WMProj4Defs, WMProjection, WMSJSMAP_MINIMUM_MAP_HEIGHT, WMSJSMAP_MINIMUM_MAP_WIDTH, WMSVersion, WMXMLStringToJson, bgImageStoreLength, buildMapLayerDims, buildWMSGetMapRequest, clearImageCacheForAllMaps, debugLogger, detectLeftButton, detectRightButton, drawScaleBar, drawTextBG, generateLayerId, generateMapId, generateTimesliderId, getBBOXandProjString, getErrorsToDisplay, getGeoCoordFromLatLong, getGeoCoordFromPixelCoord, getLatLongFromPixelCoord, getLayerIndex, getLegendGraphicURLForLayer, getPixelCoordFromGeoCoord, getPixelCoordFromLatLong, getScaleBarProperties, getUriWithParam, getWMJSDimensionForLayerAndDimension, getWMJSMapById, getWMJSMapIds, getWMJSTimeDimensionForLayerId, getWMLayerById, getWMSGetFeatureInfoRequestURL, getWMSRequests, getWMSServiceId, handleDateUtilsISOString, invalidateWMSGetCapabilities, isDefined, isProjectionSupported, legendImageStore, legendImageStoreLength, mapImageStoreLength, mockGetCapabilities, parseISO8601DateToDate, parseISO8601IntervalToDateInterval, privateWebMapUtils, queryWMSGetCapabilities, queryWMSLayer, queryWMSLayers, queryWMSLayersTree, queryWMSServiceInfo, registerWMJSMap, registerWMLayer, roundWithTimeStep, setWMSGetCapabilitiesFetcher, tilesettings, toArray, unRegisterAllWMJSLayersAndMaps, unRegisterWMJSLayer, unRegisterWMJSMap, index as webmapTestSettings, webmapTranslations, utils as webmapUtils, wmServiceListener, wmsQueryClient };
11228
+ export { DateInterval, DebugType, EVENT_GETCAPABILITIES_READY, EVENT_GETCAPABILITIES_START, LayerType, ParseISOTimeRangeDuration, URLDecode, URLEncode, WEBMAP_NAMESPACE, WMBBOX, WMDateOutSideRange, WMDateTooEarlyString, WMDateTooLateString, WMDateUnit, WMEmptyLayerName, WMEmptyLayerTitle, WMImage, WMImageEventType, WMImageStore, WMInvalidDateValues, WMJSDimension, WMJSMAP_LONLAT_EPSGCODE, WMJSMap, WMJScheckURL, WMLayer, WMListener, WMProj4Defs, WMProjection, WMSJSMAP_MINIMUM_MAP_HEIGHT, WMSJSMAP_MINIMUM_MAP_WIDTH, WMSVersion, WMXMLStringToJson, bgImageStoreLength, buildMapLayerDims, buildWMSGetMapRequest, clearImageCacheForAllMaps, debugLogger, detectLeftButton, detectRightButton, drawScaleBar, drawTextBG, generateLayerId, generateMapId, generateTimesliderId, getBBOXandProjString, getCorrectWMSDimName, getErrorsToDisplay, getGeoCoordFromLatLong, getGeoCoordFromPixelCoord, getLatLongFromPixelCoord, getLayerIndex, getLegendGraphicURLForLayer, getMapDimURL, getPixelCoordFromGeoCoord, getPixelCoordFromLatLong, getScaleBarProperties, getUriWithParam, getWMJSDimensionForLayerAndDimension, getWMJSMapById, getWMJSMapIds, getWMJSTimeDimensionForLayerId, getWMLayerById, getWMSGetFeatureInfoRequestURL, getWMSRequests, getWMSServiceId, handleDateUtilsISOString, invalidateWMSGetCapabilities, isDefined, isProjectionSupported, legendImageStore, legendImageStoreLength, mapImageStoreLength, mockGetCapabilities, parseISO8601DateToDate, parseISO8601IntervalToDateInterval, privateWebMapUtils, queryWMSGetCapabilities, queryWMSLayer, queryWMSLayers, queryWMSLayersTree, queryWMSServiceInfo, registerWMJSMap, registerWMLayer, roundWithTimeStep, setWMSGetCapabilitiesFetcher, tilesettings, toArray, unRegisterAllWMJSLayersAndMaps, unRegisterWMJSLayer, unRegisterWMJSMap, index as webmapTestSettings, webmapTranslations, utils as webmapUtils, wmServiceListener, wmsQueryClient };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/webmap",
3
- "version": "10.1.0",
3
+ "version": "10.2.1-spike-ol.0",
4
4
  "description": "GeoWeb webmap library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -28,4 +28,5 @@ export default class WMBBOX implements Bbox {
28
28
  * Returns the current BBOX as a string, useful for generating WMS requests.
29
29
  */
30
30
  toString(): string;
31
+ getExtent(): [number, number, number, number];
31
32
  }
@@ -3,6 +3,7 @@ export declare const WMEmptyLayerTitle = "empty layer";
3
3
  export declare const WMDateOutSideRange = "outside range";
4
4
  export declare const WMDateTooEarlyString = "date too early";
5
5
  export declare const WMDateTooLateString = "date too late";
6
+ export declare const WMDateUnit = "ISO8601";
6
7
  export declare const WMInvalidDateValues: Set<string>;
7
8
  export declare const WMSJSMAP_MINIMUM_MAP_WIDTH = 4;
8
9
  export declare const WMSJSMAP_MINIMUM_MAP_HEIGHT = 4;
@@ -70,6 +70,8 @@ export default class WMJSDimension implements Dimension {
70
70
  addTimeRangeDurationToValue(value: string): string;
71
71
  setTimeRangeDuration(duration: string): void;
72
72
  getClosestValueForTime(timeStamp: number): string;
73
+ getValueForSpecialString(inputValue: string): string;
74
+ getExactMatchingValue(inputValue: string): string;
73
75
  getClosestValue(inputValue: string, evenWhenOutsideRange?: boolean): string;
74
76
  /**
75
77
  * Get dimension value for specified index
@@ -88,6 +90,7 @@ export default class WMJSDimension implements Dimension {
88
90
  * Returns the first dimension value
89
91
  */
90
92
  getFirstValue(): string;
93
+ getMiddleValue(): string;
91
94
  /**
92
95
  * Returns the last dimension value
93
96
  */
@@ -37,8 +37,7 @@ export declare const getMouseXCoordinate: (event: MouseEvent) => number;
37
37
  export declare const getMouseYCoordinate: (event: MouseEvent) => number;
38
38
  export declare const URLDecode: (encodedURL: string) => string;
39
39
  export declare const URLEncode: (plaintext: string) => string;
40
- export declare const getCorrectWMSDimName: (origDimName: string) => string;
41
- export declare const getMapDimURL: (layer: WMLayer, dimensionOverride?: Dimension[]) => string;
40
+ export declare const getMapDimURL: (layer: WMLayer, dimensionOverride?: Dimension[]) => URLSearchParams;
42
41
  /**
43
42
  * Parses url and then it it allows for setting / changing key value pairs in that URL (From https://stackoverflow.com/questions/5999118/how-can-i-add-or-update-a-query-string-parameter)
44
43
  * @param baseUrl
@@ -84,3 +83,4 @@ export declare function sortArrayOfObjectsByKey<ArrayOfObjects>(array: ArrayOfOb
84
83
  * @returns
85
84
  */
86
85
  export declare const makeNodeLayerFromWMSGetCapabilityLayer: (layer: WMSLayerFromGetCapabilities, path?: string[], isleaf?: boolean, nestedLayerPath?: LayerProps[]) => LayerProps;
86
+ export declare const getFirstPartOfDimensionValueSet: (inputValue: string) => string;
@@ -56,6 +56,7 @@ export default class WMLayer {
56
56
  geographicBoundingBox?: GeographicBoundingBox;
57
57
  geojson?: GeoJSON.FeatureCollection;
58
58
  currentRequestedGetMapURL?: string;
59
+ olSource: object | null;
59
60
  init(): void;
60
61
  constructor(options?: LayerOptions);
61
62
  getLayerName(): string;
@@ -1,5 +1,5 @@
1
1
  import type IWMJSMap from './IWMJSMap';
2
- import { isDefined, WMJScheckURL, URLDecode, URLEncode, toArray, debugLogger, DebugType, getUriWithParam } from './WMJSTools';
2
+ import { isDefined, WMJScheckURL, URLDecode, URLEncode, toArray, debugLogger, DebugType, getUriWithParam, getMapDimURL } from './WMJSTools';
3
3
  import { parseISO8601DateToDate, DateInterval, parseISO8601IntervalToDateInterval, ParseISOTimeRangeDuration } from './WMTime';
4
4
  import WMImage from './WMImage';
5
5
  import { getLegendGraphicURLForLayer, legendImageStore } from './WMLegend';
@@ -17,7 +17,7 @@ export { default as WMBBOX } from './WMBBOX';
17
17
  export type { Bbox } from './WMBBOX';
18
18
  export type { WMProjectionWH } from './WMProjection';
19
19
  export { WMProjection };
20
- export { IWMJSMap, WMJSMap, DateInterval, parseISO8601IntervalToDateInterval, ParseISOTimeRangeDuration, isDefined, WMJScheckURL, URLEncode, URLDecode, parseISO8601DateToDate, toArray, getLegendGraphicURLForLayer, legendImageStore, WMImage, debugLogger, DebugType, WMImageEventType, getUriWithParam, WMListener, WMXMLStringToJson, };
20
+ export { IWMJSMap, WMJSMap, DateInterval, parseISO8601IntervalToDateInterval, ParseISOTimeRangeDuration, isDefined, WMJScheckURL, URLEncode, URLDecode, parseISO8601DateToDate, toArray, getLegendGraphicURLForLayer, legendImageStore, WMImage, debugLogger, DebugType, WMImageEventType, getUriWithParam, getMapDimURL, WMListener, WMXMLStringToJson, };
21
21
  export * from './types';
22
22
  export * from './WMTimeTypes';
23
23
  export * from './WMConstants';
@@ -0,0 +1 @@
1
+ export declare const WMS130GetCapabilitiesWithoutLegend = "<?xml version=\"1.0\"?>\n<WMS_Capabilities xmlns=\"http://www.opengis.net/wms\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" version=\"1.3.0\" updateSequence=\"1737582762\" xsi:schemaLocation=\"http://www.opengis.net/wms http://schemas.opengis.net/wms/1.3.0/capabilities_1_3_0.xsd\">\n <Service>\n <Name>WMS</Name>\n <Title>WMS Example</Title>\n <Abstract>Example abstract.</Abstract>\n <KeywordList/>\n <OnlineResource xlink:href=\"http://localhost:3000/wms?\" xlink:type=\"simple\"/>\n <Fees>none</Fees>\n <AccessConstraints>none</AccessConstraints>\n <LayerLimit>1</LayerLimit>\n <MaxWidth>8192</MaxWidth>\n <MaxHeight>8192</MaxHeight>\n </Service>\n <Capability>\n <Request>\n <GetCapabilities>\n <Format>text/xml</Format>\n <DCPType>\n <HTTP>\n <Get>\n <OnlineResource xlink:href=\"http://localhost:3000/wms?\" xlink:type=\"simple\"/>\n </Get>\n </HTTP>\n </DCPType>\n </GetCapabilities>\n <GetMap>\n <Format>image/png</Format>\n <DCPType>\n <HTTP>\n <Get>\n <OnlineResource xlink:href=\"http://localhost:3000/wms?\" xlink:type=\"simple\"/>\n </Get>\n </HTTP>\n </DCPType>\n </GetMap>\n </Request>\n <Exception>\n <Format>XML</Format>\n </Exception>\n <Layer>\n <Title>example</Title>\n <CRS>EPSG:3857</CRS>\n <EX_GeographicBoundingBox>\n <westBoundLongitude>-180</westBoundLongitude>\n <eastBoundLongitude>180</eastBoundLongitude>\n <southBoundLatitude>-90</southBoundLatitude>\n <northBoundLatitude>90</northBoundLatitude>\n </EX_GeographicBoundingBox>\n <BoundingBox CRS=\"EPSG:3857\" minx=\"-20037508.34\" miny=\"-20048966.1\" maxx=\"20037508.34\" maxy=\"20048966.1\"/>\n <Layer>\n <Name>my_name</Name>\n <Title>My Title</Title>\n <Abstract>My Abstract</Abstract>\n <Dimension name=\"time\" units=\"ISO8601\">2025-01-22T00:00:00Z</Dimension>\n <Style>\n <Name>standard</Name>\n <Title>Standard</Title>\n <!-- LegendURL>\n <Format>image/png</Format>\n <OnlineResource xlink:href=\"http://localhost:3000/jada\" xlink:type=\"simple\"/>\n </LegendURL -->\n </Style>\n </Layer>\n </Layer>\n </Capability>\n</WMS_Capabilities>\n";
@@ -12,6 +12,8 @@ export declare const mockGetCapabilities: {
12
12
  MOCK_URL_DEFAULT: "https://defaultservice.nl";
13
13
  MOCK_URL_DEFAULT2: "https://defaultservice2.nl";
14
14
  MOCK_URL_HTTP: "http://wmsservice.nl";
15
+ MOCK_URL_HARMONIE: "WMS130GetCapabilitiesHarmN25";
16
+ MOCK_URL_WMS130_NOLEGEND: "MOCK_URL_WMS130_NOLEGEND";
15
17
  mockLayersNoChildren: {
16
18
  leaf: boolean;
17
19
  name: null;
@@ -10,6 +10,8 @@ export declare const MOCK_URL_SLOW_FAILS = "https://slowreject.nl";
10
10
  export declare const MOCK_URL_DEFAULT = "https://defaultservice.nl";
11
11
  export declare const MOCK_URL_DEFAULT2 = "https://defaultservice2.nl";
12
12
  export declare const MOCK_URL_HTTP = "http://wmsservice.nl";
13
+ export declare const MOCK_URL_HARMONIE = "WMS130GetCapabilitiesHarmN25";
14
+ export declare const MOCK_URL_WMS130_NOLEGEND = "MOCK_URL_WMS130_NOLEGEND";
13
15
  export declare const mockLayersNoChildren: {
14
16
  leaf: boolean;
15
17
  name: null;
@@ -8,4 +8,5 @@ export declare const consoleErrorMessages: {
8
8
  serviceUrlEmpty: string;
9
9
  unableToConnectServer: string;
10
10
  wmsServiceExceptionCode: string;
11
+ layerNotFoundInService: string;
11
12
  };
@@ -49,3 +49,4 @@ export declare const getWMJSTimeDimensionForLayerId: (layerId: string) => WMJSDi
49
49
  */
50
50
  export declare const clearImageCacheForAllMaps: () => void;
51
51
  export declare const roundWithTimeStep: (unixTime: number, timeStep: number, type?: string) => number;
52
+ export declare const getCorrectWMSDimName: (origDimName: string) => string;