@opengeoweb/webmap 9.6.0 → 9.8.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
@@ -491,6 +491,21 @@ var WMSVersion = {
491
491
  version130: '1.3.0'
492
492
  };
493
493
  var WMProj4Defs = [['EPSG:4326', '+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees'], ['EPSG:4269', '+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees'], ['EPSG:3575', '+proj=laea +lat_0=90 +lon_0=10 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs'], ['EPSG:3785', '+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'], ['EPSG:3857', '+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'], ['EPSG:3411', '+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'], ['EPSG:3412', '+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'], ['EPSG:28992', '+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 <>'], ['EPSG:32661', '+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'], ['EPSG:102100', '+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'], ['EPSG:3067', '+proj=utm +zone=35 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs']];
494
+ var epsgDescriptionLookup = {
495
+ 'EPSG:3411': 'NSIDC Sea Ice Polar Stereographic North',
496
+ 'EPSG:3412': 'NSIDC Sea Ice Polar Stereographic South',
497
+ 'EPSG:3575': 'Lambert azimuthal equal-area projection Europe',
498
+ 'EPSG:3785': 'Mercator (deprecated)',
499
+ 'EPSG:3857': 'Mercator',
500
+ 'EPSG:4258': 'ETRS89',
501
+ 'EPSG:4326': 'World Lat lon WGS84',
502
+ 'CRS:84': 'World Lat lon WGS84',
503
+ 'EPSG:25831': 'ETRS89 / UTM zone 31N',
504
+ 'EPSG:25832': 'ETRS89 / UTM zone 32N',
505
+ 'EPSG:28992': 'Dutch Amersfoort / RD New',
506
+ 'EPSG:32661': 'Polar Stereographic WGS 84 / UPS North',
507
+ 'EPSG:3067': 'ETRS89 / TM35FIN(E,N) -- Finland'
508
+ };
494
509
  var mapImageStoreLength = 1000;
495
510
  var bgImageStoreLength = 360;
496
511
  var legendImageStoreLength = 500;
@@ -3324,6 +3339,8 @@ var WMJSDimension = /*#__PURE__*/function () {
3324
3339
  this.getValue = this.getValue.bind(this);
3325
3340
  this.setValue = this.setValue.bind(this);
3326
3341
  this.getValues = this.getValues.bind(this);
3342
+ this.processCompressedRefTimeValues = this.processCompressedRefTimeValues.bind(this);
3343
+ this.createTimeStepsArray = this.createTimeStepsArray.bind(this);
3327
3344
  this.setClosestValue = this.setClosestValue.bind(this);
3328
3345
  this.addTimeRangeDurationToValue = this.addTimeRangeDurationToValue.bind(this);
3329
3346
  this.setTimeRangeDuration = this.setTimeRangeDuration.bind(this);
@@ -3458,8 +3475,12 @@ var WMJSDimension = /*#__PURE__*/function () {
3458
3475
  if (ogcdimvalues.indexOf('/') > 0 && ogcdimvalues.indexOf(',') === -1) {
3459
3476
  this._type = 'timestartstopres';
3460
3477
  this._timeRangeDurationDate = new ParseISOTimeRangeDuration(ogcdimvalues);
3478
+ this.processCompressedRefTimeValues(ogcdimvalues);
3461
3479
  } else {
3462
3480
  this._type = 'timevalues';
3481
+ if (ogcdimvalues.indexOf('/') > 0 && ogcdimvalues.indexOf(',') === -1 && this.name === 'reference_time') {
3482
+ this.processCompressedRefTimeValues(ogcdimvalues);
3483
+ }
3463
3484
  }
3464
3485
  } else {
3465
3486
  this._type = 'anyvalue';
@@ -3484,6 +3505,7 @@ var WMJSDimension = /*#__PURE__*/function () {
3484
3505
  _this._allValues.push(dataAtTimeStep.toString());
3485
3506
  }
3486
3507
  }
3508
+ _this.processCompressedRefTimeValues(ogcdimvalues);
3487
3509
  } else {
3488
3510
  var start = parseFloat(valuesRanged[0]);
3489
3511
  var stop = parseFloat(valuesRanged[1]);
@@ -3561,6 +3583,52 @@ var WMJSDimension = /*#__PURE__*/function () {
3561
3583
  value = this.addTimeRangeDurationToValue(value);
3562
3584
  return value;
3563
3585
  }
3586
+ }, {
3587
+ key: "processCompressedRefTimeValues",
3588
+ value: function processCompressedRefTimeValues(ogcdimvalues) {
3589
+ var _this2 = this;
3590
+ if (this.name === 'reference_time') {
3591
+ // Split the format start/stop/res
3592
+ var splitValues = ogcdimvalues.split(',');
3593
+ var timeRanges = splitValues.filter(function (value) {
3594
+ return value.includes('/') && value.includes('P');
3595
+ });
3596
+ var allValues = [];
3597
+ // Get all the ranges between start and stop time
3598
+ timeRanges.forEach(function (timeRange) {
3599
+ var partTimeRanges = new ParseISOTimeRangeDuration(timeRange);
3600
+ var newValues = _this2.createTimeStepsArray(partTimeRanges);
3601
+ allValues = allValues.concat(newValues);
3602
+ });
3603
+ // Some ogcdimvalues deliver the interval for arbitrary timesteps which may stop the array
3604
+ // In that case, get the last date to set as dimMaxValue
3605
+ var lastTimeRangeString = splitValues[splitValues.length - 1];
3606
+ if (lastTimeRangeString.includes('/') && lastTimeRangeString.includes('P')) {
3607
+ var _lastTimeRangeString$ = lastTimeRangeString.split('/'),
3608
+ _lastTimeRangeString$2 = _slicedToArray(_lastTimeRangeString$, 2),
3609
+ endDateString = _lastTimeRangeString$2[1];
3610
+ this.dimMaxValue = endDateString;
3611
+ }
3612
+ this.values = allValues.join(',');
3613
+ }
3614
+ }
3615
+ // eslint-disable-next-line class-methods-use-this
3616
+ }, {
3617
+ key: "createTimeStepsArray",
3618
+ value: function createTimeStepsArray(partTimeRanges) {
3619
+ return Array.from({
3620
+ length: partTimeRanges.getTimeSteps()
3621
+ }, function (_, i) {
3622
+ var dataAtTimeStep = partTimeRanges.getDateAtTimeStep(i);
3623
+ if (dataAtTimeStep && !isNaN(dataAtTimeStep.getTime())) {
3624
+ var isoDateString = dataAtTimeStep.toISO8601();
3625
+ return isoDateString;
3626
+ }
3627
+ return null;
3628
+ }).filter(function (dateString) {
3629
+ return dateString !== null;
3630
+ });
3631
+ }
3564
3632
  /**
3565
3633
  * Set current value of this dimension
3566
3634
  * @param value The new value for this dimension (string)
@@ -3788,7 +3856,7 @@ var WMJSDimension = /*#__PURE__*/function () {
3788
3856
  }, {
3789
3857
  key: "getIndexForValue",
3790
3858
  value: function getIndexForValue(value) {
3791
- var _this2 = this;
3859
+ var _this3 = this;
3792
3860
  var outSideOfRangeFlag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
3793
3861
  this.initialize();
3794
3862
  if (typeof value === 'string') {
@@ -3817,7 +3885,7 @@ var WMJSDimension = /*#__PURE__*/function () {
3817
3885
  var startTime = null;
3818
3886
  var stopTime = null;
3819
3887
  this._allValues.forEach(function (_, valueIndex) {
3820
- var currentTime = _this2._allDates[valueIndex].getTime();
3888
+ var currentTime = _this3._allDates[valueIndex].getTime();
3821
3889
  if (currentTime < startTime || startTime === null) {
3822
3890
  startTime = currentTime;
3823
3891
  }
@@ -4033,8 +4101,8 @@ var MapPin = /*#__PURE__*/function () {
4033
4101
  * See the License for the specific language governing permissions and
4034
4102
  * limitations under the License.
4035
4103
  *
4036
- * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
4037
- * Copyright 2021 - Finnish Meteorological Institute (FMI)
4104
+ * Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
4105
+ * Copyright 2024 - Finnish Meteorological Institute (FMI)
4038
4106
  * */
4039
4107
  var getBBOXandProjString = function getBBOXandProjString(map, layer) {
4040
4108
  var request = '';
@@ -4067,6 +4135,7 @@ var buildWMSGetMapRequest = function buildWMSGetMapRequest(map, layer, dimension
4067
4135
  var _map$getSize = map.getSize(),
4068
4136
  width = _map$getSize.width,
4069
4137
  height = _map$getSize.height;
4138
+ // eslint-disable-next-line no-param-reassign
4070
4139
  (_a = layer.format) !== null && _a !== void 0 ? _a : layer.format = 'image/png';
4071
4140
  // GetFeatureInfo timeseries in the mapview
4072
4141
  if (srs === 'GFI:TIME_ELEVATION') {
@@ -4143,6 +4212,12 @@ var buildWMSGetMapRequest = function buildWMSGetMapRequest(map, layer, dimension
4143
4212
  headers: layer.headers
4144
4213
  };
4145
4214
  };
4215
+ var isProjectionSupported = function isProjectionSupported(srs) {
4216
+ var proj4Defintions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : WMProj4Defs;
4217
+ return proj4Defintions.find(function (proj4Def) {
4218
+ return proj4Def[0] === srs;
4219
+ }) !== undefined;
4220
+ };
4146
4221
 
4147
4222
  var SCALE_DELAY = 10;
4148
4223
  var ZOOMED_CALLBACK_DELAY = 500;
@@ -4530,6 +4605,7 @@ var WMJSMap = /*#__PURE__*/function () {
4530
4605
  this.loadingDiv = document.createElement('div');
4531
4606
  this.loadingDiv.className = 'WMJSDivBuffer-loading';
4532
4607
  this.enableAutoPrefetching = true;
4608
+ this.isProjectionSupported = isProjectionSupported.bind(this);
4533
4609
  this.init();
4534
4610
  }
4535
4611
  _createClass(WMJSMap, [{
@@ -10110,4 +10186,4 @@ var getCapabilities = /*#__PURE__*/Object.freeze({
10110
10186
  getLayersFlattenedFromService: getLayersFlattenedFromService
10111
10187
  });
10112
10188
 
10113
- export { DateInterval, DebugType, EPSGCode, I18n, LayerType, ParseISOTimeRangeDuration, URLDecode, URLEncode, WMBBOX, WMDateOutSideRange, WMDateTooEarlyString, WMDateTooLateString, WMEmptyLayerName, WMEmptyLayerTitle, WMGetServiceFromStore, WMImage, WMImageEventType, WMJSDimension, WMJSMap, WMJSService, WMJScheckURL, WMLayer, buildWMSGetMapRequest, clearImageCache, debugLogger, generateLayerId, generateMapId, generateTimesliderId, getCapabilities, getLegendGraphicURLForLayer, getMapImageStore, getUriWithParam, getWMJSDimensionForLayerAndDimension, getWMJSMapById, getWMJSMapIds, getWMJSTimeDimensionForLayerId, getWMLayerById, handleMomentISOString, isDefined, legendImageStore, mockGetCapabilities, parseISO8601DateToDate, parseISO8601IntervalToDateInterval, registerWMJSMap, registerWMLayer, tilesettings, toArray, unRegisterAllWMJSLayersAndMaps, unRegisterWMJSLayer, unRegisterWMJSMap, testSettings as webmapTestSettings, utils as webmapUtils };
10189
+ export { DateInterval, DebugType, EPSGCode, I18n, LayerType, ParseISOTimeRangeDuration, URLDecode, URLEncode, WMBBOX, WMDateOutSideRange, WMDateTooEarlyString, WMDateTooLateString, WMEmptyLayerName, WMEmptyLayerTitle, WMGetServiceFromStore, WMImage, WMImageEventType, WMJSDimension, WMJSMap, WMJSService, WMJScheckURL, WMLayer, WMProj4Defs, WMSVersion, bgImageStoreLength, buildWMSGetMapRequest, clearImageCache, debugLogger, epsgDescriptionLookup, generateLayerId, generateMapId, generateTimesliderId, getBBOXandProjString, getCapabilities, getLegendGraphicURLForLayer, getMapImageStore, getUriWithParam, getWMJSDimensionForLayerAndDimension, getWMJSMapById, getWMJSMapIds, getWMJSTimeDimensionForLayerId, getWMLayerById, handleMomentISOString, isDefined, isProjectionSupported, legendImageStore, legendImageStoreLength, mapImageStoreLength, mockGetCapabilities, parseISO8601DateToDate, parseISO8601IntervalToDateInterval, registerWMJSMap, registerWMLayer, tilesettings, toArray, unRegisterAllWMJSLayersAndMaps, unRegisterWMJSLayer, unRegisterWMJSMap, testSettings as webmapTestSettings, utils as webmapUtils };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/webmap",
3
- "version": "9.6.0",
3
+ "version": "9.8.0",
4
4
  "description": "GeoWeb webmap library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -1,4 +1,5 @@
1
1
  import { Dimension, TimeInterval } from './types';
2
+ import { ParseISOTimeRangeDuration } from './WMTime';
2
3
  import { CustomDate } from './WMTimeTypes';
3
4
  /**
4
5
  * Re-formats moment's isoString to the string that is expected by WMJSDimension (for time).
@@ -51,6 +52,8 @@ export default class WMJSDimension implements Dimension {
51
52
  * If a ISO8601 period is set, the getValue will return a timeRange using addTimeRangeDurationToValue instead of a single value
52
53
  */
53
54
  getValue(): string;
55
+ processCompressedRefTimeValues(ogcdimvalues: string): void;
56
+ createTimeStepsArray(partTimeRanges: ParseISOTimeRangeDuration): string[];
54
57
  /**
55
58
  * Set current value of this dimension
56
59
  * @param value The new value for this dimension (string)
@@ -112,6 +112,7 @@ export default class WMJSMap {
112
112
  private drawPending?;
113
113
  private needsRedraw;
114
114
  private buildLayerDimsBusy;
115
+ isProjectionSupported: (srs: string) => boolean;
115
116
  constructor(_element: HTMLElement);
116
117
  setWMTileRendererTileSettings(_WMTileRendererTileSettings: unknown): void;
117
118
  /**
@@ -6,3 +6,4 @@ export declare const buildWMSGetMapRequest: (map: WMJSMap, layer: WMLayer, dimen
6
6
  url: string;
7
7
  headers: Headers[];
8
8
  } | undefined;
9
+ export declare const isProjectionSupported: (srs: string, proj4Defintions?: string[][]) => boolean;
@@ -1,19 +1,19 @@
1
1
  import WMJSMap, { clearImageCache } from './WMJSMap';
2
2
  import { isDefined, WMJScheckURL, URLDecode, URLEncode, toArray, debugLogger, DebugType, getUriWithParam } from './WMJSTools';
3
3
  import WMGetServiceFromStore from './WMGetServiceFromStore';
4
- import { WMDateOutSideRange, WMDateTooEarlyString, WMDateTooLateString, WMEmptyLayerName, WMEmptyLayerTitle } from './WMConstants';
5
4
  import { parseISO8601DateToDate, DateInterval, parseISO8601IntervalToDateInterval, ParseISOTimeRangeDuration } from './WMTime';
6
5
  import I18n from '../utils/I18n/lang.en';
7
6
  import WMImage from './WMImage';
8
7
  import { getLegendGraphicURLForLayer, legendImageStore } from './WMLegend';
9
8
  import { getMapImageStore, WMImageEventType } from './WMImageStore';
10
9
  import { WMJSService } from './WMJSService';
11
- import { buildWMSGetMapRequest } from './WMJSMapHelpers';
12
10
  export { default as WMJSDimension, handleMomentISOString, } from './WMJSDimension';
13
11
  export { default as WMLayer, LayerType } from './WMLayer';
14
12
  export type { LayerOptions, LayerFoundation } from './WMLayer';
15
13
  export { default as WMBBOX } from './WMBBOX';
16
14
  export type { Bbox } from './WMBBOX';
17
- export { WMJSMap, DateInterval, parseISO8601IntervalToDateInterval, ParseISOTimeRangeDuration, isDefined, WMGetServiceFromStore, WMJScheckURL, URLEncode, URLDecode, WMDateOutSideRange, WMDateTooEarlyString, WMDateTooLateString, WMEmptyLayerName, WMEmptyLayerTitle, parseISO8601DateToDate, I18n, toArray, getLegendGraphicURLForLayer, legendImageStore, WMImage, debugLogger, DebugType, WMImageEventType, WMJSService, getMapImageStore, clearImageCache, buildWMSGetMapRequest, getUriWithParam, };
15
+ export { WMJSMap, DateInterval, parseISO8601IntervalToDateInterval, ParseISOTimeRangeDuration, isDefined, WMGetServiceFromStore, WMJScheckURL, URLEncode, URLDecode, parseISO8601DateToDate, I18n, toArray, getLegendGraphicURLForLayer, legendImageStore, WMImage, debugLogger, DebugType, WMImageEventType, WMJSService, getMapImageStore, clearImageCache, getUriWithParam, };
18
16
  export * from './types';
19
17
  export * from './WMTimeTypes';
18
+ export * from './WMConstants';
19
+ export * from './WMJSMapHelpers';