@loaders.gl/geotiff 4.0.0-beta.3 → 4.0.0-beta.5

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.
Files changed (2) hide show
  1. package/dist/dist.dev.js +31 -423
  2. package/package.json +2 -2
package/dist/dist.dev.js CHANGED
@@ -204,7 +204,6 @@ var __exports__ = (() => {
204
204
  var init_globals = __esm({
205
205
  "../../node_modules/geotiff/src/globals.js"() {
206
206
  fieldTagNames = {
207
- // TIFF Baseline
208
207
  315: "Artist",
209
208
  258: "BitsPerSample",
210
209
  265: "CellLength",
@@ -241,7 +240,6 @@ var __exports__ = (() => {
241
240
  263: "Threshholding",
242
241
  282: "XResolution",
243
242
  283: "YResolution",
244
- // TIFF Extended
245
243
  326: "BadFaxLines",
246
244
  327: "CleanFaxData",
247
245
  343: "ClipPath",
@@ -278,7 +276,6 @@ var __exports__ = (() => {
278
276
  530: "YCbCrSubSampling",
279
277
  345: "YClipPathUnits",
280
278
  287: "YPosition",
281
- // EXIF
282
279
  37378: "ApertureValue",
283
280
  40961: "ColorSpace",
284
281
  36868: "DateTimeDigitized",
@@ -295,25 +292,18 @@ var __exports__ = (() => {
295
292
  37500: "MakerNote",
296
293
  37377: "ShutterSpeedValue",
297
294
  37510: "UserComment",
298
- // IPTC
299
295
  33723: "IPTC",
300
- // ICC
301
296
  34675: "ICC Profile",
302
- // XMP
303
297
  700: "XMP",
304
- // GDAL
305
298
  42112: "GDAL_METADATA",
306
299
  42113: "GDAL_NODATA",
307
- // Photoshop
308
300
  34377: "Photoshop",
309
- // GeoTiff
310
301
  33550: "ModelPixelScale",
311
302
  33922: "ModelTiepoint",
312
303
  34264: "ModelTransformation",
313
304
  34735: "GeoKeyDirectory",
314
305
  34736: "GeoDoubleParams",
315
306
  34737: "GeoAsciiParams",
316
- // LERC
317
307
  50674: "LercParameters"
318
308
  };
319
309
  fieldTags = {};
@@ -336,9 +326,7 @@ var __exports__ = (() => {
336
326
  10: "SRATIONAL",
337
327
  11: "FLOAT",
338
328
  12: "DOUBLE",
339
- // IFD offset, suggested by https://owl.phy.queensu.ca/~phil/exiftool/standards.html
340
329
  13: "IFD",
341
- // introduced by BigTIFF
342
330
  16: "LONG8",
343
331
  17: "SLONG8",
344
332
  18: "IFD8"
@@ -8437,7 +8425,6 @@ var __exports__ = (() => {
8437
8425
  var util = require_util();
8438
8426
  var defaultOptions = {
8439
8427
  allowBooleanAttributes: false,
8440
- //A tag can have attributes without any value
8441
8428
  unpairedTags: []
8442
8429
  };
8443
8430
  exports.validate = function(xmlData, options) {
@@ -8734,7 +8721,6 @@ var __exports__ = (() => {
8734
8721
  const lines = xmlData.substring(0, index).split(/\r?\n/);
8735
8722
  return {
8736
8723
  line: lines.length,
8737
- // column number is last line's length + 1, because column numbering starts at 1:
8738
8724
  col: lines[lines.length - 1].length + 1
8739
8725
  };
8740
8726
  }
@@ -8754,14 +8740,10 @@ var __exports__ = (() => {
8754
8740
  textNodeName: "#text",
8755
8741
  ignoreAttributes: true,
8756
8742
  removeNSPrefix: false,
8757
- // remove NS from tag name or attribute name if true
8758
8743
  allowBooleanAttributes: false,
8759
- //a tag can have attributes without any value
8760
- //ignoreRootElement : false,
8761
8744
  parseTagValue: true,
8762
8745
  parseAttributeValue: false,
8763
8746
  trimValues: true,
8764
- //Trim string values of tag and attributes
8765
8747
  cdataPropName: false,
8766
8748
  numberParseOptions: {
8767
8749
  hex: true,
@@ -8775,7 +8757,6 @@ var __exports__ = (() => {
8775
8757
  return val2;
8776
8758
  },
8777
8759
  stopNodes: [],
8778
- //nested tags will not be parsed even for errors
8779
8760
  alwaysCreateTextNode: false,
8780
8761
  isArray: () => false,
8781
8762
  commentPropName: false,
@@ -8789,7 +8770,6 @@ var __exports__ = (() => {
8789
8770
  updateTag: function(tagName, jPath, attrs) {
8790
8771
  return tagName;
8791
8772
  }
8792
- // skipEmptyListItem: false
8793
8773
  };
8794
8774
  var buildOptions = function(options) {
8795
8775
  return Object.assign({}, defaultOptions, options);
@@ -9086,11 +9066,6 @@ var __exports__ = (() => {
9086
9066
  regex: /&(nbsp|#160);/g,
9087
9067
  val: " "
9088
9068
  },
9089
- // "lt" : { regex: /&(lt|#60);/g, val: "<" },
9090
- // "gt" : { regex: /&(gt|#62);/g, val: ">" },
9091
- // "amp" : { regex: /&(amp|#38);/g, val: "&" },
9092
- // "quot" : { regex: /&(quot|#34);/g, val: "\"" },
9093
- // "apos" : { regex: /&(apos|#39);/g, val: "'" },
9094
9069
  "cent": {
9095
9070
  regex: /&(cent|#162);/g,
9096
9071
  val: "\xA2"
@@ -9680,11 +9655,6 @@ var __exports__ = (() => {
9680
9655
  this.externalEntities = {};
9681
9656
  this.options = buildOptions(options);
9682
9657
  }
9683
- /**
9684
- * Parse XML dats to JS object
9685
- * @param {string|Buffer} xmlData
9686
- * @param {boolean|Object} validationOption
9687
- */
9688
9658
  parse(xmlData, validationOption) {
9689
9659
  if (typeof xmlData === "string") {
9690
9660
  } else if (xmlData.toString) {
@@ -9708,11 +9678,6 @@ var __exports__ = (() => {
9708
9678
  else
9709
9679
  return prettify(orderedResult, this.options);
9710
9680
  }
9711
- /**
9712
- * Add Entity which is not by default supported by this library
9713
- * @param {string} key
9714
- * @param {string} value
9715
- */
9716
9681
  addEntity(key, value) {
9717
9682
  if (value.indexOf("&") !== -1) {
9718
9683
  throw new Error("Entity value can't have '&'");
@@ -9882,33 +9847,24 @@ var __exports__ = (() => {
9882
9847
  preserveOrder: false,
9883
9848
  commentPropName: false,
9884
9849
  unpairedTags: [],
9885
- entities: [
9886
- {
9887
- regex: new RegExp("&", "g"),
9888
- val: "&amp;"
9889
- },
9890
- //it must be on top
9891
- {
9892
- regex: new RegExp(">", "g"),
9893
- val: "&gt;"
9894
- },
9895
- {
9896
- regex: new RegExp("<", "g"),
9897
- val: "&lt;"
9898
- },
9899
- {
9900
- regex: new RegExp("'", "g"),
9901
- val: "&apos;"
9902
- },
9903
- {
9904
- regex: new RegExp('"', "g"),
9905
- val: "&quot;"
9906
- }
9907
- ],
9850
+ entities: [{
9851
+ regex: new RegExp("&", "g"),
9852
+ val: "&amp;"
9853
+ }, {
9854
+ regex: new RegExp(">", "g"),
9855
+ val: "&gt;"
9856
+ }, {
9857
+ regex: new RegExp("<", "g"),
9858
+ val: "&lt;"
9859
+ }, {
9860
+ regex: new RegExp("'", "g"),
9861
+ val: "&apos;"
9862
+ }, {
9863
+ regex: new RegExp('"', "g"),
9864
+ val: "&quot;"
9865
+ }],
9908
9866
  processEntities: true,
9909
9867
  stopNodes: [],
9910
- // transformTagName: false,
9911
- // transformAttributeName: false,
9912
9868
  oneListGroup: false
9913
9869
  };
9914
9870
  function Builder(options) {
@@ -10168,31 +10124,22 @@ var __exports__ = (() => {
10168
10124
  is: ObjectIs
10169
10125
  } = NativeObject;
10170
10126
  var ObjectPrototype = NativeObject.prototype;
10171
- var ObjectPrototype__lookupGetter__ = (
10172
- /** @type {any} */
10173
- ObjectPrototype.__lookupGetter__ ? uncurryThis(
10174
- /** @type {any} */
10175
- ObjectPrototype.__lookupGetter__
10176
- ) : (object, key) => {
10177
- if (object == null) {
10178
- throw NativeTypeError(CANNOT_CONVERT_UNDEFINED_OR_NULL_TO_OBJECT);
10179
- }
10180
- let target = NativeObject(object);
10181
- do {
10182
- const descriptor = ReflectGetOwnPropertyDescriptor(target, key);
10183
- if (descriptor !== void 0) {
10184
- if (ObjectHasOwn(descriptor, "get")) {
10185
- return descriptor.get;
10186
- }
10187
- return;
10188
- }
10189
- } while ((target = ReflectGetPrototypeOf(target)) !== null);
10127
+ var ObjectPrototype__lookupGetter__ = ObjectPrototype.__lookupGetter__ ? uncurryThis(ObjectPrototype.__lookupGetter__) : (object, key) => {
10128
+ if (object == null) {
10129
+ throw NativeTypeError(CANNOT_CONVERT_UNDEFINED_OR_NULL_TO_OBJECT);
10190
10130
  }
10191
- );
10192
- var ObjectHasOwn = (
10193
- /** @type {any} */
10194
- NativeObject.hasOwn || uncurryThis(ObjectPrototype.hasOwnProperty)
10195
- );
10131
+ let target = NativeObject(object);
10132
+ do {
10133
+ const descriptor = ReflectGetOwnPropertyDescriptor(target, key);
10134
+ if (descriptor !== void 0) {
10135
+ if (ObjectHasOwn(descriptor, "get")) {
10136
+ return descriptor.get;
10137
+ }
10138
+ return;
10139
+ }
10140
+ } while ((target = ReflectGetPrototypeOf(target)) !== null);
10141
+ };
10142
+ var ObjectHasOwn = NativeObject.hasOwn || uncurryThis(ObjectPrototype.hasOwnProperty);
10196
10143
  var NativeArray = Array;
10197
10144
  var ArrayIsArray = NativeArray.isArray;
10198
10145
  var ArrayPrototype = NativeArray.prototype;
@@ -10719,15 +10666,6 @@ var __exports__ = (() => {
10719
10666
  return outArray.buffer;
10720
10667
  }
10721
10668
  var GeoTIFFImage = class {
10722
- /**
10723
- * @constructor
10724
- * @param {Object} fileDirectory The parsed file directory
10725
- * @param {Object} geoKeys The parsed geo-keys
10726
- * @param {DataView} dataView The DataView for the underlying file.
10727
- * @param {Boolean} littleEndian Whether the file is encoded in little or big endian
10728
- * @param {Boolean} cache Whether or not decoded tiles shall be cached
10729
- * @param {Source} source The datasource to read from
10730
- */
10731
10669
  constructor(fileDirectory, geoKeys2, dataView, littleEndian, cache, source) {
10732
10670
  this.fileDirectory = fileDirectory;
10733
10671
  this.geoKeys = geoKeys2;
@@ -10742,52 +10680,24 @@ var __exports__ = (() => {
10742
10680
  }
10743
10681
  this.source = source;
10744
10682
  }
10745
- /**
10746
- * Returns the associated parsed file directory.
10747
- * @returns {Object} the parsed file directory
10748
- */
10749
10683
  getFileDirectory() {
10750
10684
  return this.fileDirectory;
10751
10685
  }
10752
- /**
10753
- * Returns the associated parsed geo keys.
10754
- * @returns {Object} the parsed geo keys
10755
- */
10756
10686
  getGeoKeys() {
10757
10687
  return this.geoKeys;
10758
10688
  }
10759
- /**
10760
- * Returns the width of the image.
10761
- * @returns {Number} the width of the image
10762
- */
10763
10689
  getWidth() {
10764
10690
  return this.fileDirectory.ImageWidth;
10765
10691
  }
10766
- /**
10767
- * Returns the height of the image.
10768
- * @returns {Number} the height of the image
10769
- */
10770
10692
  getHeight() {
10771
10693
  return this.fileDirectory.ImageLength;
10772
10694
  }
10773
- /**
10774
- * Returns the number of samples per pixel.
10775
- * @returns {Number} the number of samples per pixel
10776
- */
10777
10695
  getSamplesPerPixel() {
10778
10696
  return typeof this.fileDirectory.SamplesPerPixel !== "undefined" ? this.fileDirectory.SamplesPerPixel : 1;
10779
10697
  }
10780
- /**
10781
- * Returns the width of each tile.
10782
- * @returns {Number} the width of each tile
10783
- */
10784
10698
  getTileWidth() {
10785
10699
  return this.isTiled ? this.fileDirectory.TileWidth : this.getWidth();
10786
10700
  }
10787
- /**
10788
- * Returns the height of each tile.
10789
- * @returns {Number} the height of each tile
10790
- */
10791
10701
  getTileHeight() {
10792
10702
  if (this.isTiled) {
10793
10703
  return this.fileDirectory.TileLength;
@@ -10807,11 +10717,6 @@ var __exports__ = (() => {
10807
10717
  return this.getHeight() - y * this.getTileHeight();
10808
10718
  }
10809
10719
  }
10810
- /**
10811
- * Calculates the number of bytes for each pixel across all samples. Only full
10812
- * bytes are supported, an exception is thrown when this is not the case.
10813
- * @returns {Number} the bytes per pixel
10814
- */
10815
10720
  getBytesPerPixel() {
10816
10721
  let bytes = 0;
10817
10722
  for (let i = 0; i < this.fileDirectory.BitsPerSample.length; ++i) {
@@ -10877,16 +10782,6 @@ var __exports__ = (() => {
10877
10782
  const bitsPerSample = this.getBitsPerSample(sampleIndex);
10878
10783
  return arrayForType(format, bitsPerSample, size);
10879
10784
  }
10880
- /**
10881
- * Returns the decoded strip or tile.
10882
- * @param {Number} x the strip or tile x-offset
10883
- * @param {Number} y the tile y-offset (0 for stripped images)
10884
- * @param {Number} sample the sample to get for separated samples
10885
- * @param {Pool|AbstractDecoder} poolOrDecoder the decoder or decoder pool
10886
- * @param {AbortSignal} [signal] An AbortSignal that may be signalled if the request is
10887
- * to be aborted
10888
- * @returns {Promise.<ArrayBuffer>}
10889
- */
10890
10785
  async getTileOrStrip(x, y, sample, poolOrDecoder, signal) {
10891
10786
  const numTilesPerRow = Math.ceil(this.getWidth() / this.getTileWidth());
10892
10787
  const numTilesPerCol = Math.ceil(this.getHeight() / this.getTileHeight());
@@ -10936,21 +10831,6 @@ var __exports__ = (() => {
10936
10831
  data: await request
10937
10832
  };
10938
10833
  }
10939
- /**
10940
- * Internal read function.
10941
- * @private
10942
- * @param {Array} imageWindow The image window in pixel coordinates
10943
- * @param {Array} samples The selected samples (0-based indices)
10944
- * @param {TypedArray[]|TypedArray} valueArrays The array(s) to write into
10945
- * @param {Boolean} interleave Whether or not to write in an interleaved manner
10946
- * @param {Pool|AbstractDecoder} poolOrDecoder the decoder or decoder pool
10947
- * @param {number} width the width of window to be read into
10948
- * @param {number} height the height of window to be read into
10949
- * @param {number} resampleMethod the resampling method to be used when interpolating
10950
- * @param {AbortSignal} [signal] An AbortSignal that may be signalled if the request is
10951
- * to be aborted
10952
- * @returns {Promise<TypedArray[]>|Promise<TypedArray>}
10953
- */
10954
10834
  async _readRaster(imageWindow, samples, valueArrays, interleave, poolOrDecoder, width, height, resampleMethod, signal) {
10955
10835
  const tileWidth = this.getTileWidth();
10956
10836
  const tileHeight = this.getTileHeight();
@@ -11031,34 +10911,6 @@ var __exports__ = (() => {
11031
10911
  valueArrays.height = height || imageWindow[3] - imageWindow[1];
11032
10912
  return valueArrays;
11033
10913
  }
11034
- /**
11035
- * Reads raster data from the image. This function reads all selected samples
11036
- * into separate arrays of the correct type for that sample or into a single
11037
- * combined array when `interleave` is set. When provided, only a subset
11038
- * of the raster is read for each sample.
11039
- *
11040
- * @param {Object} [options={}] optional parameters
11041
- * @param {Array} [options.window=whole image] the subset to read data from.
11042
- * @param {Array} [options.samples=all samples] the selection of samples to read from.
11043
- * @param {Boolean} [options.interleave=false] whether the data shall be read
11044
- * in one single array or separate
11045
- * arrays.
11046
- * @param {Number} [options.pool=null] The optional decoder pool to use.
11047
- * @param {number} [options.width] The desired width of the output. When the width is
11048
- * not the same as the images, resampling will be
11049
- * performed.
11050
- * @param {number} [options.height] The desired height of the output. When the width
11051
- * is not the same as the images, resampling will
11052
- * be performed.
11053
- * @param {string} [options.resampleMethod='nearest'] The desired resampling method.
11054
- * @param {number|number[]} [options.fillValue] The value to use for parts of the image
11055
- * outside of the images extent. When
11056
- * multiple samples are requested, an
11057
- * array of fill values can be passed.
11058
- * @param {AbortSignal} [options.signal] An AbortSignal that may be signalled if the request is
11059
- * to be aborted
11060
- * @returns {Promise.<(TypedArray|TypedArray[])>} the decoded arrays as a promise
11061
- */
11062
10914
  async readRasters({
11063
10915
  window: wnd,
11064
10916
  samples = [],
@@ -11113,30 +10965,6 @@ var __exports__ = (() => {
11113
10965
  const result = await this._readRaster(imageWindow, samples, valueArrays, interleave, poolOrDecoder, width, height, resampleMethod, signal);
11114
10966
  return result;
11115
10967
  }
11116
- /**
11117
- * Reads raster data from the image as RGB. The result is always an
11118
- * interleaved typed array.
11119
- * Colorspaces other than RGB will be transformed to RGB, color maps expanded.
11120
- * When no other method is applicable, the first sample is used to produce a
11121
- * greayscale image.
11122
- * When provided, only a subset of the raster is read for each sample.
11123
- *
11124
- * @param {Object} [options] optional parameters
11125
- * @param {Array} [options.window=whole image] the subset to read data from.
11126
- * @param {Boolean} [options.interleave=true] whether the data shall be read
11127
- * in one single array or separate
11128
- * arrays.
11129
- * @param {Number} [options.pool=null] The optional decoder pool to use.
11130
- * @param {number} [options.width] The desired width of the output. When the width is no the
11131
- * same as the images, resampling will be performed.
11132
- * @param {number} [options.height] The desired height of the output. When the width is no the
11133
- * same as the images, resampling will be performed.
11134
- * @param {string} [options.resampleMethod='nearest'] The desired resampling method.
11135
- * @param {bool} [options.enableAlpha=false] Enable reading alpha channel if present.
11136
- * @param {AbortSignal} [options.signal] An AbortSignal that may be signalled if the request is
11137
- * to be aborted
11138
- * @returns {Promise.<TypedArray|TypedArray[]>} the RGB array as a Promise
11139
- */
11140
10968
  async readRGB({
11141
10969
  window: window2,
11142
10970
  interleave = true,
@@ -11241,10 +11069,6 @@ var __exports__ = (() => {
11241
11069
  data.height = raster.height;
11242
11070
  return data;
11243
11071
  }
11244
- /**
11245
- * Returns an array of tiepoints.
11246
- * @returns {Object[]}
11247
- */
11248
11072
  getTiePoints() {
11249
11073
  if (!this.fileDirectory.ModelTiepoint) {
11250
11074
  return [];
@@ -11262,15 +11086,6 @@ var __exports__ = (() => {
11262
11086
  }
11263
11087
  return tiePoints;
11264
11088
  }
11265
- /**
11266
- * Returns the parsed GDAL metadata items.
11267
- *
11268
- * If sample is passed to null, dataset-level metadata will be returned.
11269
- * Otherwise only metadata specific to the provided sample will be returned.
11270
- *
11271
- * @param {Number} [sample=null] The sample index.
11272
- * @returns {Object}
11273
- */
11274
11089
  getGDALMetadata(sample = null) {
11275
11090
  const metadata = {};
11276
11091
  if (!this.fileDirectory.GDAL_METADATA) {
@@ -11287,10 +11102,6 @@ var __exports__ = (() => {
11287
11102
  }
11288
11103
  return metadata;
11289
11104
  }
11290
- /**
11291
- * Returns the GDAL nodata value
11292
- * @returns {Number} or null
11293
- */
11294
11105
  getGDALNoData() {
11295
11106
  if (!this.fileDirectory.GDAL_NODATA) {
11296
11107
  return null;
@@ -11298,11 +11109,6 @@ var __exports__ = (() => {
11298
11109
  const string = this.fileDirectory.GDAL_NODATA;
11299
11110
  return Number(string.substring(0, string.length - 1));
11300
11111
  }
11301
- /**
11302
- * Returns the image origin as a XYZ-vector. When the image has no affine
11303
- * transformation, then an exception is thrown.
11304
- * @returns {Array} The origin as a vector
11305
- */
11306
11112
  getOrigin() {
11307
11113
  const tiePoints = this.fileDirectory.ModelTiepoint;
11308
11114
  const modelTransformation = this.fileDirectory.ModelTransformation;
@@ -11314,14 +11120,6 @@ var __exports__ = (() => {
11314
11120
  }
11315
11121
  throw new Error("The image does not have an affine transformation.");
11316
11122
  }
11317
- /**
11318
- * Returns the image resolution as a XYZ-vector. When the image has no affine
11319
- * transformation, then an exception is thrown.
11320
- * @param {GeoTIFFImage} [referenceImage=null] A reference image to calculate the resolution from
11321
- * in cases when the current image does not have the
11322
- * required tags on its own.
11323
- * @returns {Array} The resolution as a vector
11324
- */
11325
11123
  getResolution(referenceImage = null) {
11326
11124
  const modelPixelScale = this.fileDirectory.ModelPixelScale;
11327
11125
  const modelTransformation = this.fileDirectory.ModelTransformation;
@@ -11337,19 +11135,9 @@ var __exports__ = (() => {
11337
11135
  }
11338
11136
  throw new Error("The image does not have an affine transformation.");
11339
11137
  }
11340
- /**
11341
- * Returns whether or not the pixels of the image depict an area (or point).
11342
- * @returns {Boolean} Whether the pixels are a point
11343
- */
11344
11138
  pixelIsArea() {
11345
11139
  return this.geoKeys.GTRasterTypeGeoKey === 1;
11346
11140
  }
11347
- /**
11348
- * Returns the image bounding box as an array of 4 values: min-x, min-y,
11349
- * max-x and max-y. When the image has no affine transformation, then an
11350
- * exception is thrown.
11351
- * @returns {Array} The bounding box
11352
- */
11353
11141
  getBoundingBox() {
11354
11142
  const origin = this.getOrigin();
11355
11143
  const resolution = this.getResolution();
@@ -11387,7 +11175,6 @@ var __exports__ = (() => {
11387
11175
  }
11388
11176
  return combined;
11389
11177
  }
11390
- // adapted from https://stackoverflow.com/a/55338384/8060591
11391
11178
  getInt64(offset, littleEndian) {
11392
11179
  let value = 0;
11393
11180
  const isNegative = (this._dataView.getUint8(offset + (littleEndian ? 7 : 0)) & 128) > 0;
@@ -11507,7 +11294,6 @@ var __exports__ = (() => {
11507
11294
  }
11508
11295
  return combined;
11509
11296
  }
11510
- // adapted from https://stackoverflow.com/a/55338384/8060591
11511
11297
  readInt64(offset) {
11512
11298
  let value = 0;
11513
11299
  const isNegative = (this._dataView.getUint8(offset + (this._littleEndian ? 7 : 0)) & 128) > 0;
@@ -11633,25 +11419,12 @@ var __exports__ = (() => {
11633
11419
 
11634
11420
  // ../../node_modules/geotiff/src/source/basesource.js
11635
11421
  var BaseSource = class {
11636
- /**
11637
- *
11638
- * @param {Slice[]} slices
11639
- * @returns {ArrayBuffer[]}
11640
- */
11641
11422
  async fetch(slices, signal = void 0) {
11642
11423
  return Promise.all(slices.map((slice) => this.fetchSlice(slice, signal)));
11643
11424
  }
11644
- /**
11645
- *
11646
- * @param {Slice} slice
11647
- * @returns {ArrayBuffer}
11648
- */
11649
11425
  async fetchSlice(slice) {
11650
11426
  throw new Error(`fetching of slice ${slice} not possible, not implemented`);
11651
11427
  }
11652
- /**
11653
- * Returns the filesize if already determined and null otherwise
11654
- */
11655
11428
  get fileSize() {
11656
11429
  return null;
11657
11430
  }
@@ -11692,31 +11465,16 @@ var __exports__ = (() => {
11692
11465
 
11693
11466
  // ../../node_modules/geotiff/src/source/blockedsource.js
11694
11467
  var Block = class {
11695
- /**
11696
- *
11697
- * @param {number} offset
11698
- * @param {number} length
11699
- * @param {ArrayBuffer} [data]
11700
- */
11701
11468
  constructor(offset, length, data = null) {
11702
11469
  this.offset = offset;
11703
11470
  this.length = length;
11704
11471
  this.data = data;
11705
11472
  }
11706
- /**
11707
- * @returns {number} the top byte border
11708
- */
11709
11473
  get top() {
11710
11474
  return this.offset + this.length;
11711
11475
  }
11712
11476
  };
11713
11477
  var BlockGroup = class {
11714
- /**
11715
- *
11716
- * @param {number} offset
11717
- * @param {number} length
11718
- * @param {number[]} blockIds
11719
- */
11720
11478
  constructor(offset, length, blockIds) {
11721
11479
  this.offset = offset;
11722
11480
  this.length = length;
@@ -11724,11 +11482,6 @@ var __exports__ = (() => {
11724
11482
  }
11725
11483
  };
11726
11484
  var BlockedSource = class extends BaseSource {
11727
- /**
11728
- *
11729
- * @param {Source} source The underlying source that shall be blocked and cached
11730
- * @param {object} options
11731
- */
11732
11485
  constructor(source, {
11733
11486
  blockSize = 65536,
11734
11487
  cacheSize = 100
@@ -11745,10 +11498,6 @@ var __exports__ = (() => {
11745
11498
  get fileSize() {
11746
11499
  return this.source.fileSize;
11747
11500
  }
11748
- /**
11749
- *
11750
- * @param {basesource/Slice[]} slices
11751
- */
11752
11501
  async fetch(slices, signal) {
11753
11502
  const cachedBlocks = /* @__PURE__ */ new Map();
11754
11503
  const blockRequests = /* @__PURE__ */ new Map();
@@ -11832,10 +11581,6 @@ var __exports__ = (() => {
11832
11581
  }
11833
11582
  return this.readSliceData(slices, requiredBlocks);
11834
11583
  }
11835
- /**
11836
- *
11837
- * @param {AbortSignal} signal
11838
- */
11839
11584
  fetchBlocks(signal) {
11840
11585
  if (this.blockIdsToFetch.size > 0) {
11841
11586
  const groups = this.groupBlocks(this.blockIdsToFetch);
@@ -11868,11 +11613,6 @@ var __exports__ = (() => {
11868
11613
  this.blockIdsToFetch.clear();
11869
11614
  }
11870
11615
  }
11871
- /**
11872
- *
11873
- * @param {Set} blockIds
11874
- * @returns {BlockGroup[]}
11875
- */
11876
11616
  groupBlocks(blockIds) {
11877
11617
  const sortedBlockIds = Array.from(blockIds).sort((a, b) => a - b);
11878
11618
  if (sortedBlockIds.length === 0) {
@@ -11894,11 +11634,6 @@ var __exports__ = (() => {
11894
11634
  groups.push(new BlockGroup(current[0] * this.blockSize, current.length * this.blockSize, current));
11895
11635
  return groups;
11896
11636
  }
11897
- /**
11898
- *
11899
- * @param {Slice[]} slices
11900
- * @param {Map} blocks
11901
- */
11902
11637
  readSliceData(slices, blocks) {
11903
11638
  return slices.map((slice) => {
11904
11639
  const top = slice.offset + slice.length;
@@ -11933,29 +11668,15 @@ var __exports__ = (() => {
11933
11668
 
11934
11669
  // ../../node_modules/geotiff/src/source/client/base.js
11935
11670
  var BaseResponse = class {
11936
- /**
11937
- * Returns whether the response has an ok'ish status code
11938
- */
11939
11671
  get ok() {
11940
11672
  return this.status >= 200 && this.status <= 299;
11941
11673
  }
11942
- /**
11943
- * Returns the status code of the response
11944
- */
11945
11674
  get status() {
11946
11675
  throw new Error("not implemented");
11947
11676
  }
11948
- /**
11949
- * Returns the value of the specified header
11950
- * @param {string} headerName the header name
11951
- * @returns {string} the header value
11952
- */
11953
11677
  getHeader(headerName) {
11954
11678
  throw new Error("not implemented");
11955
11679
  }
11956
- /**
11957
- * @returns {ArrayBuffer} the response data of the request
11958
- */
11959
11680
  async getData() {
11960
11681
  throw new Error("not implemented");
11961
11682
  }
@@ -11964,10 +11685,6 @@ var __exports__ = (() => {
11964
11685
  constructor(url) {
11965
11686
  this.url = url;
11966
11687
  }
11967
- /**
11968
- * Send a request with the options
11969
- * @param {object} [options]
11970
- */
11971
11688
  async request({
11972
11689
  headers,
11973
11690
  credentials,
@@ -11979,10 +11696,6 @@ var __exports__ = (() => {
11979
11696
 
11980
11697
  // ../../node_modules/geotiff/src/source/client/fetch.js
11981
11698
  var FetchResponse = class extends BaseResponse {
11982
- /**
11983
- * BaseResponse facade for fetch API Response
11984
- * @param {Response} response
11985
- */
11986
11699
  constructor(response) {
11987
11700
  super();
11988
11701
  this.response = response;
@@ -12019,11 +11732,6 @@ var __exports__ = (() => {
12019
11732
 
12020
11733
  // ../../node_modules/geotiff/src/source/client/xhr.js
12021
11734
  var XHRResponse = class extends BaseResponse {
12022
- /**
12023
- * BaseResponse facade for XMLHttpRequest
12024
- * @param {XMLHttpRequest} xhr
12025
- * @param {ArrayBuffer} data
12026
- */
12027
11735
  constructor(xhr, data) {
12028
11736
  super();
12029
11737
  this.xhr = xhr;
@@ -12077,10 +11785,6 @@ var __exports__ = (() => {
12077
11785
  var import_https = __toESM(require_https());
12078
11786
  var import_url = __toESM(require_url());
12079
11787
  var HttpResponse = class extends BaseResponse {
12080
- /**
12081
- * BaseResponse facade for node HTTP/HTTPS API Response
12082
- * @param {http.ServerResponse} response
12083
- */
12084
11788
  constructor(response, dataPromise) {
12085
11789
  super();
12086
11790
  this.response = response;
@@ -12142,13 +11846,6 @@ var __exports__ = (() => {
12142
11846
 
12143
11847
  // ../../node_modules/geotiff/src/source/remote.js
12144
11848
  var RemoteSource = class extends BaseSource {
12145
- /**
12146
- *
12147
- * @param {BaseClient} client
12148
- * @param {object} headers
12149
- * @param {numbers} maxRanges
12150
- * @param {boolean} allowFullFile
12151
- */
12152
11849
  constructor(client, headers, maxRanges, allowFullFile) {
12153
11850
  super();
12154
11851
  this.client = client;
@@ -12157,10 +11854,6 @@ var __exports__ = (() => {
12157
11854
  this.allowFullFile = allowFullFile;
12158
11855
  this._fileSize = null;
12159
11856
  }
12160
- /**
12161
- *
12162
- * @param {Slice[]} slices
12163
- */
12164
11857
  async fetch(slices, signal) {
12165
11858
  if (this.maxRanges >= slices.length) {
12166
11859
  return this.fetchSlices(slices, signal);
@@ -12488,37 +12181,6 @@ var __exports__ = (() => {
12488
12181
  }
12489
12182
  };
12490
12183
  var GeoTIFFBase = class {
12491
- /**
12492
- * (experimental) Reads raster data from the best fitting image. This function uses
12493
- * the image with the lowest resolution that is still a higher resolution than the
12494
- * requested resolution.
12495
- * When specified, the `bbox` option is translated to the `window` option and the
12496
- * `resX` and `resY` to `width` and `height` respectively.
12497
- * Then, the [readRasters]{@link GeoTIFFImage#readRasters} method of the selected
12498
- * image is called and the result returned.
12499
- * @see GeoTIFFImage.readRasters
12500
- * @param {Object} [options={}] optional parameters
12501
- * @param {Array} [options.window=whole image] the subset to read data from.
12502
- * @param {Array} [options.bbox=whole image] the subset to read data from in
12503
- * geographical coordinates.
12504
- * @param {Array} [options.samples=all samples] the selection of samples to read from.
12505
- * @param {Boolean} [options.interleave=false] whether the data shall be read
12506
- * in one single array or separate
12507
- * arrays.
12508
- * @param {Number} [options.pool=null] The optional decoder pool to use.
12509
- * @param {Number} [options.width] The desired width of the output. When the width is not the
12510
- * same as the images, resampling will be performed.
12511
- * @param {Number} [options.height] The desired height of the output. When the width is not the
12512
- * same as the images, resampling will be performed.
12513
- * @param {String} [options.resampleMethod='nearest'] The desired resampling method.
12514
- * @param {AbortSignal} [options.signal] An AbortSignal that may be signalled if the request is
12515
- * to be aborted
12516
- * @param {Number|Number[]} [options.fillValue] The value to use for parts of the image
12517
- * outside of the images extent. When multiple
12518
- * samples are requested, an array of fill values
12519
- * can be passed.
12520
- * @returns {Promise.<(TypedArray|TypedArray[])>} the decoded arrays as a promise
12521
- */
12522
12184
  async readRasters(options = {}) {
12523
12185
  const {
12524
12186
  window: imageWindow,
@@ -12594,16 +12256,6 @@ var __exports__ = (() => {
12594
12256
  }
12595
12257
  };
12596
12258
  var GeoTIFF = class extends GeoTIFFBase {
12597
- /**
12598
- * @constructor
12599
- * @param {Source} source The datasource to read from.
12600
- * @param {Boolean} littleEndian Whether the image uses little endian.
12601
- * @param {Boolean} bigTiff Whether the image uses bigTIFF conventions.
12602
- * @param {Number} firstIFDOffset The numeric byte-offset from the start of the image
12603
- * to the first IFD.
12604
- * @param {Object} [options] further options.
12605
- * @param {Boolean} [options.cache=false] whether or not decoded tiles shall be cached.
12606
- */
12607
12259
  constructor(source, littleEndian, bigTiff, firstIFDOffset, options = {}) {
12608
12260
  super();
12609
12261
  this.source = source;
@@ -12621,14 +12273,6 @@ var __exports__ = (() => {
12621
12273
  length: typeof size !== "undefined" ? size : fallbackSize
12622
12274
  }]))[0], offset, this.littleEndian, this.bigTiff);
12623
12275
  }
12624
- /**
12625
- * Instructs to parse an image file directory at the given file offset.
12626
- * As there is no way to ensure that a location is indeed the start of an IFD,
12627
- * this function must be called with caution (e.g only using the IFD offsets from
12628
- * the headers or other IFDs).
12629
- * @param {number} offset the offset to parse the IFD at
12630
- * @returns {ImageFileDirectory} the parsed IFD
12631
- */
12632
12276
  async parseFileDirectoryAt(offset) {
12633
12277
  const entrySize = this.bigTiff ? 20 : 12;
12634
12278
  const offsetSize = this.bigTiff ? 8 : 2;
@@ -12696,21 +12340,10 @@ var __exports__ = (() => {
12696
12340
  })();
12697
12341
  return this.ifdRequests[index];
12698
12342
  }
12699
- /**
12700
- * Get the n-th internal subfile of an image. By default, the first is returned.
12701
- *
12702
- * @param {Number} [index=0] the index of the image to return.
12703
- * @returns {GeoTIFFImage} the image at the given index
12704
- */
12705
12343
  async getImage(index = 0) {
12706
12344
  const ifd = await this.requestIFD(index);
12707
12345
  return new geotiffimage_default(ifd.fileDirectory, ifd.geoKeyDirectory, this.dataView, this.littleEndian, this.cache, this.source);
12708
12346
  }
12709
- /**
12710
- * Returns the count of the internal subfiles.
12711
- *
12712
- * @returns {Number} the number of internal subfile images
12713
- */
12714
12347
  async getImageCount() {
12715
12348
  let index = 0;
12716
12349
  let hasNext = true;
@@ -12728,11 +12361,6 @@ var __exports__ = (() => {
12728
12361
  }
12729
12362
  return index;
12730
12363
  }
12731
- /**
12732
- * Get the values of the COG ghost area as a parsed map.
12733
- * See https://gdal.org/drivers/raster/cog.html#header-ghost-area for reference
12734
- * @returns {Object} the parsed ghost area or null, if no such area was found
12735
- */
12736
12364
  async getGhostValues() {
12737
12365
  const offset = this.bigTiff ? 16 : 8;
12738
12366
  if (this.ghostValues) {
@@ -12756,14 +12384,6 @@ var __exports__ = (() => {
12756
12384
  }
12757
12385
  return this.ghostValues;
12758
12386
  }
12759
- /**
12760
- * Parse a (Geo)TIFF file from the given source.
12761
- *
12762
- * @param {source~Source} source The source of data to parse from.
12763
- * @param {object} options Additional options.
12764
- * @param {AbortSignal} [signal] An AbortSignal that may be signalled if the request is
12765
- * to be aborted
12766
- */
12767
12387
  static async fromSource(source, options, signal) {
12768
12388
  const headerData = (await source.fetch([{
12769
12389
  offset: 0,
@@ -12795,11 +12415,6 @@ var __exports__ = (() => {
12795
12415
  const firstIFDOffset = bigTiff ? dataView.getUint64(8, littleEndian) : dataView.getUint32(4, littleEndian);
12796
12416
  return new GeoTIFF(source, littleEndian, bigTiff, firstIFDOffset, options);
12797
12417
  }
12798
- /**
12799
- * Closes the underlying file buffer
12800
- * N.B. After the GeoTIFF has been completely processed it needs
12801
- * to be closed but only if it has been constructed from a file.
12802
- */
12803
12418
  close() {
12804
12419
  if (typeof this.source.close === "function") {
12805
12420
  return this.source.close();
@@ -12880,7 +12495,6 @@ var __exports__ = (() => {
12880
12495
 
12881
12496
  // src/lib/tiff-pixel-source.ts
12882
12497
  var TiffPixelSource = class {
12883
- // eslint-disable-next-line max-params
12884
12498
  constructor(indexer, dtype, tileSize, shape, labels, meta) {
12885
12499
  this._indexer = indexer;
12886
12500
  this.dtype = dtype;
@@ -12935,9 +12549,6 @@ var __exports__ = (() => {
12935
12549
  height: raster.height
12936
12550
  };
12937
12551
  }
12938
- /*
12939
- * Computes tile size given x, y coord.
12940
- */
12941
12552
  _getTileExtent(x, y) {
12942
12553
  const {
12943
12554
  height: zoomLevelHeight,
@@ -13146,13 +12757,10 @@ var __exports__ = (() => {
13146
12757
  // src/lib/ome/omexml.ts
13147
12758
  var import_fast_xml_parser = __toESM(require_fxp(), 1);
13148
12759
  var xmlParser = new import_fast_xml_parser.XMLParser({
13149
- // Nests attributes withtout prefix under 'attr' key for each node
13150
12760
  attributeNamePrefix: "",
13151
12761
  attributesGroupName: "attr",
13152
- // Parses numbers for both attributes and nodes
13153
12762
  parseTagValue: true,
13154
12763
  parseAttributeValue: true,
13155
- // Forces attributes to be parsed
13156
12764
  ignoreAttributes: false
13157
12765
  });
13158
12766
  var parse = (str) => xmlParser.parse(str);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/geotiff",
3
- "version": "4.0.0-beta.3",
3
+ "version": "4.0.0-beta.5",
4
4
  "description": "Framework-independent loaders for tiff and geotiff",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -47,5 +47,5 @@
47
47
  "fast-xml-parser": "^4.2.5",
48
48
  "geotiff": "^1.0.4"
49
49
  },
50
- "gitHead": "7ba9621cc51c7a26c407086ac86171f35b8712af"
50
+ "gitHead": "a6f5a0d1a316cc22396e5a4d480c14329d1ef146"
51
51
  }