@opengeoweb/webmap 10.2.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
@@ -8163,6 +8378,7 @@ var queryWMSLayer = /*#__PURE__*/function () {
8163
8378
  var WMLayer = /*#__PURE__*/function () {
8164
8379
  function WMLayer(options) {
8165
8380
  var _this = this;
8381
+ this.olSource = null; // Reference to olSource. Need to check if animation can go forward.
8166
8382
  this.init = this.init.bind(this);
8167
8383
  this.getLayerName = this.getLayerName.bind(this);
8168
8384
  this.toggleAutoUpdate = this.toggleAutoUpdate.bind(this);
@@ -8411,18 +8627,20 @@ var WMLayer = /*#__PURE__*/function () {
8411
8627
  /** ***************** Go through geographicBoundingBox **************** */
8412
8628
  configureGeographicBoundingBox(jsonlayer, this);
8413
8629
  this.queryable = jsonlayer.queryable || false;
8414
- 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;
8415
8633
  this.title = jsonlayer.title;
8416
8634
  if (jsonlayer.crs) {
8417
- jsonlayer.crs.forEach(function (p) {
8635
+ jsonlayer.crs.forEach(function (projection) {
8418
8636
  var wmProjection = new WMProjection();
8419
- wmProjection.srs = p.name || '';
8420
- if (p.bbox) {
8637
+ wmProjection.srs = projection.name || '';
8638
+ if (projection.bbox) {
8421
8639
  var swapBBOX = _this4.version === WMSVersion.version130 && wmProjection.srs === PROJECTION.EPSG_4326.value && _this4.wms130bboxcompatibilitymode === false;
8422
8640
  if (swapBBOX) {
8423
- 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);
8424
8642
  } else {
8425
- 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);
8426
8644
  }
8427
8645
  }
8428
8646
  _this4.projectionProperties.push(wmProjection);
@@ -8432,6 +8650,7 @@ var WMLayer = /*#__PURE__*/function () {
8432
8650
  } else {
8433
8651
  this.hasError = true;
8434
8652
  this.lastError = consoleErrorMessages.layerNotFoundInService + " - " + this.name;
8653
+ throw new Error(this.lastError);
8435
8654
  }
8436
8655
  }
8437
8656
  /** A Promise to parse the layer, it will fetch the WMS GetCapabilities document, configure the layer and resolve to a WMLayer object
@@ -8450,28 +8669,28 @@ var WMLayer = /*#__PURE__*/function () {
8450
8669
  forceReload = false;
8451
8670
  }
8452
8671
  this.hasError = false;
8453
- _context.prev = 2;
8672
+ this.lastError = '';
8673
+ _context.prev = 3;
8454
8674
  if (!forceReload) {
8455
- _context.next = 7;
8675
+ _context.next = 8;
8456
8676
  break;
8457
8677
  }
8458
8678
  // eslint-disable-next-line no-console
8459
8679
  console.log('invalidateWMSGetCapabilities');
8460
- _context.next = 7;
8680
+ _context.next = 8;
8461
8681
  return invalidateWMSGetCapabilities(this.service);
8462
- case 7:
8463
- _context.next = 9;
8682
+ case 8:
8683
+ _context.next = 10;
8464
8684
  return queryWMSGetCapabilities(this.service);
8465
- case 9:
8685
+ case 10:
8466
8686
  getCapabilities = _context.sent;
8467
8687
  this._setWMSGetCapabilities(getCapabilities);
8468
8688
  return _context.abrupt("return", this);
8469
- case 14:
8470
- _context.prev = 14;
8471
- _context.t0 = _context["catch"](2);
8689
+ case 15:
8690
+ _context.prev = 15;
8691
+ _context.t0 = _context["catch"](3);
8472
8692
  this.hasError = true;
8473
- message = consoleErrorMessages.noCapabilityElementFound + "[in " + this.service + "] with message [" + _context.t0.message + "]";
8474
- this.lastError = message;
8693
+ message = !this.lastError.length ? consoleErrorMessages.noCapabilityElementFound + "[in " + this.service + "] with message [" + _context.t0.message + "]" : this.lastError;
8475
8694
  this.title = consoleErrorMessages.serviceHasError;
8476
8695
  if (isDefined(this._options.failure)) {
8477
8696
  this._options.failure(this, message);
@@ -8481,7 +8700,7 @@ var WMLayer = /*#__PURE__*/function () {
8481
8700
  case "end":
8482
8701
  return _context.stop();
8483
8702
  }
8484
- }, _callee, this, [[2, 14]]);
8703
+ }, _callee, this, [[3, 15]]);
8485
8704
  }));
8486
8705
  function parseLayer(_x) {
8487
8706
  return _parseLayer.apply(this, arguments);
@@ -8533,8 +8752,6 @@ var WMLayer = /*#__PURE__*/function () {
8533
8752
  this.currentStyle = this.styles[0].name;
8534
8753
  this.legendGraphic = this.styles[0].legendURL;
8535
8754
  }
8536
- /* Check if this legenURL has already a Layer Property set. If so set the Layer to the name of this layer */
8537
- this.legendGraphic = getUriWithParam(this.legendGraphic);
8538
8755
  };
8539
8756
  _proto.getStyles = function getStyles() {
8540
8757
  if (this.styles) {
@@ -8551,21 +8768,21 @@ var WMLayer = /*#__PURE__*/function () {
8551
8768
  if (isDefined(this.styles) === false) {
8552
8769
  return undefined;
8553
8770
  }
8554
- for (var j = 0; j < this.styles.length; j += 1) {
8555
- if (this.styles[j].name === styleName) {
8771
+ for (var styleIt = 0; styleIt < this.styles.length; styleIt += 1) {
8772
+ if (this.styles[styleIt].name === styleName) {
8556
8773
  if (nextPrev === -1) {
8557
- j -= 1;
8774
+ styleIt -= 1;
8558
8775
  }
8559
8776
  if (nextPrev === 1) {
8560
- j += 1;
8777
+ styleIt += 1;
8561
8778
  }
8562
- if (j < 0) {
8563
- j = this.styles.length - 1;
8779
+ if (styleIt < 0) {
8780
+ styleIt = this.styles.length - 1;
8564
8781
  }
8565
- if (j > this.styles.length - 1) {
8566
- j = 0;
8782
+ if (styleIt > this.styles.length - 1) {
8783
+ styleIt = 0;
8567
8784
  }
8568
- return this.styles[j];
8785
+ return this.styles[styleIt];
8569
8786
  }
8570
8787
  }
8571
8788
  return undefined;
@@ -9735,6 +9952,25 @@ var radarGetCapabilities = {
9735
9952
  }
9736
9953
  };
9737
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
+
9738
9974
  var MOCK_URL_WITH_CHILDREN = 'https://mockUrlWithChildren.nl';
9739
9975
  var MOCK_URL_NO_CHILDREN = 'https://mockUrlNoChildren.nl';
9740
9976
  var MOCK_URL_WITH_NO_TITLE = 'https://mockUrlWithNoTitle.nl';
@@ -9747,6 +9983,7 @@ var MOCK_URL_DEFAULT = 'https://defaultservice.nl';
9747
9983
  var MOCK_URL_DEFAULT2 = 'https://defaultservice2.nl';
9748
9984
  var MOCK_URL_HTTP = 'http://wmsservice.nl';
9749
9985
  var MOCK_URL_HARMONIE = 'WMS130GetCapabilitiesHarmN25';
9986
+ var MOCK_URL_WMS130_NOLEGEND = 'MOCK_URL_WMS130_NOLEGEND';
9750
9987
  var mockLayersNoChildren = {
9751
9988
  leaf: false,
9752
9989
  name: null,
@@ -10105,7 +10342,7 @@ var mockGetCapabilitiesFetcher = /*#__PURE__*/function () {
10105
10342
  while (1) switch (_context2.prev = _context2.next) {
10106
10343
  case 0:
10107
10344
  _context2.t0 = serviceUrl;
10108
- _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_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;
10109
10346
  break;
10110
10347
  case 3:
10111
10348
  return _context2.abrupt("return", mockGetCapNoChilds);
@@ -10138,10 +10375,12 @@ var mockGetCapabilitiesFetcher = /*#__PURE__*/function () {
10138
10375
  case 17:
10139
10376
  return _context2.abrupt("return", WMXMLStringToJson(WMS130GetCapabilitiesHarmN25));
10140
10377
  case 18:
10141
- throw new Error("Url 'https://notawmsservice.nl' is not a wms service.");
10378
+ return _context2.abrupt("return", WMXMLStringToJson(WMS130GetCapabilitiesWithoutLegend));
10142
10379
  case 19:
10143
- return _context2.abrupt("return", mockGetCap);
10380
+ throw new Error("Url 'https://notawmsservice.nl' is not a wms service.");
10144
10381
  case 20:
10382
+ return _context2.abrupt("return", mockGetCap);
10383
+ case 21:
10145
10384
  case "end":
10146
10385
  return _context2.stop();
10147
10386
  }
@@ -10166,6 +10405,7 @@ var getCapabilities = /*#__PURE__*/Object.freeze({
10166
10405
  MOCK_URL_WITH_NO_TITLE: MOCK_URL_WITH_NO_TITLE,
10167
10406
  MOCK_URL_WITH_NO_TITLE_OR_NAME: MOCK_URL_WITH_NO_TITLE_OR_NAME,
10168
10407
  MOCK_URL_WITH_SUBCATEGORY: MOCK_URL_WITH_SUBCATEGORY,
10408
+ MOCK_URL_WMS130_NOLEGEND: MOCK_URL_WMS130_NOLEGEND,
10169
10409
  mockGetCapabilitiesFetcher: mockGetCapabilitiesFetcher,
10170
10410
  mockGetLayersFlattenedFromService: mockGetLayersFlattenedFromService,
10171
10411
  mockGetLayersFromService: mockGetLayersFromService,
@@ -10545,193 +10785,6 @@ var tilesettings = {
10545
10785
  }
10546
10786
  };
10547
10787
 
10548
- /* *
10549
- * Licensed under the Apache License, Version 2.0 (the "License");
10550
- * you may not use this file except in compliance with the License.
10551
- * You may obtain a copy of the License at
10552
- *
10553
- * http://www.apache.org/licenses/LICENSE-2.0
10554
- *
10555
- * Unless required by applicable law or agreed to in writing, software
10556
- * distributed under the License is distributed on an "AS IS" BASIS,
10557
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10558
- * See the License for the specific language governing permissions and
10559
- * limitations under the License.
10560
- *
10561
- * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
10562
- * Copyright 2023 - Finnish Meteorological Institute (FMI)
10563
- * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
10564
- * */
10565
- var generatedLayerIds = 0;
10566
- var generateLayerId = function generateLayerId() {
10567
- generatedLayerIds += 1;
10568
- return "layerid_" + generatedLayerIds;
10569
- };
10570
- var generatedMapIds = 0;
10571
- var generateMapId = function generateMapId() {
10572
- generatedMapIds += 1;
10573
- return "mapid_" + generatedMapIds;
10574
- };
10575
- var generatedTimesliderIds = 0;
10576
- var generateTimesliderId = function generateTimesliderId() {
10577
- generatedTimesliderIds += 1;
10578
- return "timesliderid_" + generatedTimesliderIds;
10579
- };
10580
- /**
10581
- * Map for registering wmlayers with their id's
10582
- */
10583
- var registeredWMLayersForReactLayerId = {};
10584
- /**
10585
- * Registers a WMJSLayer in a lookuptable with a layerId
10586
- * @param {WMLayer} wmLayer
10587
- * @param {string} layerId
10588
- */
10589
- var registerWMLayer = function registerWMLayer(wmLayer, layerId) {
10590
- registeredWMLayersForReactLayerId[layerId] = wmLayer;
10591
- };
10592
- /**
10593
- * Get the WMLayer from the lookuptable with layerId
10594
- * @param {string} layerId
10595
- */
10596
- var getWMLayerById = function getWMLayerById(layerId) {
10597
- return registeredWMLayersForReactLayerId[layerId];
10598
- };
10599
- var unRegisterWMJSLayer = function unRegisterWMJSLayer(layerId) {
10600
- var layer = registeredWMLayersForReactLayerId[layerId];
10601
- if (layer) {
10602
- delete registeredWMLayersForReactLayerId[layerId];
10603
- }
10604
- };
10605
- var unRegisterAllWMJSLayersAndMaps = function unRegisterAllWMJSLayersAndMaps() {
10606
- var allLayerIds = Object.keys(registeredWMLayersForReactLayerId);
10607
- allLayerIds.forEach(function (layerId) {
10608
- unRegisterWMJSLayer(layerId);
10609
- });
10610
- var allMapIds = Object.keys(registeredWMMapForReactMapId);
10611
- allMapIds.forEach(function (mapId) {
10612
- unRegisterWMJSMap(mapId);
10613
- });
10614
- };
10615
- /**
10616
- * Map for registering wmlayers with their id's
10617
- */
10618
- var registeredWMMapForReactMapId = {};
10619
- /**
10620
- * Registers a IWMJSMap in a lookuptable with a wmjsMapId
10621
- * @param {IWMJSMap} wmjsMap
10622
- * @param {string} wmjsMapId
10623
- */
10624
- var registerWMJSMap = function registerWMJSMap(wmjsMap, wmjsMapId) {
10625
- if (registeredWMMapForReactMapId[wmjsMapId]) {
10626
- console.warn("Map with id " + wmjsMapId + " already made");
10627
- }
10628
- registeredWMMapForReactMapId[wmjsMapId] = wmjsMap;
10629
- };
10630
- var unRegisterWMJSMap = function unRegisterWMJSMap(wmjsMapId) {
10631
- var wmjsMap = registeredWMMapForReactMapId[wmjsMapId];
10632
- if (wmjsMap) {
10633
- wmjsMap.getListener().suspendEvents();
10634
- try {
10635
- wmjsMap.stopAnimating && wmjsMap.stopAnimating();
10636
- } catch (e) {
10637
- console.warn(e);
10638
- }
10639
- Object.keys(registeredWMLayersForReactLayerId).forEach(function (layerId) {
10640
- var wmLayer = getWMLayerById(layerId);
10641
- if (wmLayer.parentMap === wmjsMap) {
10642
- unRegisterWMJSLayer(layerId);
10643
- }
10644
- });
10645
- wmjsMap.destroy();
10646
- delete registeredWMMapForReactMapId[wmjsMapId];
10647
- }
10648
- };
10649
- /**
10650
- * Get the wmjsMap from the lookuptable with wmjsMapId
10651
- * @param {string} wmjsMapId
10652
- */
10653
- var getWMJSMapById = function getWMJSMapById(wmjsMapId) {
10654
- return registeredWMMapForReactMapId[wmjsMapId];
10655
- };
10656
- /**
10657
- * Get all wmjsMap id's from the lookuptable with wmjsMapId
10658
- * @param {string} wmjsMapId
10659
- */
10660
- var getWMJSMapIds = function getWMJSMapIds() {
10661
- return Object.keys(registeredWMMapForReactMapId);
10662
- };
10663
- /**
10664
- * Returns the WMJSDimension object for given layerId and dimension name
10665
- * @param layerId The layerId
10666
- * @param dimensionName The dimension to lookup
10667
- */
10668
- var getWMJSDimensionForLayerAndDimension = function getWMJSDimensionForLayerAndDimension(layerId, dimensionName) {
10669
- var wmLayer = getWMLayerById(layerId);
10670
- if (!wmLayer || !dimensionName) {
10671
- return undefined;
10672
- }
10673
- var wmjsDimension = wmLayer.getDimension(dimensionName);
10674
- if (!wmjsDimension) {
10675
- return undefined;
10676
- }
10677
- return wmjsDimension;
10678
- };
10679
- /**
10680
- * Gets the WMJSTimeDimension for given activeLayerId and dimensions list
10681
- * @param layerId: The layer id to search the WMJSDimension for
10682
- * @return: The WMJSDimension if found, otherwise null
10683
- */
10684
- var getWMJSTimeDimensionForLayerId = function getWMJSTimeDimensionForLayerId(layerId) {
10685
- var wmLayer = getWMLayerById(layerId);
10686
- if (!wmLayer) {
10687
- return null;
10688
- }
10689
- return wmLayer.getDimension('time');
10690
- };
10691
- /**
10692
- * Clears the image store for all maps
10693
- */
10694
- var clearImageCacheForAllMaps = function clearImageCacheForAllMaps() {
10695
- getWMJSMapIds().forEach(function (id) {
10696
- var map = getWMJSMapById(id);
10697
- if (map && !map.isDestroyed) {
10698
- map.clearImageCache();
10699
- }
10700
- });
10701
- };
10702
- var roundWithTimeStep = function roundWithTimeStep(unixTime, timeStep, type) {
10703
- var adjustedTimeStep = timeStep * 60;
10704
- if (!type || type === 'round') {
10705
- return Math.round(unixTime / adjustedTimeStep) * adjustedTimeStep;
10706
- }
10707
- if (type === 'floor') {
10708
- return Math.floor(unixTime / adjustedTimeStep) * adjustedTimeStep;
10709
- }
10710
- if (type === 'ceil') {
10711
- return Math.ceil(unixTime / adjustedTimeStep) * adjustedTimeStep;
10712
- }
10713
- return undefined;
10714
- };
10715
-
10716
- var utils = /*#__PURE__*/Object.freeze({
10717
- __proto__: null,
10718
- clearImageCacheForAllMaps: clearImageCacheForAllMaps,
10719
- generateLayerId: generateLayerId,
10720
- generateMapId: generateMapId,
10721
- generateTimesliderId: generateTimesliderId,
10722
- getWMJSDimensionForLayerAndDimension: getWMJSDimensionForLayerAndDimension,
10723
- getWMJSMapById: getWMJSMapById,
10724
- getWMJSMapIds: getWMJSMapIds,
10725
- getWMJSTimeDimensionForLayerId: getWMJSTimeDimensionForLayerId,
10726
- getWMLayerById: getWMLayerById,
10727
- registerWMJSMap: registerWMJSMap,
10728
- registerWMLayer: registerWMLayer,
10729
- roundWithTimeStep: roundWithTimeStep,
10730
- unRegisterAllWMJSLayersAndMaps: unRegisterAllWMJSLayersAndMaps,
10731
- unRegisterWMJSLayer: unRegisterWMJSLayer,
10732
- unRegisterWMJSMap: unRegisterWMJSMap
10733
- });
10734
-
10735
10788
  /* *
10736
10789
  * Licensed under the Apache License, Version 2.0 (the "License");
10737
10790
  * you may not use this file except in compliance with the License.
@@ -11172,4 +11225,4 @@ var privateWebMapUtils = {
11172
11225
  QUERYWMS_GETCAPABILITIES: QUERYWMS_GETCAPABILITIES
11173
11226
  };
11174
11227
 
11175
- 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.2.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";
@@ -13,6 +13,7 @@ export declare const mockGetCapabilities: {
13
13
  MOCK_URL_DEFAULT2: "https://defaultservice2.nl";
14
14
  MOCK_URL_HTTP: "http://wmsservice.nl";
15
15
  MOCK_URL_HARMONIE: "WMS130GetCapabilitiesHarmN25";
16
+ MOCK_URL_WMS130_NOLEGEND: "MOCK_URL_WMS130_NOLEGEND";
16
17
  mockLayersNoChildren: {
17
18
  leaf: boolean;
18
19
  name: null;
@@ -11,6 +11,7 @@ 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
13
  export declare const MOCK_URL_HARMONIE = "WMS130GetCapabilitiesHarmN25";
14
+ export declare const MOCK_URL_WMS130_NOLEGEND = "MOCK_URL_WMS130_NOLEGEND";
14
15
  export declare const mockLayersNoChildren: {
15
16
  leaf: boolean;
16
17
  name: null;
@@ -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;