@loaders.gl/flatgeobuf 4.2.0-alpha.4 → 4.2.0-alpha.6

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