@loaders.gl/flatgeobuf 4.2.0-alpha.4 → 4.2.0-alpha.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 (135) hide show
  1. package/dist/dist.dev.js +286 -241
  2. package/dist/dist.min.js +30 -0
  3. package/dist/flatgeobuf/3.27.2/column-meta.d.ts +1 -1
  4. package/dist/flatgeobuf/3.27.2/column-meta.d.ts.map +1 -1
  5. package/dist/flatgeobuf/3.27.2/column-meta.js +1 -2
  6. package/dist/flatgeobuf/3.27.2/config.js +16 -13
  7. package/dist/flatgeobuf/3.27.2/constants.js +3 -2
  8. package/dist/flatgeobuf/3.27.2/crs-meta.js +1 -2
  9. package/dist/flatgeobuf/3.27.2/dumptree.js +28 -23
  10. package/dist/flatgeobuf/3.27.2/feature.d.ts +1 -1
  11. package/dist/flatgeobuf/3.27.2/feature.d.ts.map +1 -1
  12. package/dist/flatgeobuf/3.27.2/feature.js +2 -3
  13. package/dist/flatgeobuf/3.27.2/flat-geobuf/column-type.js +19 -19
  14. package/dist/flatgeobuf/3.27.2/flat-geobuf/column.d.ts +1 -1
  15. package/dist/flatgeobuf/3.27.2/flat-geobuf/column.d.ts.map +1 -1
  16. package/dist/flatgeobuf/3.27.2/flat-geobuf/column.js +117 -117
  17. package/dist/flatgeobuf/3.27.2/flat-geobuf/crs.js +76 -76
  18. package/dist/flatgeobuf/3.27.2/flat-geobuf/feature.d.ts +2 -2
  19. package/dist/flatgeobuf/3.27.2/flat-geobuf/feature.d.ts.map +1 -1
  20. package/dist/flatgeobuf/3.27.2/flat-geobuf/feature.js +96 -90
  21. package/dist/flatgeobuf/3.27.2/flat-geobuf/geometry-type.js +22 -22
  22. package/dist/flatgeobuf/3.27.2/flat-geobuf/geometry.d.ts +1 -1
  23. package/dist/flatgeobuf/3.27.2/flat-geobuf/geometry.d.ts.map +1 -1
  24. package/dist/flatgeobuf/3.27.2/flat-geobuf/geometry.js +224 -210
  25. package/dist/flatgeobuf/3.27.2/flat-geobuf/header.d.ts +3 -3
  26. package/dist/flatgeobuf/3.27.2/flat-geobuf/header.d.ts.map +1 -1
  27. package/dist/flatgeobuf/3.27.2/flat-geobuf/header.js +166 -160
  28. package/dist/flatgeobuf/3.27.2/flat-geobuf.d.ts +5 -5
  29. package/dist/flatgeobuf/3.27.2/flat-geobuf.d.ts.map +1 -1
  30. package/dist/flatgeobuf/3.27.2/flat-geobuf.js +1 -1
  31. package/dist/flatgeobuf/3.27.2/generic/feature.d.ts +4 -4
  32. package/dist/flatgeobuf/3.27.2/generic/feature.d.ts.map +1 -1
  33. package/dist/flatgeobuf/3.27.2/generic/feature.js +195 -205
  34. package/dist/flatgeobuf/3.27.2/generic/featurecollection.d.ts +6 -6
  35. package/dist/flatgeobuf/3.27.2/generic/featurecollection.d.ts.map +1 -1
  36. package/dist/flatgeobuf/3.27.2/generic/featurecollection.js +150 -128
  37. package/dist/flatgeobuf/3.27.2/generic/geometry.d.ts +2 -2
  38. package/dist/flatgeobuf/3.27.2/generic/geometry.d.ts.map +1 -1
  39. package/dist/flatgeobuf/3.27.2/generic/geometry.js +78 -66
  40. package/dist/flatgeobuf/3.27.2/generic/header.d.ts +3 -3
  41. package/dist/flatgeobuf/3.27.2/generic/header.d.ts.map +1 -1
  42. package/dist/flatgeobuf/3.27.2/generic/header.js +18 -18
  43. package/dist/flatgeobuf/3.27.2/generic/index.d.ts +4 -4
  44. package/dist/flatgeobuf/3.27.2/generic/index.d.ts.map +1 -1
  45. package/dist/flatgeobuf/3.27.2/generic/index.js +2 -1
  46. package/dist/flatgeobuf/3.27.2/generic.d.ts +7 -7
  47. package/dist/flatgeobuf/3.27.2/generic.d.ts.map +1 -1
  48. package/dist/flatgeobuf/3.27.2/generic.js +11 -3
  49. package/dist/flatgeobuf/3.27.2/geojson/feature.d.ts +3 -3
  50. package/dist/flatgeobuf/3.27.2/geojson/feature.d.ts.map +1 -1
  51. package/dist/flatgeobuf/3.27.2/geojson/feature.js +8 -9
  52. package/dist/flatgeobuf/3.27.2/geojson/featurecollection.d.ts +2 -2
  53. package/dist/flatgeobuf/3.27.2/geojson/featurecollection.d.ts.map +1 -1
  54. package/dist/flatgeobuf/3.27.2/geojson/featurecollection.js +40 -38
  55. package/dist/flatgeobuf/3.27.2/geojson/geometry.d.ts +3 -3
  56. package/dist/flatgeobuf/3.27.2/geojson/geometry.d.ts.map +1 -1
  57. package/dist/flatgeobuf/3.27.2/geojson/geometry.js +107 -103
  58. package/dist/flatgeobuf/3.27.2/geojson/index.d.ts +3 -3
  59. package/dist/flatgeobuf/3.27.2/geojson/index.d.ts.map +1 -1
  60. package/dist/flatgeobuf/3.27.2/geojson/index.js +2 -1
  61. package/dist/flatgeobuf/3.27.2/geojson.d.ts +3 -3
  62. package/dist/flatgeobuf/3.27.2/geojson.d.ts.map +1 -1
  63. package/dist/flatgeobuf/3.27.2/geojson.js +17 -5
  64. package/dist/flatgeobuf/3.27.2/header-meta.d.ts +3 -3
  65. package/dist/flatgeobuf/3.27.2/header-meta.d.ts.map +1 -1
  66. package/dist/flatgeobuf/3.27.2/header-meta.js +46 -43
  67. package/dist/flatgeobuf/3.27.2/header.d.ts +1 -1
  68. package/dist/flatgeobuf/3.27.2/header.d.ts.map +1 -1
  69. package/dist/flatgeobuf/3.27.2/header.js +2 -3
  70. package/dist/flatgeobuf/3.27.2/http-reader.d.ts +3 -3
  71. package/dist/flatgeobuf/3.27.2/http-reader.d.ts.map +1 -1
  72. package/dist/flatgeobuf/3.27.2/http-reader.js +235 -171
  73. package/dist/flatgeobuf/3.27.2/index.d.ts +13 -13
  74. package/dist/flatgeobuf/3.27.2/index.d.ts.map +1 -1
  75. package/dist/flatgeobuf/3.27.2/index.js +5 -13
  76. package/dist/flatgeobuf/3.27.2/logger.js +37 -56
  77. package/dist/flatgeobuf/3.27.2/packedrtree.js +174 -123
  78. package/dist/flatgeobuf/3.27.2/streams/utils.js +59 -58
  79. package/dist/flatgeobuf-loader.js +28 -22
  80. package/dist/index.cjs +175 -199
  81. package/dist/index.cjs.map +7 -0
  82. package/dist/index.d.ts +2 -2
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.js +3 -1
  85. package/dist/lib/binary-geometries.js +115 -117
  86. package/dist/lib/get-schema-from-fgb-header.js +110 -85
  87. package/dist/lib/parse-flatgeobuf.d.ts +1 -1
  88. package/dist/lib/parse-flatgeobuf.d.ts.map +1 -1
  89. package/dist/lib/parse-flatgeobuf.js +125 -109
  90. package/dist/workers/flatgeobuf-worker.js +3 -1
  91. package/package.json +10 -6
  92. package/src/flatgeobuf/3.27.2/.DS_Store +0 -0
  93. package/dist/LICENSE +0 -9
  94. package/dist/flatgeobuf/3.27.2/LICENSE +0 -29
  95. package/dist/flatgeobuf/3.27.2/README.md +0 -45
  96. package/dist/flatgeobuf/3.27.2/column-meta.js.map +0 -1
  97. package/dist/flatgeobuf/3.27.2/config.js.map +0 -1
  98. package/dist/flatgeobuf/3.27.2/constants.js.map +0 -1
  99. package/dist/flatgeobuf/3.27.2/crs-meta.js.map +0 -1
  100. package/dist/flatgeobuf/3.27.2/dumptree.js.map +0 -1
  101. package/dist/flatgeobuf/3.27.2/feature.js.map +0 -1
  102. package/dist/flatgeobuf/3.27.2/flat-geobuf/column-type.js.map +0 -1
  103. package/dist/flatgeobuf/3.27.2/flat-geobuf/column.js.map +0 -1
  104. package/dist/flatgeobuf/3.27.2/flat-geobuf/crs.js.map +0 -1
  105. package/dist/flatgeobuf/3.27.2/flat-geobuf/feature.js.map +0 -1
  106. package/dist/flatgeobuf/3.27.2/flat-geobuf/geometry-type.js.map +0 -1
  107. package/dist/flatgeobuf/3.27.2/flat-geobuf/geometry.js.map +0 -1
  108. package/dist/flatgeobuf/3.27.2/flat-geobuf/header.js.map +0 -1
  109. package/dist/flatgeobuf/3.27.2/flat-geobuf.js.map +0 -1
  110. package/dist/flatgeobuf/3.27.2/generic/feature.js.map +0 -1
  111. package/dist/flatgeobuf/3.27.2/generic/featurecollection.js.map +0 -1
  112. package/dist/flatgeobuf/3.27.2/generic/geometry.js.map +0 -1
  113. package/dist/flatgeobuf/3.27.2/generic/header.js.map +0 -1
  114. package/dist/flatgeobuf/3.27.2/generic/index.js.map +0 -1
  115. package/dist/flatgeobuf/3.27.2/generic.js.map +0 -1
  116. package/dist/flatgeobuf/3.27.2/geojson/feature.js.map +0 -1
  117. package/dist/flatgeobuf/3.27.2/geojson/featurecollection.js.map +0 -1
  118. package/dist/flatgeobuf/3.27.2/geojson/geometry.js.map +0 -1
  119. package/dist/flatgeobuf/3.27.2/geojson/index.js.map +0 -1
  120. package/dist/flatgeobuf/3.27.2/geojson.js.map +0 -1
  121. package/dist/flatgeobuf/3.27.2/header-meta.js.map +0 -1
  122. package/dist/flatgeobuf/3.27.2/header.js.map +0 -1
  123. package/dist/flatgeobuf/3.27.2/http-reader.js.map +0 -1
  124. package/dist/flatgeobuf/3.27.2/index.js.map +0 -1
  125. package/dist/flatgeobuf/3.27.2/logger.js.map +0 -1
  126. package/dist/flatgeobuf/3.27.2/packedrtree.js.map +0 -1
  127. package/dist/flatgeobuf/3.27.2/streams/utils.js.map +0 -1
  128. package/dist/flatgeobuf/3.27.2/types/jsts.d.ts +0 -23
  129. package/dist/flatgeobuf/3.27.2/types/slice.d.ts +0 -16
  130. package/dist/flatgeobuf-loader.js.map +0 -1
  131. package/dist/index.js.map +0 -1
  132. package/dist/lib/binary-geometries.js.map +0 -1
  133. package/dist/lib/get-schema-from-fgb-header.js.map +0 -1
  134. package/dist/lib/parse-flatgeobuf.js.map +0 -1
  135. package/dist/workers/flatgeobuf-worker.js.map +0 -1
package/dist/dist.dev.js CHANGED
@@ -2,15 +2,19 @@
2
2
  if (typeof exports === 'object' && typeof module === 'object')
3
3
  module.exports = factory();
4
4
  else if (typeof define === 'function' && define.amd) define([], factory);
5
- else if (typeof exports === 'object') exports['loader'] = factory();
6
- else root['loader'] = factory();})(globalThis, function () {
5
+ else if (typeof exports === 'object') exports['loaders'] = factory();
6
+ else root['loaders'] = factory();})(globalThis, function () {
7
7
  "use strict";
8
8
  var __exports__ = (() => {
9
+ var __create = Object.create;
9
10
  var __defProp = Object.defineProperty;
10
11
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
11
12
  var __getOwnPropNames = Object.getOwnPropertyNames;
13
+ var __getProtoOf = Object.getPrototypeOf;
12
14
  var __hasOwnProp = Object.prototype.hasOwnProperty;
13
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15
+ var __commonJS = (cb, mod) => function __require() {
16
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
17
+ };
14
18
  var __export = (target, all) => {
15
19
  for (var name in all)
16
20
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -23,18 +27,31 @@ var __exports__ = (() => {
23
27
  }
24
28
  return to;
25
29
  };
30
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
31
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
32
+ // If the importer is in node compatibility mode or this is not an ESM
33
+ // file that has been converted to a CommonJS file using a Babel-
34
+ // compatible transform (i.e. "__esModule" has not been set), then set
35
+ // "default" to the CommonJS "module.exports" for node compatibility.
36
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
37
+ mod
38
+ ));
26
39
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var __publicField = (obj, key, value) => {
28
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
29
- return value;
30
- };
31
40
 
32
- // src/index.ts
33
- var src_exports = {};
34
- __export(src_exports, {
41
+ // external-global-plugin:@loaders.gl/core
42
+ var require_core = __commonJS({
43
+ "external-global-plugin:@loaders.gl/core"(exports4, module) {
44
+ module.exports = globalThis.loaders;
45
+ }
46
+ });
47
+
48
+ // bundle.ts
49
+ var bundle_exports = {};
50
+ __export(bundle_exports, {
35
51
  FlatGeobufLoader: () => FlatGeobufLoader,
36
52
  FlatGeobufWorkerLoader: () => FlatGeobufWorkerLoader
37
53
  });
54
+ __reExport(bundle_exports, __toESM(require_core(), 1));
38
55
 
39
56
  // ../../node_modules/@babel/runtime/helpers/esm/typeof.js
40
57
  function _typeof(obj) {
@@ -5476,9 +5493,7 @@ var __exports__ = (() => {
5476
5493
  const xy = geometry.xyArray();
5477
5494
  const z = geometry.zArray();
5478
5495
  const positions = blitArrays(xy, z);
5479
- return {
5480
- positions
5481
- };
5496
+ return { positions };
5482
5497
  }
5483
5498
  function parseLines(geometry) {
5484
5499
  const xy = geometry.xyArray();
@@ -5486,10 +5501,7 @@ var __exports__ = (() => {
5486
5501
  const positions = blitArrays(xy, z);
5487
5502
  const ends = geometry.endsArray() && Array.from(geometry.endsArray()) || [xy.length / 2];
5488
5503
  ends.unshift(0);
5489
- const pathIndices = {
5490
- value: new Uint16Array(ends),
5491
- size: 1
5492
- };
5504
+ const pathIndices = { value: new Uint16Array(ends), size: 1 };
5493
5505
  return {
5494
5506
  positions,
5495
5507
  pathIndices
@@ -5501,14 +5513,8 @@ var __exports__ = (() => {
5501
5513
  const positions = blitArrays(xy, z);
5502
5514
  const ends = geometry.endsArray() && Array.from(geometry.endsArray()) || [xy.length / 2];
5503
5515
  ends.unshift(0);
5504
- const primitivePolygonIndices = {
5505
- value: new Uint16Array(ends),
5506
- size: 1
5507
- };
5508
- const polygonIndices = {
5509
- value: new Uint16Array([0, xy.length / 2]),
5510
- size: 1
5511
- };
5516
+ const primitivePolygonIndices = { value: new Uint16Array(ends), size: 1 };
5517
+ const polygonIndices = { value: new Uint16Array([0, xy.length / 2]), size: 1 };
5512
5518
  return {
5513
5519
  positions,
5514
5520
  primitivePolygonIndices,
@@ -5537,33 +5543,29 @@ var __exports__ = (() => {
5537
5543
  const positionSize = parsedParts[0].positions.size;
5538
5544
  for (const parsedPart of parsedParts) {
5539
5545
  concatPositions.set(parsedPart.positions.value, positionCounter * positionSize);
5540
- concatPrimitivePolygonIndices.set(parsedPart.primitivePolygonIndices.value.subarray(1).map((x) => x + positionCounter), primitivePolygonIndicesCounter);
5541
- concatPolygonIndices.set(parsedPart.polygonIndices.value.subarray(1).map((x) => x + positionCounter), polygonIndicesCounter);
5546
+ concatPrimitivePolygonIndices.set(
5547
+ // eslint-disable-next-line
5548
+ parsedPart.primitivePolygonIndices.value.subarray(1).map((x) => x + positionCounter),
5549
+ primitivePolygonIndicesCounter
5550
+ );
5551
+ concatPolygonIndices.set(
5552
+ // eslint-disable-next-line
5553
+ parsedPart.polygonIndices.value.subarray(1).map((x) => x + positionCounter),
5554
+ polygonIndicesCounter
5555
+ );
5542
5556
  positionCounter += parsedPart.positions.value.length / positionSize;
5543
5557
  primitivePolygonIndicesCounter += parsedPart.primitivePolygonIndices.value.length - 1;
5544
5558
  polygonIndicesCounter += parsedPart.polygonIndices.value.length - 1;
5545
5559
  }
5546
5560
  return {
5547
- positions: {
5548
- value: concatPositions,
5549
- size: positionSize
5550
- },
5551
- primitivePolygonIndices: {
5552
- value: concatPrimitivePolygonIndices,
5553
- size: 1
5554
- },
5555
- polygonIndices: {
5556
- value: concatPolygonIndices,
5557
- size: 1
5558
- }
5561
+ positions: { value: concatPositions, size: positionSize },
5562
+ primitivePolygonIndices: { value: concatPrimitivePolygonIndices, size: 1 },
5563
+ polygonIndices: { value: concatPolygonIndices, size: 1 }
5559
5564
  };
5560
5565
  }
5561
5566
  function blitArrays(xy, z) {
5562
5567
  if (!z) {
5563
- return {
5564
- value: xy,
5565
- size: 2
5566
- };
5568
+ return { value: xy, size: 2 };
5567
5569
  }
5568
5570
  if (z.length * 2 !== xy.length) {
5569
5571
  throw new Error("Z array must be half XY array's length");
@@ -5575,10 +5577,7 @@ var __exports__ = (() => {
5575
5577
  xyz[i * 3 + 1] = xy[i * 2 + 1];
5576
5578
  xyz[i * 3 + 2] = z[i];
5577
5579
  }
5578
- return {
5579
- value: xyz,
5580
- size: 3
5581
- };
5580
+ return { value: xyz, size: 3 };
5582
5581
  }
5583
5582
 
5584
5583
  // src/lib/get-schema-from-fgb-header.ts
@@ -5594,10 +5593,7 @@ var __exports__ = (() => {
5594
5593
  bounds: fgbHeader.envelope?.join(",") || ""
5595
5594
  };
5596
5595
  const fields = fgbHeader.columns?.map((column) => getFieldFromFGBColumn(column)) || [];
5597
- return {
5598
- metadata,
5599
- fields
5600
- };
5596
+ return { metadata, fields };
5601
5597
  }
5602
5598
  function getFieldFromFGBColumn(fgbColumn) {
5603
5599
  const metadata = {
@@ -5616,55 +5612,37 @@ var __exports__ = (() => {
5616
5612
  metadata
5617
5613
  };
5618
5614
  }
5619
- var fgbColumnType = function(fgbColumnType2) {
5620
- fgbColumnType2[fgbColumnType2["Byte"] = 0] = "Byte";
5621
- fgbColumnType2[fgbColumnType2["UByte"] = 1] = "UByte";
5622
- fgbColumnType2[fgbColumnType2["Bool"] = 2] = "Bool";
5623
- fgbColumnType2[fgbColumnType2["Short"] = 3] = "Short";
5624
- fgbColumnType2[fgbColumnType2["UShort"] = 4] = "UShort";
5625
- fgbColumnType2[fgbColumnType2["Int"] = 5] = "Int";
5626
- fgbColumnType2[fgbColumnType2["UInt"] = 6] = "UInt";
5627
- fgbColumnType2[fgbColumnType2["Long"] = 7] = "Long";
5628
- fgbColumnType2[fgbColumnType2["ULong"] = 8] = "ULong";
5629
- fgbColumnType2[fgbColumnType2["Float"] = 9] = "Float";
5630
- fgbColumnType2[fgbColumnType2["Double"] = 10] = "Double";
5631
- fgbColumnType2[fgbColumnType2["String"] = 11] = "String";
5632
- fgbColumnType2[fgbColumnType2["Json"] = 12] = "Json";
5633
- fgbColumnType2[fgbColumnType2["DateTime"] = 13] = "DateTime";
5634
- fgbColumnType2[fgbColumnType2["Binary"] = 14] = "Binary";
5635
- return fgbColumnType2;
5636
- }(fgbColumnType || {});
5637
5615
  function getTypeFromFGBType(fgbType) {
5638
5616
  switch (fgbType) {
5639
- case fgbColumnType.Byte:
5617
+ case 0 /* Byte */:
5640
5618
  return "int8";
5641
- case fgbColumnType.UByte:
5619
+ case 1 /* UByte */:
5642
5620
  return "uint8";
5643
- case fgbColumnType.Bool:
5621
+ case 2 /* Bool */:
5644
5622
  return "bool";
5645
- case fgbColumnType.Short:
5623
+ case 3 /* Short */:
5646
5624
  return "int16";
5647
- case fgbColumnType.UShort:
5625
+ case 4 /* UShort */:
5648
5626
  return "uint16";
5649
- case fgbColumnType.Int:
5627
+ case 5 /* Int */:
5650
5628
  return "int32";
5651
- case fgbColumnType.UInt:
5629
+ case 6 /* UInt */:
5652
5630
  return "uint32";
5653
- case fgbColumnType.Long:
5631
+ case 7 /* Long */:
5654
5632
  return "int64";
5655
- case fgbColumnType.ULong:
5633
+ case 8 /* ULong */:
5656
5634
  return "uint64";
5657
- case fgbColumnType.Float:
5635
+ case 9 /* Float */:
5658
5636
  return "float32";
5659
- case fgbColumnType.Double:
5637
+ case 10 /* Double */:
5660
5638
  return "float64";
5661
- case fgbColumnType.String:
5639
+ case 11 /* String */:
5662
5640
  return "utf8";
5663
- case fgbColumnType.Json:
5641
+ case 12 /* Json */:
5664
5642
  return "null";
5665
- case fgbColumnType.DateTime:
5643
+ case 13 /* DateTime */:
5666
5644
  return "date-millisecond";
5667
- case fgbColumnType.Binary:
5645
+ case 14 /* Binary */:
5668
5646
  return "binary";
5669
5647
  default:
5670
5648
  return "null";
@@ -5672,7 +5650,7 @@ var __exports__ = (() => {
5672
5650
  }
5673
5651
 
5674
5652
  // src/flatgeobuf/3.27.2/flat-geobuf/geometry-type.ts
5675
- var GeometryType2 = function(GeometryType3) {
5653
+ var GeometryType2 = /* @__PURE__ */ ((GeometryType3) => {
5676
5654
  GeometryType3[GeometryType3["Unknown"] = 0] = "Unknown";
5677
5655
  GeometryType3[GeometryType3["Point"] = 1] = "Point";
5678
5656
  GeometryType3[GeometryType3["LineString"] = 2] = "LineString";
@@ -5692,7 +5670,7 @@ var __exports__ = (() => {
5692
5670
  GeometryType3[GeometryType3["TIN"] = 16] = "TIN";
5693
5671
  GeometryType3[GeometryType3["Triangle"] = 17] = "Triangle";
5694
5672
  return GeometryType3;
5695
- }({});
5673
+ })(GeometryType2 || {});
5696
5674
 
5697
5675
  // ../../node_modules/flatbuffers/mjs/constants.js
5698
5676
  var SIZEOF_INT = 4;
@@ -5958,8 +5936,10 @@ var __exports__ = (() => {
5958
5936
 
5959
5937
  // src/flatgeobuf/3.27.2/flat-geobuf/geometry.ts
5960
5938
  var Geometry = class {
5961
- bb = null;
5962
- bb_pos = 0;
5939
+ constructor() {
5940
+ this.bb = null;
5941
+ this.bb_pos = 0;
5942
+ }
5963
5943
  __init(i, bb) {
5964
5944
  this.bb_pos = i;
5965
5945
  this.bb = bb;
@@ -5982,7 +5962,11 @@ var __exports__ = (() => {
5982
5962
  }
5983
5963
  endsArray() {
5984
5964
  const offset = this.bb.__offset(this.bb_pos, 4);
5985
- return offset ? new Uint32Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
5965
+ return offset ? new Uint32Array(
5966
+ this.bb.bytes().buffer,
5967
+ this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset),
5968
+ this.bb.__vector_len(this.bb_pos + offset)
5969
+ ) : null;
5986
5970
  }
5987
5971
  xy(index) {
5988
5972
  const offset = this.bb.__offset(this.bb_pos, 6);
@@ -5994,7 +5978,11 @@ var __exports__ = (() => {
5994
5978
  }
5995
5979
  xyArray() {
5996
5980
  const offset = this.bb.__offset(this.bb_pos, 6);
5997
- return offset ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
5981
+ return offset ? new Float64Array(
5982
+ this.bb.bytes().buffer,
5983
+ this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset),
5984
+ this.bb.__vector_len(this.bb_pos + offset)
5985
+ ) : null;
5998
5986
  }
5999
5987
  z(index) {
6000
5988
  const offset = this.bb.__offset(this.bb_pos, 8);
@@ -6006,7 +5994,11 @@ var __exports__ = (() => {
6006
5994
  }
6007
5995
  zArray() {
6008
5996
  const offset = this.bb.__offset(this.bb_pos, 8);
6009
- return offset ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
5997
+ return offset ? new Float64Array(
5998
+ this.bb.bytes().buffer,
5999
+ this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset),
6000
+ this.bb.__vector_len(this.bb_pos + offset)
6001
+ ) : null;
6010
6002
  }
6011
6003
  m(index) {
6012
6004
  const offset = this.bb.__offset(this.bb_pos, 10);
@@ -6018,7 +6010,11 @@ var __exports__ = (() => {
6018
6010
  }
6019
6011
  mArray() {
6020
6012
  const offset = this.bb.__offset(this.bb_pos, 10);
6021
- return offset ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
6013
+ return offset ? new Float64Array(
6014
+ this.bb.bytes().buffer,
6015
+ this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset),
6016
+ this.bb.__vector_len(this.bb_pos + offset)
6017
+ ) : null;
6022
6018
  }
6023
6019
  t(index) {
6024
6020
  const offset = this.bb.__offset(this.bb_pos, 12);
@@ -6030,7 +6026,11 @@ var __exports__ = (() => {
6030
6026
  }
6031
6027
  tArray() {
6032
6028
  const offset = this.bb.__offset(this.bb_pos, 12);
6033
- return offset ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
6029
+ return offset ? new Float64Array(
6030
+ this.bb.bytes().buffer,
6031
+ this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset),
6032
+ this.bb.__vector_len(this.bb_pos + offset)
6033
+ ) : null;
6034
6034
  }
6035
6035
  tm(index) {
6036
6036
  const offset = this.bb.__offset(this.bb_pos, 14);
@@ -6042,11 +6042,14 @@ var __exports__ = (() => {
6042
6042
  }
6043
6043
  type() {
6044
6044
  const offset = this.bb.__offset(this.bb_pos, 16);
6045
- return offset ? this.bb.readUint8(this.bb_pos + offset) : GeometryType2.Unknown;
6045
+ return offset ? this.bb.readUint8(this.bb_pos + offset) : 0 /* Unknown */;
6046
6046
  }
6047
6047
  parts(index, obj) {
6048
6048
  const offset = this.bb.__offset(this.bb_pos, 18);
6049
- return offset ? (obj || new Geometry()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
6049
+ return offset ? (obj || new Geometry()).__init(
6050
+ this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4),
6051
+ this.bb
6052
+ ) : null;
6050
6053
  }
6051
6054
  partsLength() {
6052
6055
  const offset = this.bb.__offset(this.bb_pos, 18);
@@ -6134,7 +6137,7 @@ var __exports__ = (() => {
6134
6137
  builder.startVector(8, numElems, 8);
6135
6138
  }
6136
6139
  static addType(builder, type) {
6137
- builder.addFieldInt8(6, type, GeometryType2.Unknown);
6140
+ builder.addFieldInt8(6, type, 0 /* Unknown */);
6138
6141
  }
6139
6142
  static addParts(builder, partsOffset) {
6140
6143
  builder.addFieldOffset(7, partsOffset, 0);
@@ -6196,27 +6199,27 @@ var __exports__ = (() => {
6196
6199
  const xy = geometry.xyArray();
6197
6200
  const z = geometry.zArray();
6198
6201
  switch (type) {
6199
- case GeometryType2.Point: {
6202
+ case 1 /* Point */: {
6200
6203
  const a = Array.from(xy);
6201
6204
  if (z)
6202
6205
  a.push(z[0]);
6203
6206
  return a;
6204
6207
  }
6205
- case GeometryType2.MultiPoint:
6206
- case GeometryType2.LineString:
6208
+ case 4 /* MultiPoint */:
6209
+ case 2 /* LineString */:
6207
6210
  return pairFlatCoordinates(xy, z);
6208
- case GeometryType2.MultiLineString:
6211
+ case 5 /* MultiLineString */:
6209
6212
  return extractParts(xy, z, geometry.endsArray());
6210
- case GeometryType2.Polygon:
6213
+ case 3 /* Polygon */:
6211
6214
  return extractParts(xy, z, geometry.endsArray());
6212
6215
  }
6213
6216
  }
6214
6217
  function fromGeometry(geometry, headerType) {
6215
6218
  let type = headerType;
6216
- if (type === GeometryType2.Unknown) {
6219
+ if (type === 0 /* Unknown */) {
6217
6220
  type = geometry.type();
6218
6221
  }
6219
- if (type === GeometryType2.GeometryCollection) {
6222
+ if (type === 7 /* GeometryCollection */) {
6220
6223
  const geometries = [];
6221
6224
  for (let i = 0; i < geometry.partsLength(); i++) {
6222
6225
  const part = geometry.parts(i);
@@ -6227,10 +6230,10 @@ var __exports__ = (() => {
6227
6230
  type: GeometryType2[type],
6228
6231
  geometries
6229
6232
  };
6230
- } else if (type === GeometryType2.MultiPolygon) {
6233
+ } else if (type === 6 /* MultiPolygon */) {
6231
6234
  const geometries = [];
6232
6235
  for (let i = 0; i < geometry.partsLength(); i++)
6233
- geometries.push(fromGeometry(geometry.parts(i), GeometryType2.Polygon));
6236
+ geometries.push(fromGeometry(geometry.parts(i), 3 /* Polygon */));
6234
6237
  return {
6235
6238
  type: GeometryType2[type],
6236
6239
  coordinates: geometries.map((g) => g.coordinates)
@@ -6243,30 +6246,12 @@ var __exports__ = (() => {
6243
6246
  };
6244
6247
  }
6245
6248
 
6246
- // src/flatgeobuf/3.27.2/flat-geobuf/column-type.ts
6247
- var ColumnType = function(ColumnType2) {
6248
- ColumnType2[ColumnType2["Byte"] = 0] = "Byte";
6249
- ColumnType2[ColumnType2["UByte"] = 1] = "UByte";
6250
- ColumnType2[ColumnType2["Bool"] = 2] = "Bool";
6251
- ColumnType2[ColumnType2["Short"] = 3] = "Short";
6252
- ColumnType2[ColumnType2["UShort"] = 4] = "UShort";
6253
- ColumnType2[ColumnType2["Int"] = 5] = "Int";
6254
- ColumnType2[ColumnType2["UInt"] = 6] = "UInt";
6255
- ColumnType2[ColumnType2["Long"] = 7] = "Long";
6256
- ColumnType2[ColumnType2["ULong"] = 8] = "ULong";
6257
- ColumnType2[ColumnType2["Float"] = 9] = "Float";
6258
- ColumnType2[ColumnType2["Double"] = 10] = "Double";
6259
- ColumnType2[ColumnType2["String"] = 11] = "String";
6260
- ColumnType2[ColumnType2["Json"] = 12] = "Json";
6261
- ColumnType2[ColumnType2["DateTime"] = 13] = "DateTime";
6262
- ColumnType2[ColumnType2["Binary"] = 14] = "Binary";
6263
- return ColumnType2;
6264
- }({});
6265
-
6266
6249
  // src/flatgeobuf/3.27.2/flat-geobuf/column.ts
6267
6250
  var Column = class {
6268
- bb = null;
6269
- bb_pos = 0;
6251
+ constructor() {
6252
+ this.bb = null;
6253
+ this.bb_pos = 0;
6254
+ }
6270
6255
  __init(i, bb) {
6271
6256
  this.bb_pos = i;
6272
6257
  this.bb = bb;
@@ -6285,7 +6270,7 @@ var __exports__ = (() => {
6285
6270
  }
6286
6271
  type() {
6287
6272
  const offset = this.bb.__offset(this.bb_pos, 6);
6288
- return offset ? this.bb.readUint8(this.bb_pos + offset) : ColumnType.Byte;
6273
+ return offset ? this.bb.readUint8(this.bb_pos + offset) : 0 /* Byte */;
6289
6274
  }
6290
6275
  title(optionalEncoding) {
6291
6276
  const offset = this.bb.__offset(this.bb_pos, 8);
@@ -6330,7 +6315,7 @@ var __exports__ = (() => {
6330
6315
  builder.addFieldOffset(0, nameOffset, 0);
6331
6316
  }
6332
6317
  static addType(builder, type) {
6333
- builder.addFieldInt8(1, type, ColumnType.Byte);
6318
+ builder.addFieldInt8(1, type, 0 /* Byte */);
6334
6319
  }
6335
6320
  static addTitle(builder, titleOffset) {
6336
6321
  builder.addFieldOffset(2, titleOffset, 0);
@@ -6383,8 +6368,10 @@ var __exports__ = (() => {
6383
6368
 
6384
6369
  // src/flatgeobuf/3.27.2/flat-geobuf/feature.ts
6385
6370
  var Feature = class {
6386
- bb = null;
6387
- bb_pos = 0;
6371
+ constructor() {
6372
+ this.bb = null;
6373
+ this.bb_pos = 0;
6374
+ }
6388
6375
  __init(i, bb) {
6389
6376
  this.bb_pos = i;
6390
6377
  this.bb = bb;
@@ -6411,11 +6398,18 @@ var __exports__ = (() => {
6411
6398
  }
6412
6399
  propertiesArray() {
6413
6400
  const offset = this.bb.__offset(this.bb_pos, 6);
6414
- return offset ? new Uint8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
6401
+ return offset ? new Uint8Array(
6402
+ this.bb.bytes().buffer,
6403
+ this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset),
6404
+ this.bb.__vector_len(this.bb_pos + offset)
6405
+ ) : null;
6415
6406
  }
6416
6407
  columns(index, obj) {
6417
6408
  const offset = this.bb.__offset(this.bb_pos, 8);
6418
- return offset ? (obj || new Column()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
6409
+ return offset ? (obj || new Column()).__init(
6410
+ this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4),
6411
+ this.bb
6412
+ ) : null;
6419
6413
  }
6420
6414
  columnsLength() {
6421
6415
  const offset = this.bb.__offset(this.bb_pos, 8);
@@ -6491,70 +6485,70 @@ var __exports__ = (() => {
6491
6485
  const column = columns[i];
6492
6486
  const name = column.name;
6493
6487
  switch (column.type) {
6494
- case ColumnType.Bool: {
6488
+ case 2 /* Bool */: {
6495
6489
  properties[name] = Boolean(view.getUint8(offset));
6496
6490
  offset += 1;
6497
6491
  break;
6498
6492
  }
6499
- case ColumnType.Byte: {
6493
+ case 0 /* Byte */: {
6500
6494
  properties[name] = view.getInt8(offset);
6501
6495
  offset += 1;
6502
6496
  break;
6503
6497
  }
6504
- case ColumnType.UByte: {
6498
+ case 1 /* UByte */: {
6505
6499
  properties[name] = view.getUint8(offset);
6506
6500
  offset += 1;
6507
6501
  break;
6508
6502
  }
6509
- case ColumnType.Short: {
6503
+ case 3 /* Short */: {
6510
6504
  properties[name] = view.getInt16(offset, true);
6511
6505
  offset += 2;
6512
6506
  break;
6513
6507
  }
6514
- case ColumnType.UShort: {
6508
+ case 4 /* UShort */: {
6515
6509
  properties[name] = view.getUint16(offset, true);
6516
6510
  offset += 2;
6517
6511
  break;
6518
6512
  }
6519
- case ColumnType.Int: {
6513
+ case 5 /* Int */: {
6520
6514
  properties[name] = view.getInt32(offset, true);
6521
6515
  offset += 4;
6522
6516
  break;
6523
6517
  }
6524
- case ColumnType.UInt: {
6518
+ case 6 /* UInt */: {
6525
6519
  properties[name] = view.getUint32(offset, true);
6526
6520
  offset += 4;
6527
6521
  break;
6528
6522
  }
6529
- case ColumnType.Long: {
6523
+ case 7 /* Long */: {
6530
6524
  properties[name] = Number(view.getBigInt64(offset, true));
6531
6525
  offset += 8;
6532
6526
  break;
6533
6527
  }
6534
- case ColumnType.ULong: {
6528
+ case 8 /* ULong */: {
6535
6529
  properties[name] = Number(view.getBigUint64(offset, true));
6536
6530
  offset += 8;
6537
6531
  break;
6538
6532
  }
6539
- case ColumnType.Float: {
6533
+ case 9 /* Float */: {
6540
6534
  properties[name] = view.getFloat32(offset, true);
6541
6535
  offset += 4;
6542
6536
  break;
6543
6537
  }
6544
- case ColumnType.Double: {
6538
+ case 10 /* Double */: {
6545
6539
  properties[name] = view.getFloat64(offset, true);
6546
6540
  offset += 8;
6547
6541
  break;
6548
6542
  }
6549
- case ColumnType.DateTime:
6550
- case ColumnType.String: {
6543
+ case 13 /* DateTime */:
6544
+ case 11 /* String */: {
6551
6545
  const length2 = view.getUint32(offset, true);
6552
6546
  offset += 4;
6553
6547
  properties[name] = textDecoder.decode(array.subarray(offset, offset + length2));
6554
6548
  offset += length2;
6555
6549
  break;
6556
6550
  }
6557
- case ColumnType.Json: {
6551
+ case 12 /* Json */: {
6558
6552
  const length2 = view.getUint32(offset, true);
6559
6553
  offset += 4;
6560
6554
  const str = textDecoder.decode(array.subarray(offset, offset + length2));
@@ -6656,8 +6650,10 @@ var __exports__ = (() => {
6656
6650
 
6657
6651
  // src/flatgeobuf/3.27.2/flat-geobuf/crs.ts
6658
6652
  var Crs = class {
6659
- bb = null;
6660
- bb_pos = 0;
6653
+ constructor() {
6654
+ this.bb = null;
6655
+ this.bb_pos = 0;
6656
+ }
6661
6657
  __init(i, bb) {
6662
6658
  this.bb_pos = i;
6663
6659
  this.bb = bb;
@@ -6733,8 +6729,10 @@ var __exports__ = (() => {
6733
6729
 
6734
6730
  // src/flatgeobuf/3.27.2/flat-geobuf/header.ts
6735
6731
  var Header = class {
6736
- bb = null;
6737
- bb_pos = 0;
6732
+ constructor() {
6733
+ this.bb = null;
6734
+ this.bb_pos = 0;
6735
+ }
6738
6736
  __init(i, bb) {
6739
6737
  this.bb_pos = i;
6740
6738
  this.bb = bb;
@@ -6761,11 +6759,15 @@ var __exports__ = (() => {
6761
6759
  }
6762
6760
  envelopeArray() {
6763
6761
  const offset = this.bb.__offset(this.bb_pos, 6);
6764
- return offset ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
6762
+ return offset ? new Float64Array(
6763
+ this.bb.bytes().buffer,
6764
+ this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset),
6765
+ this.bb.__vector_len(this.bb_pos + offset)
6766
+ ) : null;
6765
6767
  }
6766
6768
  geometryType() {
6767
6769
  const offset = this.bb.__offset(this.bb_pos, 8);
6768
- return offset ? this.bb.readUint8(this.bb_pos + offset) : GeometryType2.Unknown;
6770
+ return offset ? this.bb.readUint8(this.bb_pos + offset) : 0 /* Unknown */;
6769
6771
  }
6770
6772
  hasZ() {
6771
6773
  const offset = this.bb.__offset(this.bb_pos, 10);
@@ -6785,7 +6787,10 @@ var __exports__ = (() => {
6785
6787
  }
6786
6788
  columns(index, obj) {
6787
6789
  const offset = this.bb.__offset(this.bb_pos, 18);
6788
- return offset ? (obj || new Column()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
6790
+ return offset ? (obj || new Column()).__init(
6791
+ this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4),
6792
+ this.bb
6793
+ ) : null;
6789
6794
  }
6790
6795
  columnsLength() {
6791
6796
  const offset = this.bb.__offset(this.bb_pos, 18);
@@ -6835,7 +6840,7 @@ var __exports__ = (() => {
6835
6840
  builder.startVector(8, numElems, 8);
6836
6841
  }
6837
6842
  static addGeometryType(builder, geometryType) {
6838
- builder.addFieldInt8(2, geometryType, GeometryType2.Unknown);
6843
+ builder.addFieldInt8(2, geometryType, 0 /* Unknown */);
6839
6844
  }
6840
6845
  static addHasZ(builder, hasZ) {
6841
6846
  builder.addFieldInt8(3, Number(hasZ), Number(false));
@@ -8051,7 +8056,12 @@ var __exports__ = (() => {
8051
8056
 
8052
8057
  // src/flatgeobuf/3.27.2/config.ts
8053
8058
  var _Config = class {
8054
- _extraRequestThreshold = 256 * 1024;
8059
+ constructor() {
8060
+ this._extraRequestThreshold = 256 * 1024;
8061
+ }
8062
+ /**
8063
+ * Fetch up to this many extra bytes if it will eliminate an extra request
8064
+ */
8055
8065
  extraRequestThreshold() {
8056
8066
  return this._extraRequestThreshold;
8057
8067
  }
@@ -8063,54 +8073,47 @@ var __exports__ = (() => {
8063
8073
  }
8064
8074
  };
8065
8075
  var Config = _Config;
8066
- __publicField(Config, "global", new _Config());
8076
+ Config.global = new _Config();
8067
8077
 
8068
8078
  // src/flatgeobuf/3.27.2/logger.ts
8069
- var LogLevel = function(LogLevel2) {
8070
- LogLevel2[LogLevel2["Debug"] = 0] = "Debug";
8071
- LogLevel2[LogLevel2["Info"] = 1] = "Info";
8072
- LogLevel2[LogLevel2["Warn"] = 2] = "Warn";
8073
- LogLevel2[LogLevel2["Error"] = 3] = "Error";
8074
- return LogLevel2;
8075
- }({});
8076
8079
  var Logger = class {
8077
8080
  static debug(...args) {
8078
- this.log(LogLevel.Debug, ...args);
8081
+ this.log(0 /* Debug */, ...args);
8079
8082
  }
8080
8083
  static info(...args) {
8081
- this.log(LogLevel.Info, ...args);
8084
+ this.log(1 /* Info */, ...args);
8082
8085
  }
8083
8086
  static warn(...args) {
8084
- this.log(LogLevel.Warn, ...args);
8087
+ this.log(2 /* Warn */, ...args);
8085
8088
  }
8086
8089
  static error(...args) {
8087
- this.log(LogLevel.Error, ...args);
8090
+ this.log(3 /* Error */, ...args);
8088
8091
  }
8089
8092
  static log(level, ...args) {
8090
8093
  if (this.logLevel > level) {
8091
8094
  return;
8092
8095
  }
8093
8096
  switch (level) {
8094
- case LogLevel.Debug: {
8097
+ case 0 /* Debug */: {
8095
8098
  console.debug(...args);
8096
8099
  break;
8097
8100
  }
8098
- case LogLevel.Info: {
8101
+ case 1 /* Info */: {
8099
8102
  console.info(...args);
8100
8103
  break;
8101
8104
  }
8102
- case LogLevel.Warn: {
8105
+ case 2 /* Warn */: {
8103
8106
  console.warn(...args);
8104
8107
  break;
8105
8108
  }
8106
- case LogLevel.Error: {
8109
+ case 3 /* Error */: {
8107
8110
  console.error(...args);
8108
8111
  break;
8109
8112
  }
8110
8113
  }
8111
8114
  }
8112
8115
  };
8113
- __publicField(Logger, "logLevel", LogLevel.Warn);
8116
+ Logger.logLevel = 2 /* Warn */;
8114
8117
 
8115
8118
  // src/flatgeobuf/3.27.2/packedrtree.ts
8116
8119
  var NODE_ITEM_BYTE_LEN = 8 * 4 + 8;
@@ -8172,12 +8175,7 @@ var __exports__ = (() => {
8172
8175
  return `[NodeRange level: ${this._level}, nodes: ${this.nodes[0]}-${this.nodes[1]}]`;
8173
8176
  }
8174
8177
  }
8175
- const {
8176
- minX,
8177
- minY,
8178
- maxX,
8179
- maxY
8180
- } = rect;
8178
+ const { minX, minY, maxX, maxY } = rect;
8181
8179
  Logger.info(`tree items: ${numItems}, nodeSize: ${nodeSize}`);
8182
8180
  const levelBounds = generateLevelBounds(numItems, nodeSize);
8183
8181
  const firstLeafNodeIdx = levelBounds[0][0];
@@ -8187,7 +8185,9 @@ var __exports__ = (() => {
8187
8185
  return new NodeRange(range, level);
8188
8186
  })();
8189
8187
  const queue = [rootNodeRange];
8190
- Logger.debug(`starting stream search with queue: ${queue}, numItems: ${numItems}, nodeSize: ${nodeSize}, levelBounds: ${levelBounds}`);
8188
+ Logger.debug(
8189
+ `starting stream search with queue: ${queue}, numItems: ${numItems}, nodeSize: ${nodeSize}, levelBounds: ${levelBounds}`
8190
+ );
8191
8191
  while (queue.length != 0) {
8192
8192
  const nodeRange = queue.shift();
8193
8193
  Logger.debug(`popped node: ${nodeRange}, queueLength: ${queue.length}`);
@@ -8202,7 +8202,10 @@ var __exports__ = (() => {
8202
8202
  return nodeIdx;
8203
8203
  })();
8204
8204
  const numNodesInRange = nodeRangeEndIdx - nodeRangeStartIdx;
8205
- const buffer = await readNode(nodeRangeStartIdx * NODE_ITEM_BYTE_LEN, numNodesInRange * NODE_ITEM_BYTE_LEN);
8205
+ const buffer = await readNode(
8206
+ nodeRangeStartIdx * NODE_ITEM_BYTE_LEN,
8207
+ numNodesInRange * NODE_ITEM_BYTE_LEN
8208
+ );
8206
8209
  const dataView = new DataView(buffer);
8207
8210
  for (let nodeIdx = nodeRangeStartIdx; nodeIdx < nodeRangeEndIdx; nodeIdx++) {
8208
8211
  const nodeIdxInDataView = nodeIdx - nodeRangeStartIdx;
@@ -8234,7 +8237,9 @@ var __exports__ = (() => {
8234
8237
  const extraRequestThresholdNodes = Config.global.extraRequestThreshold() / NODE_ITEM_BYTE_LEN;
8235
8238
  const nearestNodeRange = queue[queue.length - 1];
8236
8239
  if (nearestNodeRange !== void 0 && nearestNodeRange.level() == nodeRange.level() - 1 && firstChildNodeIdx < nearestNodeRange.endNodeIdx() + extraRequestThresholdNodes) {
8237
- Logger.debug(`Merging "nodeRange" request into existing range: ${nearestNodeRange}, newEndNodeIdx: ${nearestNodeRange.endNodeIdx()} -> ${firstChildNodeIdx}`);
8240
+ Logger.debug(
8241
+ `Merging "nodeRange" request into existing range: ${nearestNodeRange}, newEndNodeIdx: ${nearestNodeRange.endNodeIdx()} -> ${firstChildNodeIdx}`
8242
+ );
8238
8243
  nearestNodeRange.extendEndNodeIdx(Number(firstChildNodeIdx));
8239
8244
  continue;
8240
8245
  }
@@ -8244,9 +8249,13 @@ var __exports__ = (() => {
8244
8249
  return new NodeRange(range, level);
8245
8250
  })();
8246
8251
  if (nearestNodeRange !== void 0 && nearestNodeRange.level() == newNodeRange.level()) {
8247
- Logger.info(`Same level, but too far away. Pushing new request for nodeIdx: ${firstChildNodeIdx} rather than merging with distant ${nearestNodeRange}`);
8252
+ Logger.info(
8253
+ `Same level, but too far away. Pushing new request for nodeIdx: ${firstChildNodeIdx} rather than merging with distant ${nearestNodeRange}`
8254
+ );
8248
8255
  } else {
8249
- Logger.info(`Pushing new level for ${newNodeRange} onto queue with nearestNodeRange: ${nearestNodeRange} since there's not already a range for this level.`);
8256
+ Logger.info(
8257
+ `Pushing new level for ${newNodeRange} onto queue with nearestNodeRange: ${nearestNodeRange} since there's not already a range for this level.`
8258
+ );
8250
8259
  }
8251
8260
  queue.push(newNodeRange);
8252
8261
  }
@@ -8254,7 +8263,16 @@ var __exports__ = (() => {
8254
8263
  }
8255
8264
 
8256
8265
  // src/flatgeobuf/3.27.2/constants.ts
8257
- var magicbytes = new Uint8Array([102, 103, 98, 3, 102, 103, 98, 0]);
8266
+ var magicbytes = new Uint8Array([
8267
+ 102,
8268
+ 103,
8269
+ 98,
8270
+ 3,
8271
+ 102,
8272
+ 103,
8273
+ 98,
8274
+ 0
8275
+ ]);
8258
8276
  var SIZE_PREFIX_LEN = 4;
8259
8277
 
8260
8278
  // src/flatgeobuf/3.27.2/http-reader.ts
@@ -8265,6 +8283,9 @@ var __exports__ = (() => {
8265
8283
  this.headerLength = headerLength;
8266
8284
  this.indexLength = indexLength;
8267
8285
  }
8286
+ // Fetch the header, preparing the reader to read Feature data.
8287
+ //
8288
+ // and potentially some opportunistic fetching of the index.
8268
8289
  static async open(url) {
8269
8290
  const assumedHeaderLength = 2024;
8270
8291
  const headerClient = new BufferedHttpRangeClient(url);
@@ -8280,7 +8301,9 @@ var __exports__ = (() => {
8280
8301
  return result;
8281
8302
  })();
8282
8303
  const minReqLength = assumedHeaderLength + assumedIndexLength;
8283
- Logger.debug(`fetching header. minReqLength: ${minReqLength} (assumedHeaderLength: ${assumedHeaderLength}, assumedIndexLength: ${assumedIndexLength})`);
8304
+ Logger.debug(
8305
+ `fetching header. minReqLength: ${minReqLength} (assumedHeaderLength: ${assumedHeaderLength}, assumedIndexLength: ${assumedIndexLength})`
8306
+ );
8284
8307
  {
8285
8308
  const bytes2 = new Uint8Array(await headerClient.getRange(0, 8, minReqLength, "header"));
8286
8309
  if (!bytes2.subarray(0, 3).every((v, i) => magicbytes[i] === v)) {
@@ -8311,11 +8334,21 @@ var __exports__ = (() => {
8311
8334
  const bufferedClient = this.headerClient;
8312
8335
  const readNode = async function(offsetIntoTree, size) {
8313
8336
  const minReqLength = 0;
8314
- return bufferedClient.getRange(lengthBeforeTree + offsetIntoTree, size, minReqLength, "index");
8337
+ return bufferedClient.getRange(
8338
+ lengthBeforeTree + offsetIntoTree,
8339
+ size,
8340
+ minReqLength,
8341
+ "index"
8342
+ );
8315
8343
  };
8316
8344
  const batches = [];
8317
8345
  let currentBatch = [];
8318
- for await (const searchResult of streamSearch(this.header.featuresCount, this.header.indexNodeSize, rect, readNode)) {
8346
+ for await (const searchResult of streamSearch(
8347
+ this.header.featuresCount,
8348
+ this.header.indexNodeSize,
8349
+ rect,
8350
+ readNode
8351
+ )) {
8319
8352
  const [featureOffset, ,] = searchResult;
8320
8353
  let [, , featureLength] = searchResult;
8321
8354
  if (!featureLength) {
@@ -8339,7 +8372,9 @@ var __exports__ = (() => {
8339
8372
  if (currentBatch.length > 0) {
8340
8373
  batches.push(currentBatch);
8341
8374
  }
8342
- const promises = batches.flatMap((batch) => this.readFeatureBatch(batch));
8375
+ const promises = batches.flatMap(
8376
+ (batch) => this.readFeatureBatch(batch)
8377
+ );
8343
8378
  yield* Repeater.merge(promises);
8344
8379
  }
8345
8380
  lengthBeforeTree() {
@@ -8351,6 +8386,11 @@ var __exports__ = (() => {
8351
8386
  buildFeatureClient() {
8352
8387
  return new BufferedHttpRangeClient(this.headerClient.httpClient);
8353
8388
  }
8389
+ /**
8390
+ * Fetch a batch of features in a single request, yielding each Feature
8391
+ *
8392
+ * `batch`: [offset, length] of features in the batch
8393
+ */
8354
8394
  async *readFeatureBatch(batch) {
8355
8395
  const [firstFeatureOffset] = batch[0];
8356
8396
  const [lastFeatureOffset, lastFeatureLength] = batch[batch.length - 1];
@@ -8372,7 +8412,12 @@ var __exports__ = (() => {
8372
8412
  const bytes2 = await featureClient.getRange(offset, 4, minFeatureReqLength, "feature length");
8373
8413
  featureLength = new DataView(bytes2).getUint32(0, true);
8374
8414
  }
8375
- const byteBuffer = await featureClient.getRange(offset + 4, featureLength, minFeatureReqLength, "feature data");
8415
+ const byteBuffer = await featureClient.getRange(
8416
+ offset + 4,
8417
+ featureLength,
8418
+ minFeatureReqLength,
8419
+ "feature data"
8420
+ );
8376
8421
  const bytes = new Uint8Array(byteBuffer);
8377
8422
  const bytesAligned = new Uint8Array(featureLength + SIZE_PREFIX_LEN);
8378
8423
  bytesAligned.set(bytes, SIZE_PREFIX_LEN);
@@ -8382,11 +8427,13 @@ var __exports__ = (() => {
8382
8427
  }
8383
8428
  };
8384
8429
  var BufferedHttpRangeClient = class {
8385
- bytesEverUsed = 0;
8386
- bytesEverFetched = 0;
8387
- buffer = new ArrayBuffer(0);
8388
- head = 0;
8389
8430
  constructor(source) {
8431
+ this.bytesEverUsed = 0;
8432
+ this.bytesEverFetched = 0;
8433
+ this.buffer = new ArrayBuffer(0);
8434
+ // Byte offset of `buffer` with respect to the beginning of the file being
8435
+ // buffered
8436
+ this.head = 0;
8390
8437
  if (typeof source === "string") {
8391
8438
  this.httpClient = new HttpRangeClient(source);
8392
8439
  } else if (source instanceof HttpRangeClient) {
@@ -8418,19 +8465,48 @@ var __exports__ = (() => {
8418
8465
  }
8419
8466
  };
8420
8467
  var HttpRangeClient = class {
8421
- requestsEverMade = 0;
8422
- bytesEverRequested = 0;
8423
8468
  constructor(url) {
8469
+ this.requestsEverMade = 0;
8470
+ this.bytesEverRequested = 0;
8424
8471
  this.url = url;
8425
8472
  }
8426
8473
  async getRange(begin, length, purpose) {
8427
8474
  this.requestsEverMade += 1;
8428
8475
  this.bytesEverRequested += length;
8429
8476
  const range = `bytes=${begin}-${begin + length - 1}`;
8430
- Logger.info(`request: #${this.requestsEverMade}, purpose: ${purpose}), bytes: (this_request: ${length}, ever: ${this.bytesEverRequested}), Range: ${range}`);
8477
+ Logger.info(
8478
+ `request: #${this.requestsEverMade}, purpose: ${purpose}), bytes: (this_request: ${length}, ever: ${this.bytesEverRequested}), Range: ${range}`
8479
+ );
8431
8480
  const response = await fetch(this.url, {
8432
8481
  headers: {
8433
8482
  Range: range
8483
+ // TODO: better parallelize requests on Chrome
8484
+ //
8485
+ // Safari and Firefox have no issue performing Range requests
8486
+ // for a resource in parallel, but Chrome will stall a
8487
+ // subsequent request to the resource until it's received the
8488
+ // response headers of the prior request. So, it still allows
8489
+ // some limited parallelization, but it's not ideal.
8490
+ //
8491
+ // This is seemingly an artifact of how Chrome manages caching
8492
+ // and it might differ between platforms. We could work around it
8493
+ // by setting the request header:
8494
+ //
8495
+ // 'Cache-Control': 'no-cache, no-store'
8496
+ //
8497
+ // This allows requests to be fully parallelized in Chrome, but
8498
+ // then Chrome won't cache the response, so it seems not a
8499
+ // great trade-off.
8500
+ //
8501
+ // Another work around would be to make each Range request for
8502
+ // a separate URL by appending something like
8503
+ // `?cache_buster=<range>` to the URL, but then Chrome will
8504
+ // require an additional CORS preflight OPTIONS requests per
8505
+ // Range, which is also not a great trade-off.
8506
+ //
8507
+ // See:
8508
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=969828&q=concurrent%20range%20requests&can=2
8509
+ // https://stackoverflow.com/questions/27513994/chrome-stalls-when-making-multiple-requests-to-same-resource
8434
8510
  }
8435
8511
  });
8436
8512
  return response.arrayBuffer();
@@ -8448,10 +8524,7 @@ var __exports__ = (() => {
8448
8524
  if (headerMetaFn)
8449
8525
  headerMetaFn(headerMeta);
8450
8526
  let offset = magicbytes.length + SIZE_PREFIX_LEN + headerLength;
8451
- const {
8452
- indexNodeSize,
8453
- featuresCount
8454
- } = headerMeta;
8527
+ const { indexNodeSize, featuresCount } = headerMeta;
8455
8528
  if (indexNodeSize > 0)
8456
8529
  offset += calcTreeSize(featuresCount, indexNodeSize);
8457
8530
  const features = [];
@@ -8478,10 +8551,7 @@ var __exports__ = (() => {
8478
8551
  const headerMeta = fromByteBuffer(bb);
8479
8552
  if (headerMetaFn)
8480
8553
  headerMetaFn(headerMeta);
8481
- const {
8482
- indexNodeSize,
8483
- featuresCount
8484
- } = headerMeta;
8554
+ const { indexNodeSize, featuresCount } = headerMeta;
8485
8555
  if (indexNodeSize > 0) {
8486
8556
  const treeSize = calcTreeSize(featuresCount, indexNodeSize);
8487
8557
  await read(treeSize, "entire index, w/o rect");
@@ -8565,10 +8635,7 @@ var __exports__ = (() => {
8565
8635
  }
8566
8636
  case "columnar-table":
8567
8637
  const binary = parseFlatGeobufToBinary(arrayBuffer, options);
8568
- return {
8569
- shape: "columnar-table",
8570
- data: binary
8571
- };
8638
+ return { shape: "columnar-table", data: binary };
8572
8639
  case "binary":
8573
8640
  return parseFlatGeobufToBinary(arrayBuffer, options);
8574
8641
  default:
@@ -8581,22 +8648,13 @@ var __exports__ = (() => {
8581
8648
  }
8582
8649
  function parseFlatGeobufToGeoJSONTable(arrayBuffer, options = {}) {
8583
8650
  if (arrayBuffer.byteLength === 0) {
8584
- return {
8585
- shape: "geojson-table",
8586
- type: "FeatureCollection",
8587
- features: []
8588
- };
8651
+ return { shape: "geojson-table", type: "FeatureCollection", features: [] };
8589
8652
  }
8590
- const {
8591
- reproject = false,
8592
- _targetCrs = "WGS84"
8593
- } = options && options.gis || {};
8653
+ const { reproject = false, _targetCrs = "WGS84" } = options && options.gis || {};
8594
8654
  const arr = new Uint8Array(arrayBuffer);
8595
8655
  let fgbHeader;
8596
8656
  let schema;
8597
- let {
8598
- features
8599
- } = deserializeGeoJson(arr, void 0, (headerMeta) => {
8657
+ let { features } = deserializeGeoJson(arr, void 0, (headerMeta) => {
8600
8658
  fgbHeader = headerMeta;
8601
8659
  schema = getSchemaFromFGBHeader(fgbHeader);
8602
8660
  });
@@ -8604,22 +8662,14 @@ var __exports__ = (() => {
8604
8662
  let projection;
8605
8663
  if (reproject && crs) {
8606
8664
  try {
8607
- projection = new Proj4Projection({
8608
- from: crs.wkt,
8609
- to: _targetCrs
8610
- });
8665
+ projection = new Proj4Projection({ from: crs.wkt, to: _targetCrs });
8611
8666
  } catch (e) {
8612
8667
  }
8613
8668
  }
8614
8669
  if (projection) {
8615
8670
  features = transformGeoJsonCoords(features, (coords) => projection.project(coords));
8616
8671
  }
8617
- return {
8618
- shape: "geojson-table",
8619
- schema,
8620
- type: "FeatureCollection",
8621
- features
8622
- };
8672
+ return { shape: "geojson-table", schema, type: "FeatureCollection", features };
8623
8673
  }
8624
8674
  function parseFlatGeobufInBatches(stream, options) {
8625
8675
  const shape = options.flatgeobuf?.shape;
@@ -8637,10 +8687,7 @@ var __exports__ = (() => {
8637
8687
  return iterator;
8638
8688
  }
8639
8689
  async function* parseFlatGeobufInBatchesToGeoJSON(stream, options) {
8640
- const {
8641
- reproject = false,
8642
- _targetCrs = "WGS84"
8643
- } = options && options.gis || {};
8690
+ const { reproject = false, _targetCrs = "WGS84" } = options && options.gis || {};
8644
8691
  let fgbHeader;
8645
8692
  const iterator = deserializeGeoJson(stream, void 0, (headerMeta) => {
8646
8693
  fgbHeader = headerMeta;
@@ -8651,10 +8698,7 @@ var __exports__ = (() => {
8651
8698
  if (firstRecord) {
8652
8699
  const crs = fgbHeader && fgbHeader.crs;
8653
8700
  if (reproject && crs) {
8654
- projection = new Proj4Projection({
8655
- from: crs.wkt,
8656
- to: _targetCrs
8657
- });
8701
+ projection = new Proj4Projection({ from: crs.wkt, to: _targetCrs });
8658
8702
  }
8659
8703
  firstRecord = false;
8660
8704
  }
@@ -8667,7 +8711,7 @@ var __exports__ = (() => {
8667
8711
  }
8668
8712
 
8669
8713
  // src/flatgeobuf-loader.ts
8670
- var VERSION = true ? "4.2.0-alpha.4" : "latest";
8714
+ var VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
8671
8715
  var FGB_MAGIC_NUMBER = [102, 103, 98, 3, 102, 103, 98, 1];
8672
8716
  var FlatGeobufWorkerLoader = {
8673
8717
  id: "flatgeobuf",
@@ -8692,10 +8736,11 @@ var __exports__ = (() => {
8692
8736
  ...FlatGeobufWorkerLoader,
8693
8737
  parse: async (arrayBuffer, options) => parseFlatGeobuf(arrayBuffer, options),
8694
8738
  parseSync: parseFlatGeobuf,
8739
+ // @ts-expect-error this is a stream parser not an async iterator parser
8695
8740
  parseInBatchesFromStream: parseFlatGeobufInBatches,
8696
8741
  binary: true
8697
8742
  };
8698
- return __toCommonJS(src_exports);
8743
+ return __toCommonJS(bundle_exports);
8699
8744
  })();
8700
8745
  /*! Bundled license information:
8701
8746