@loaders.gl/core 5.0.0-beta.4 → 5.0.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. package/GEOARROW-README.md +1 -1
  2. package/README.md +1 -1
  3. package/SCAN-README.md +1 -1
  4. package/SCHEMA-UTILS-README.md +1 -1
  5. package/dist/arrow-geometry/binary-geometry-to-wkb.cjs +2 -2
  6. package/dist/arrow-geometry/binary-geometry-to-wkb.cjs.map +2 -2
  7. package/dist/arrow-geometry/binary-geometry-to-wkb.js +1 -1
  8. package/dist/arrow-geometry/binary-geometry-to-wkb.js.map +1 -1
  9. package/dist/arrow-geometry/geojson-table.cjs +3 -3
  10. package/dist/arrow-geometry/geojson-table.cjs.map +2 -2
  11. package/dist/arrow-geometry/geojson-table.js +2 -2
  12. package/dist/arrow-geometry/geojson-table.js.map +1 -1
  13. package/dist/arrow-geometry/geometry-codecs.cjs +6 -6
  14. package/dist/arrow-geometry/geometry-codecs.cjs.map +2 -2
  15. package/dist/arrow-geometry/geometry-codecs.js +1 -1
  16. package/dist/arrow-geometry/geometry-codecs.js.map +1 -1
  17. package/dist/arrow-geometry/geometry-to-wkt.cjs +2 -2
  18. package/dist/arrow-geometry/geometry-to-wkt.cjs.map +2 -2
  19. package/dist/arrow-geometry/geometry-to-wkt.js +1 -1
  20. package/dist/arrow-geometry/geometry-to-wkt.js.map +1 -1
  21. package/dist/arrow-geometry/index.cjs +0 -11
  22. package/dist/arrow-geometry/index.cjs.map +2 -2
  23. package/dist/arrow-geometry/index.d.ts +0 -1
  24. package/dist/arrow-geometry/index.d.ts.map +1 -1
  25. package/dist/arrow-geometry/index.js +0 -1
  26. package/dist/arrow-geometry/index.js.map +1 -1
  27. package/dist/arrow-geometry/wkb-builder.cjs +3 -3
  28. package/dist/arrow-geometry/wkb-builder.cjs.map +2 -2
  29. package/dist/arrow-geometry/wkb-builder.d.ts +1 -1
  30. package/dist/arrow-geometry/wkb-builder.d.ts.map +1 -1
  31. package/dist/arrow-geometry/wkb-builder.js +1 -1
  32. package/dist/arrow-geometry/wkb-builder.js.map +1 -1
  33. package/dist/arrow-geometry/wkb-statistics.cjs +2 -2
  34. package/dist/arrow-geometry/wkb-statistics.cjs.map +2 -2
  35. package/dist/arrow-geometry/wkb-statistics.js +1 -1
  36. package/dist/arrow-geometry/wkb-statistics.js.map +1 -1
  37. package/dist/arrow-worker-transport.cjs +81 -0
  38. package/dist/arrow-worker-transport.cjs.map +6 -0
  39. package/dist/arrow-worker-transport.d.ts +9 -0
  40. package/dist/arrow-worker-transport.d.ts.map +1 -0
  41. package/dist/arrow-worker-transport.js +60 -0
  42. package/dist/arrow-worker-transport.js.map +1 -0
  43. package/dist/cluster-source.cjs +153 -584
  44. package/dist/cluster-source.cjs.map +3 -3
  45. package/dist/dist.dev.js +546 -54
  46. package/dist/dist.min.js +3 -3
  47. package/dist/geoarrow/binary-polygon-to-geoarrow.cjs +2 -2
  48. package/dist/geoarrow/binary-polygon-to-geoarrow.cjs.map +2 -2
  49. package/dist/geoarrow/binary-polygon-to-geoarrow.d.ts +1 -1
  50. package/dist/geoarrow/binary-polygon-to-geoarrow.d.ts.map +1 -1
  51. package/dist/geoarrow/binary-polygon-to-geoarrow.js +1 -1
  52. package/dist/geoarrow/binary-polygon-to-geoarrow.js.map +1 -1
  53. package/dist/geoarrow/geoarrow-bounds.cjs +7 -7
  54. package/dist/geoarrow/geoarrow-bounds.cjs.map +2 -2
  55. package/dist/geoarrow/geoarrow-bounds.js +3 -3
  56. package/dist/geoarrow/geoarrow-bounds.js.map +1 -1
  57. package/dist/geoarrow/geoarrow-capabilities.cjs +2 -2
  58. package/dist/geoarrow/geoarrow-capabilities.cjs.map +2 -2
  59. package/dist/geoarrow/geoarrow-capabilities.js +1 -1
  60. package/dist/geoarrow/geoarrow-capabilities.js.map +1 -1
  61. package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.cjs +8 -8
  62. package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.cjs.map +2 -2
  63. package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.js +2 -2
  64. package/dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.js.map +1 -1
  65. package/dist/geoarrow/geoarrow-converter/geoarrow-converter.d.ts +2 -2
  66. package/dist/geoarrow/geoarrow-inspection.cjs +2 -2
  67. package/dist/geoarrow/geoarrow-inspection.cjs.map +2 -2
  68. package/dist/geoarrow/geoarrow-inspection.js +1 -1
  69. package/dist/geoarrow/geoarrow-inspection.js.map +1 -1
  70. package/dist/geoarrow/geoarrow-stream.cjs +1 -1
  71. package/dist/geoarrow/geoarrow-stream.cjs.map +2 -2
  72. package/dist/geoarrow/geoarrow-stream.js +1 -1
  73. package/dist/geoarrow/geoarrow-stream.js.map +1 -1
  74. package/dist/geoarrow/get-geoarrow-vertex-count.cjs +2 -2
  75. package/dist/geoarrow/get-geoarrow-vertex-count.cjs.map +2 -2
  76. package/dist/geoarrow/get-geoarrow-vertex-count.js +1 -1
  77. package/dist/geoarrow/get-geoarrow-vertex-count.js.map +1 -1
  78. package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.cjs +4 -4
  79. package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.cjs.map +2 -2
  80. package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.js +1 -1
  81. package/dist/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.js.map +1 -1
  82. package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.cjs +3 -3
  83. package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.cjs.map +2 -2
  84. package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.js +1 -1
  85. package/dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.js.map +1 -1
  86. package/dist/geoarrow/lib/kernels/encode-geoarrow-box.cjs +3 -3
  87. package/dist/geoarrow/lib/kernels/encode-geoarrow-box.cjs.map +2 -2
  88. package/dist/geoarrow/lib/kernels/encode-geoarrow-box.js +1 -1
  89. package/dist/geoarrow/lib/kernels/encode-geoarrow-box.js.map +1 -1
  90. package/dist/index.cjs +8 -11
  91. package/dist/index.cjs.map +3 -3
  92. package/dist/lib/init.js +1 -1
  93. package/dist/loader-utils/index.cjs +20 -23
  94. package/dist/loader-utils/index.cjs.map +3 -3
  95. package/dist/loader-utils/index.js +1 -1
  96. package/dist/loader-utils/json-loader.js +1 -1
  97. package/dist/loader-utils/lib/log-utils/log.js +1 -1
  98. package/dist/null-loader.js +1 -1
  99. package/dist/null-worker-node.js +244 -11
  100. package/dist/null-worker.js +239 -11
  101. package/dist/schema/geometry/geoarrow.d.ts +3 -6
  102. package/dist/schema/geometry/geoarrow.d.ts.map +1 -1
  103. package/dist/worker-utils/index.cjs +19 -26
  104. package/dist/worker-utils/index.cjs.map +3 -3
  105. package/dist/worker-utils/index.d.ts +0 -3
  106. package/dist/worker-utils/index.d.ts.map +1 -1
  107. package/dist/worker-utils/index.js +0 -3
  108. package/dist/worker-utils/index.js.map +1 -1
  109. package/dist/worker-utils/lib/env-utils/version.js +1 -1
  110. package/dist/worker-utils/lib/worker-api/process-on-worker.d.ts +1 -1
  111. package/dist/worker-utils/lib/worker-api/process-on-worker.d.ts.map +1 -1
  112. package/dist/worker-utils/lib/worker-api/process-on-worker.js +1 -1
  113. package/dist/worker-utils/lib/worker-api/process-on-worker.js.map +1 -1
  114. package/dist/worker-utils/lib/worker-api/task-runtime.d.ts +1 -1
  115. package/dist/worker-utils/lib/worker-api/task-runtime.d.ts.map +1 -1
  116. package/dist/worker-utils/lib/worker-api/task-runtime.js +1 -1
  117. package/dist/worker-utils/lib/worker-api/task-runtime.js.map +1 -1
  118. package/dist/worker-utils/null-worker-node.js +243 -10
  119. package/dist/worker-utils/null-worker-node.js.map +4 -4
  120. package/dist/worker-utils/null-worker.js +238 -10
  121. package/dist/worker-utils/null-worker.js.map +4 -4
  122. package/dist/worker-utils/types.d.ts +1 -1
  123. package/dist/worker-utils/types.d.ts.map +1 -1
  124. package/package.json +13 -11
  125. package/src/arrow-geometry/binary-geometry-to-wkb.ts +1 -1
  126. package/src/arrow-geometry/geojson-table.ts +2 -2
  127. package/src/arrow-geometry/geometry-codecs.ts +2 -2
  128. package/src/arrow-geometry/geometry-to-wkt.ts +2 -2
  129. package/src/arrow-geometry/index.ts +0 -9
  130. package/src/arrow-geometry/wkb-builder.ts +2 -2
  131. package/src/arrow-geometry/wkb-statistics.ts +2 -2
  132. package/src/arrow-worker-transport.ts +87 -0
  133. package/src/geoarrow/binary-polygon-to-geoarrow.ts +2 -2
  134. package/src/geoarrow/geoarrow-bounds.ts +3 -3
  135. package/src/geoarrow/geoarrow-capabilities.ts +1 -1
  136. package/src/geoarrow/geoarrow-converter/convert-geoarrow-geometry.ts +3 -3
  137. package/src/geoarrow/geoarrow-inspection.ts +2 -2
  138. package/src/geoarrow/geoarrow-stream.ts +1 -1
  139. package/src/geoarrow/get-geoarrow-vertex-count.ts +1 -1
  140. package/src/geoarrow/lib/geometry-converters/wkb/convert-wkb-to-binary-geometry.ts +1 -1
  141. package/src/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.ts +2 -2
  142. package/src/geoarrow/lib/kernels/encode-geoarrow-box.ts +1 -1
  143. package/src/loader-utils/index.ts +1 -1
  144. package/src/schema/geometry/geoarrow.ts +8 -19
  145. package/src/worker-utils/index.ts +0 -16
  146. package/src/worker-utils/lib/worker-api/create-worker.ts +1 -1
  147. package/src/worker-utils/lib/worker-api/process-on-worker.ts +1 -6
  148. package/src/worker-utils/lib/worker-api/task-runtime.ts +1 -1
  149. package/src/worker-utils/types.ts +1 -1
  150. package/dist/arrow-geometry/arrow-geoarrow-adapter.cjs +0 -477
  151. package/dist/arrow-geometry/arrow-geoarrow-adapter.cjs.map +0 -7
  152. package/dist/arrow-geometry/arrow-geoarrow-adapter.d.ts +0 -29
  153. package/dist/arrow-geometry/arrow-geoarrow-adapter.d.ts.map +0 -1
  154. package/dist/arrow-geometry/arrow-geoarrow-adapter.js +0 -434
  155. package/dist/arrow-geometry/arrow-geoarrow-adapter.js.map +0 -1
  156. package/dist/geoarrow/lib/arrow-geoarrow-adapter.cjs +0 -39
  157. package/dist/geoarrow/lib/arrow-geoarrow-adapter.cjs.map +0 -7
  158. package/dist/geoarrow/lib/arrow-geoarrow-adapter.d.ts +0 -2
  159. package/dist/geoarrow/lib/arrow-geoarrow-adapter.d.ts.map +0 -1
  160. package/dist/geoarrow/lib/arrow-geoarrow-adapter.js +0 -5
  161. package/dist/geoarrow/lib/arrow-geoarrow-adapter.js.map +0 -1
  162. package/dist/schema-utils/arrow-transport.cjs +0 -691
  163. package/dist/schema-utils/arrow-transport.cjs.map +0 -6
  164. package/dist/schema-utils/arrow-transport.d.ts +0 -4
  165. package/dist/schema-utils/arrow-transport.d.ts.map +0 -1
  166. package/dist/schema-utils/arrow-transport.js +0 -7
  167. package/dist/schema-utils/arrow-transport.js.map +0 -1
  168. package/dist/schema-utils/lib/arrow/arrow-table-transport.d.ts +0 -76
  169. package/dist/schema-utils/lib/arrow/arrow-table-transport.d.ts.map +0 -1
  170. package/dist/schema-utils/lib/arrow/arrow-table-transport.js +0 -182
  171. package/dist/schema-utils/lib/arrow/arrow-table-transport.js.map +0 -1
  172. package/dist/schema-utils/lib/arrow/split-arrow-buffers.d.ts +0 -33
  173. package/dist/schema-utils/lib/arrow/split-arrow-buffers.d.ts.map +0 -1
  174. package/dist/schema-utils/lib/arrow/split-arrow-buffers.js +0 -134
  175. package/dist/schema-utils/lib/arrow/split-arrow-buffers.js.map +0 -1
  176. package/src/arrow-geometry/arrow-geoarrow-adapter.ts +0 -568
  177. package/src/geoarrow/lib/arrow-geoarrow-adapter.ts +0 -12
  178. package/src/schema-utils/arrow-transport.ts +0 -7
  179. package/src/schema-utils/lib/arrow/arrow-table-transport.ts +0 -282
  180. package/src/schema-utils/lib/arrow/split-arrow-buffers.ts +0 -247
@@ -491,7 +491,7 @@ function unavailableCoreApiMethod(methodName) {
491
491
  }
492
492
 
493
493
  // src/arrow-geometry/geometry-codecs.ts
494
- var import_geospatial2 = require("@math.gl/geospatial");
494
+ var import_wkb2 = require("@math.gl/arrow/wkb");
495
495
 
496
496
  // src/arrow-geometry/geometry-utils.ts
497
497
  function normalizeEmptyPoints(geometry) {
@@ -512,14 +512,14 @@ function normalizeEmptyPoints(geometry) {
512
512
  }
513
513
 
514
514
  // src/arrow-geometry/geometry-to-wkt.ts
515
- var import_geospatial = require("@math.gl/geospatial");
515
+ var import_wkb = require("@math.gl/arrow/wkb");
516
516
  function convertGeometryToWKT(geometry, options) {
517
517
  const dimension = getWKTDimension(geometry, options);
518
518
  if (geometry.type === "GeometryCollection" && !(options == null ? void 0 : options.dimension) && !(options == null ? void 0 : options.hasZ) && !(options == null ? void 0 : options.hasM) && (hasMixedChildDimensions(geometry) || hasDeclaredChildDimensions(geometry))) {
519
519
  if (geometry.geometries.length === 0) return "GEOMETRYCOLLECTION EMPTY";
520
520
  return `GEOMETRYCOLLECTION (${geometry.geometries.map((child) => convertGeometryToWKT(child)).join(", ")})`;
521
521
  }
522
- return (0, import_geospatial.formatWKT)(normalizeGeometryDimension(geometry, dimension), dimension);
522
+ return (0, import_wkb.formatWKT)(normalizeGeometryDimension(geometry, dimension), dimension);
523
523
  }
524
524
  function normalizeGeometryDimension(geometry, dimension) {
525
525
  if (geometry.type === "GeometryCollection") {
@@ -582,7 +582,7 @@ function getDimensionSize(dimension) {
582
582
  // src/arrow-geometry/geometry-codecs.ts
583
583
  function convertWKBToGeometry(input) {
584
584
  const bytes = ArrayBuffer.isView(input) ? new Uint8Array(input.buffer, input.byteOffset, input.byteLength) : new Uint8Array(input);
585
- return normalizeEmptyPoints((0, import_geospatial2.parseWKB)(bytes).geometry);
585
+ return normalizeEmptyPoints((0, import_wkb2.parseWKB)(bytes).geometry);
586
586
  }
587
587
  function convertGeometryToWKB(input, options = {}) {
588
588
  const geometry = input.type === "Feature" ? input.geometry : input;
@@ -593,7 +593,7 @@ function convertGeometryToWKB(input, options = {}) {
593
593
  }
594
594
  function encodeGeometry(geometry, dimension) {
595
595
  if (geometry.type !== "GeometryCollection") {
596
- return (0, import_geospatial2.writeWKB)(geometry, dimension);
596
+ return (0, import_wkb2.writeWKB)(geometry, dimension);
597
597
  }
598
598
  const children = geometry.geometries.map(
599
599
  (child) => encodeGeometry(
@@ -601,13 +601,13 @@ function encodeGeometry(geometry, dimension) {
601
601
  child.__geoarrowDimension ?? dimension
602
602
  )
603
603
  );
604
- const headerBuilder = new import_geospatial2.WKBBuilder({ mode: "measure", dimension });
604
+ const headerBuilder = new import_wkb2.WKBBuilder({ mode: "measure", dimension });
605
605
  headerBuilder.beginGeometry("GeometryCollection", children.length);
606
606
  const headerLength = headerBuilder.finishGeometry();
607
607
  const bytes = new Uint8Array(
608
608
  headerLength + children.reduce((total, child) => total + child.length, 0)
609
609
  );
610
- const writer = new import_geospatial2.WKBBuilder({ mode: "write", target: bytes, dimension });
610
+ const writer = new import_wkb2.WKBBuilder({ mode: "write", target: bytes, dimension });
611
611
  writer.beginGeometry("GeometryCollection", children.length);
612
612
  let byteOffset = writer.finishGeometry();
613
613
  for (const child of children) {
@@ -633,7 +633,7 @@ function convertWKTToGeometry(input, options) {
633
633
  }
634
634
  const collectionHeader = text.match(/^(\s*GEOMETRYCOLLECTION)\s+(?:ZM|Z|M)(?=\s|\()/i);
635
635
  const parseText = collectionHeader && dimension !== "xym" ? text.replace(collectionHeader[0], collectionHeader[1]) : text;
636
- const parsed = (0, import_geospatial2.parseWKTWithMetadata)(parseText, { inferDimensions: true });
636
+ const parsed = (0, import_wkb2.parseWKTWithMetadata)(parseText, { inferDimensions: true });
637
637
  const geometry = toGeometryWithDimensionMetadata(
638
638
  parsed,
639
639
  collectionHeader ? dimension : void 0
@@ -1475,13 +1475,13 @@ function deserializeArrowType(dataType, options) {
1475
1475
  }
1476
1476
  case "large-list": {
1477
1477
  const field = deserializeArrowField(dataType.children[0], options);
1478
- const LargeList10 = getOptionalArrowConstructor("LargeList");
1479
- if (!LargeList10) {
1478
+ const LargeList9 = getOptionalArrowConstructor("LargeList");
1479
+ if (!LargeList9) {
1480
1480
  throw new Error(
1481
1481
  "LargeList requires an Apache Arrow runtime that exports the LargeList constructor"
1482
1482
  );
1483
1483
  }
1484
- return new LargeList10(field);
1484
+ return new LargeList9(field);
1485
1485
  }
1486
1486
  case "fixed-size-list": {
1487
1487
  const child = deserializeArrowField(dataType.children[0], options);
@@ -1958,8 +1958,8 @@ function parseGeoArrowMetadata(value) {
1958
1958
  }
1959
1959
 
1960
1960
  // dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.js
1961
- var arrow15 = __toESM(require("apache-arrow"), 1);
1962
- var import_geoarrow = require("@math.gl/geospatial/geoarrow");
1961
+ var arrow14 = __toESM(require("apache-arrow"), 1);
1962
+ var import_geoarrow_utils = require("@math.gl/arrow/geoarrow-utils");
1963
1963
 
1964
1964
  // dist/geoarrow/lib/geometry-converters/convert-geoarrow-to-geojson.js
1965
1965
  function convertGeoArrowGeometryToGeoJSON(arrowCellValue, encoding) {
@@ -2092,7 +2092,7 @@ function isEmptyArrowCoordinate(arrowCoordinate) {
2092
2092
  var arrow5 = __toESM(require("apache-arrow"), 1);
2093
2093
 
2094
2094
  // dist/geoarrow/lib/geometry-converters/wkb/helpers/parse-wkb-header.js
2095
- var import_geospatial3 = require("@math.gl/geospatial");
2095
+ var import_wkb3 = require("@math.gl/arrow/wkb");
2096
2096
 
2097
2097
  // dist/geoarrow/lib/geometry-converters/wkb/helpers/wkb-types.js
2098
2098
  var WKBGeometryType;
@@ -2132,7 +2132,7 @@ function getWKTGeometryType(input) {
2132
2132
  }
2133
2133
 
2134
2134
  // dist/geoarrow/geoarrow-inspection.js
2135
- var import_geospatial4 = require("@math.gl/geospatial");
2135
+ var import_wkb4 = require("@math.gl/arrow/wkb");
2136
2136
 
2137
2137
  // dist/geoarrow/lib/kernels/geoarrow-union.js
2138
2138
  var arrow4 = __toESM(require("apache-arrow"), 1);
@@ -2276,7 +2276,7 @@ function inspectGeoArrowVector(column, encoding) {
2276
2276
  if (encoding === "geoarrow.wkb") {
2277
2277
  const bytes = value;
2278
2278
  try {
2279
- const header = (0, import_geospatial4.inspectWKBHeader)(bytes);
2279
+ const header = (0, import_wkb4.inspectWKBHeader)(bytes);
2280
2280
  dimensions.add(header.dimension);
2281
2281
  geometryTypes.add(getGeometryTypeName(header.geometryType, header.dimension));
2282
2282
  } catch {
@@ -2452,7 +2452,7 @@ function dimensionFromSize(size) {
2452
2452
  }
2453
2453
 
2454
2454
  // dist/geoarrow/lib/kernels/decode-wkt-native.js
2455
- var arrow8 = __toESM(require("apache-arrow"), 1);
2455
+ var arrow7 = __toESM(require("apache-arrow"), 1);
2456
2456
 
2457
2457
  // src/arrow-geometry/geoarrow-builder.ts
2458
2458
  var arrow6 = __toESM(require("apache-arrow"), 1);
@@ -2909,13 +2909,13 @@ function makeListData(child, offsets, fieldName, offsetType) {
2909
2909
  });
2910
2910
  }
2911
2911
  function makeLargeListType(field) {
2912
- const LargeList10 = getOptionalArrowConstructor2("LargeList");
2913
- if (!LargeList10) {
2912
+ const LargeList9 = getOptionalArrowConstructor2("LargeList");
2913
+ if (!LargeList9) {
2914
2914
  throw new Error(
2915
2915
  "64-bit GeoArrow offsets require an Apache Arrow runtime that exports LargeList"
2916
2916
  );
2917
2917
  }
2918
- return new LargeList10(field);
2918
+ return new LargeList9(field);
2919
2919
  }
2920
2920
  function getOptionalArrowConstructor2(typeName) {
2921
2921
  return arrow6[typeName];
@@ -2991,439 +2991,6 @@ function withNulls(data, geometryArray) {
2991
2991
  );
2992
2992
  }
2993
2993
 
2994
- // src/arrow-geometry/arrow-geoarrow-adapter.ts
2995
- var arrow7 = __toESM(require("apache-arrow"), 1);
2996
- function makeGeoArrowColumnFromArrowVector(vector, options = {}) {
2997
- const encoding = options.encoding ?? inferGeoArrowEncodingFromArrowType(vector.type);
2998
- const dimension = options.dimension ?? (isSerializedArrowType(vector.type) ? "xy" : inferGeoArrowDimensionFromArrowType(vector.type));
2999
- const coordinateLayout = options.coordinateLayout === void 0 ? inferGeoArrowCoordinateLayoutFromArrowType(vector.type) : options.coordinateLayout;
3000
- return {
3001
- encoding,
3002
- dimension,
3003
- coordinateLayout,
3004
- chunks: vector.data.map((data) => makeGeoArrowArrayFromArrowData(data)),
3005
- metadata: options.metadata
3006
- };
3007
- }
3008
- function makeArrowVectorFromGeoArrowColumn(column) {
3009
- return new arrow7.Vector(
3010
- column.chunks.map(
3011
- (chunk) => makeArrowDataFromGeoArrowArray(chunk, column.dimension, column.coordinateLayout)
3012
- )
3013
- );
3014
- }
3015
- function inferGeoArrowEncodingFromArrowType(type) {
3016
- if (arrow7.DataType.isDenseUnion(type)) return "geoarrow.geometry";
3017
- if (arrow7.DataType.isBinary(type) || arrow7.DataType.isLargeBinary(type) || arrow7.DataType.isBinaryView(type)) {
3018
- return "geoarrow.wkb";
3019
- }
3020
- if (arrow7.DataType.isUtf8(type) || arrow7.DataType.isLargeUtf8(type) || arrow7.DataType.isUtf8View(type)) {
3021
- return "geoarrow.wkt";
3022
- }
3023
- const nesting = getArrowListNesting(type);
3024
- switch (nesting) {
3025
- case 0:
3026
- return "geoarrow.point";
3027
- case 1:
3028
- return "geoarrow.linestring";
3029
- case 2:
3030
- return "geoarrow.polygon";
3031
- case 3:
3032
- return "geoarrow.multipolygon";
3033
- default:
3034
- throw new Error(`Cannot infer GeoArrow encoding from Arrow type ${type.toString()}`);
3035
- }
3036
- }
3037
- function inferGeoArrowDimensionFromArrowType(type) {
3038
- var _a;
3039
- if (arrow7.DataType.isFixedSizeList(type)) {
3040
- const dimensionName = (_a = type.children[0]) == null ? void 0 : _a.name.toLowerCase();
3041
- if (isGeoArrowDimension(dimensionName)) return dimensionName;
3042
- switch (type.listSize) {
3043
- case 2:
3044
- return "xy";
3045
- case 3:
3046
- return "xyz";
3047
- case 4:
3048
- return "xyzm";
3049
- default:
3050
- throw new Error(
3051
- `GeoArrow coordinates require 2, 3, or 4 values, received ${type.listSize}`
3052
- );
3053
- }
3054
- }
3055
- if (arrow7.DataType.isStruct(type)) {
3056
- const names = type.children.map((field) => field.name.toLowerCase());
3057
- if (names[0] === "x" && names[1] === "y") {
3058
- if (names[2] === "m") return "xym";
3059
- if (names[2] === "z" && names[3] === "m") return "xyzm";
3060
- if (names[2] === "z") return "xyz";
3061
- return "xy";
3062
- }
3063
- }
3064
- if (arrow7.DataType.isList(type) || arrow7.DataType.isLargeList(type)) {
3065
- return inferGeoArrowDimensionFromArrowType(type.children[0].type);
3066
- }
3067
- if (arrow7.DataType.isDenseUnion(type)) {
3068
- return type.children.reduce(
3069
- (dimension, field) => mergeGeoArrowDimensions(dimension, inferGeoArrowDimensionFromUnionChild(field)),
3070
- "xy"
3071
- );
3072
- }
3073
- throw new Error(`Cannot infer GeoArrow dimension from Arrow type ${type.toString()}`);
3074
- }
3075
- function inferGeoArrowCoordinateLayoutFromArrowType(type) {
3076
- if (arrow7.DataType.isFixedSizeList(type)) return "interleaved";
3077
- if (arrow7.DataType.isStruct(type)) return "separated";
3078
- if (arrow7.DataType.isList(type) || arrow7.DataType.isLargeList(type)) {
3079
- return inferGeoArrowCoordinateLayoutFromArrowType(type.children[0].type);
3080
- }
3081
- if (arrow7.DataType.isDenseUnion(type)) {
3082
- for (const field of type.children) {
3083
- const layout = inferGeoArrowCoordinateLayoutFromArrowType(field.type);
3084
- if (layout) return layout;
3085
- }
3086
- }
3087
- return null;
3088
- }
3089
- function makeGeoArrowArrayFromArrowData(data) {
3090
- const validity = makeGeoArrowValidity(data);
3091
- if (arrow7.DataType.isFixedSizeList(data.type)) {
3092
- return {
3093
- kind: "fixed-size-list",
3094
- length: data.length,
3095
- size: data.type.listSize,
3096
- child: makeGeoArrowArrayFromArrowData(data.children[0]),
3097
- validity
3098
- };
3099
- }
3100
- if (arrow7.DataType.isList(data.type) || arrow7.DataType.isLargeList(data.type)) {
3101
- return {
3102
- kind: "list",
3103
- length: data.length,
3104
- offsets: data.valueOffsets,
3105
- child: makeGeoArrowArrayFromArrowData(data.children[0]),
3106
- validity
3107
- };
3108
- }
3109
- if (arrow7.DataType.isStruct(data.type)) {
3110
- const children = {};
3111
- for (let childIndex = 0; childIndex < data.type.children.length; childIndex++) {
3112
- children[data.type.children[childIndex].name] = makeGeoArrowArrayFromArrowData(
3113
- data.children[childIndex]
3114
- );
3115
- }
3116
- return { kind: "struct", length: data.length, children, validity };
3117
- }
3118
- if (arrow7.DataType.isDenseUnion(data.type)) {
3119
- const unionType = data.type;
3120
- return {
3121
- kind: "dense-union",
3122
- length: data.length,
3123
- typeIds: data.typeIds,
3124
- valueOffsets: data.valueOffsets,
3125
- children: unionType.children.map((field, childIndex) => ({
3126
- name: field.name,
3127
- typeId: unionType.typeIds[childIndex],
3128
- encoding: inferGeoArrowEncodingFromUnionChild(field),
3129
- dimension: inferGeoArrowDimensionFromUnionChild(field),
3130
- coordinateLayout: inferGeoArrowCoordinateLayoutFromArrowType(field.type),
3131
- data: makeGeoArrowArrayFromArrowData(data.children[childIndex])
3132
- }))
3133
- };
3134
- }
3135
- if (arrow7.DataType.isBinaryView(data.type) || arrow7.DataType.isUtf8View(data.type)) {
3136
- const viewBytes = data.values;
3137
- return {
3138
- kind: "serialized",
3139
- encoding: arrow7.DataType.isBinaryView(data.type) ? "binary" : "utf8",
3140
- length: data.length,
3141
- offsets: new Int32Array(0),
3142
- values: new Uint8Array(0),
3143
- views: new Uint32Array(
3144
- viewBytes.buffer,
3145
- viewBytes.byteOffset,
3146
- Math.floor(viewBytes.byteLength / Uint32Array.BYTES_PER_ELEMENT)
3147
- ),
3148
- dataBuffers: data.variadicBuffers,
3149
- validity
3150
- };
3151
- }
3152
- if (isOffsetSerializedArrowType(data.type)) {
3153
- return {
3154
- kind: "serialized",
3155
- encoding: arrow7.DataType.isBinary(data.type) || arrow7.DataType.isLargeBinary(data.type) ? "binary" : "utf8",
3156
- length: data.length,
3157
- offsets: data.valueOffsets,
3158
- values: data.values,
3159
- validity
3160
- };
3161
- }
3162
- if (arrow7.DataType.isInt(data.type) || arrow7.DataType.isFloat(data.type)) {
3163
- return {
3164
- kind: "primitive",
3165
- length: data.length,
3166
- values: data.values,
3167
- validity
3168
- };
3169
- }
3170
- throw new Error(`Unsupported GeoArrow physical Arrow type ${data.type.toString()}`);
3171
- }
3172
- function makeGeoArrowValidity(data) {
3173
- if (data.nullCount === 0 || !data.nullBitmap || data.nullBitmap.length === 0) return void 0;
3174
- return { values: data.nullBitmap, bitOffset: data.offset };
3175
- }
3176
- function makeArrowDataFromGeoArrowArray(array, dimension, coordinateLayout) {
3177
- const validity = makeCompactValidity(array.validity, array.length);
3178
- const nullCount = validity ? -1 : 0;
3179
- const validityBuffers = validity ? { [arrow7.BufferType.VALIDITY]: validity } : {};
3180
- switch (array.kind) {
3181
- case "primitive": {
3182
- const values = makePackedPrimitiveValues(array);
3183
- return new arrow7.Data(getArrowTypeForValues(values), 0, array.length, nullCount, {
3184
- ...validityBuffers,
3185
- [arrow7.BufferType.DATA]: values
3186
- });
3187
- }
3188
- case "fixed-size-list": {
3189
- const child = makeArrowDataFromGeoArrowArray(array.child, dimension, coordinateLayout);
3190
- const childStart = (array.offset ?? 0) * array.size;
3191
- const slicedChild = childStart === 0 && child.length === array.length * array.size ? child : child.slice(childStart, array.length * array.size);
3192
- const type = new arrow7.FixedSizeList(
3193
- array.size,
3194
- new arrow7.Field("value", slicedChild.type, true)
3195
- );
3196
- return new arrow7.Data(type, 0, array.length, nullCount, validityBuffers, [slicedChild]);
3197
- }
3198
- case "list": {
3199
- const child = makeArrowDataFromGeoArrowArray(array.child, dimension, coordinateLayout);
3200
- const offsets = makeArrowOffsets(array.offsets, array.offset, array.length, array.offsetBase);
3201
- const field = new arrow7.Field("value", child.type, true);
3202
- const type = offsets instanceof BigInt64Array ? new arrow7.LargeList(field) : new arrow7.List(field);
3203
- return new arrow7.Data(
3204
- type,
3205
- 0,
3206
- array.length,
3207
- nullCount,
3208
- { ...validityBuffers, [arrow7.BufferType.OFFSET]: offsets },
3209
- [child]
3210
- );
3211
- }
3212
- case "struct": {
3213
- const fields = [];
3214
- const children = [];
3215
- for (const [name, childArray] of Object.entries(array.children)) {
3216
- let child = makeArrowDataFromGeoArrowArray(childArray, dimension, coordinateLayout);
3217
- const childOffset = array.offset ?? 0;
3218
- if (childOffset > 0 || child.length !== array.length) {
3219
- child = child.slice(childOffset, array.length);
3220
- }
3221
- fields.push(new arrow7.Field(name, child.type, true));
3222
- children.push(child);
3223
- }
3224
- return new arrow7.Data(
3225
- new arrow7.Struct(fields),
3226
- 0,
3227
- array.length,
3228
- nullCount,
3229
- validityBuffers,
3230
- children
3231
- );
3232
- }
3233
- case "dense-union":
3234
- return makeArrowDenseUnionData(array, dimension, coordinateLayout);
3235
- case "serialized": {
3236
- if (array.views) {
3237
- const type2 = array.encoding === "binary" ? new arrow7.BinaryView() : new arrow7.Utf8View();
3238
- const viewBytes = new Uint8Array(
3239
- array.views.buffer,
3240
- array.views.byteOffset,
3241
- array.views.byteLength
3242
- );
3243
- return new arrow7.Data(
3244
- type2,
3245
- 0,
3246
- array.length,
3247
- nullCount,
3248
- { ...validityBuffers, [arrow7.BufferType.DATA]: viewBytes },
3249
- [],
3250
- void 0,
3251
- array.dataBuffers
3252
- );
3253
- }
3254
- const offsets = makeArrowOffsets(array.offsets, array.offset, array.length, array.offsetBase);
3255
- const type = getSerializedArrowType(array.encoding, offsets);
3256
- return new arrow7.Data(type, 0, array.length, nullCount, {
3257
- ...validityBuffers,
3258
- [arrow7.BufferType.OFFSET]: offsets,
3259
- [arrow7.BufferType.DATA]: array.values
3260
- });
3261
- }
3262
- }
3263
- }
3264
- function makeArrowDenseUnionData(array, dimension, coordinateLayout) {
3265
- var _a;
3266
- const offset = array.offset ?? 0;
3267
- const sourceTypeIds = array.typeIds.subarray(offset, offset + array.length);
3268
- const typeIds = sourceTypeIds instanceof Int8Array ? sourceTypeIds : new Int8Array(sourceTypeIds.buffer, sourceTypeIds.byteOffset, sourceTypeIds.byteLength);
3269
- const valueOffsets = array.valueOffsets.subarray(offset, offset + array.length);
3270
- const children = array.children.map(
3271
- (child) => makeArrowDataFromGeoArrowArray(
3272
- child.data,
3273
- child.dimension ?? dimension,
3274
- child.coordinateLayout === void 0 ? coordinateLayout : child.coordinateLayout
3275
- )
3276
- );
3277
- if (array.validity) {
3278
- for (let rowIndex = 0; rowIndex < array.length; rowIndex++) {
3279
- if (isGeoArrowValueValid(array.validity, rowIndex)) continue;
3280
- const childIndex = array.children.findIndex((child) => child.typeId === typeIds[rowIndex]);
3281
- const childOffset = valueOffsets[rowIndex];
3282
- const childValidity = (_a = array.children[childIndex]) == null ? void 0 : _a.data.validity;
3283
- if (childIndex < 0 || childOffset < 0 || childOffset >= children[childIndex].length || !childValidity || isGeoArrowValueValid(childValidity, childOffset)) {
3284
- throw new Error("GeoArrow dense-union null does not reference a nullable child value");
3285
- }
3286
- }
3287
- }
3288
- const fields = array.children.map(
3289
- (child, childIndex) => new arrow7.Field(
3290
- getArrowUnionChildName(child.name, child.dimension ?? dimension),
3291
- children[childIndex].type,
3292
- true
3293
- )
3294
- );
3295
- const type = new arrow7.DenseUnion(
3296
- Int32Array.from(array.children.map((child) => child.typeId)),
3297
- fields
3298
- );
3299
- return new arrow7.Data(
3300
- type,
3301
- 0,
3302
- array.length,
3303
- 0,
3304
- { [arrow7.BufferType.TYPE]: typeIds, [arrow7.BufferType.OFFSET]: valueOffsets },
3305
- children
3306
- );
3307
- }
3308
- function makePackedPrimitiveValues(array) {
3309
- const offset = array.offset ?? 0;
3310
- const stride = array.stride ?? 1;
3311
- if (stride === 1) {
3312
- return array.values.subarray(offset, offset + array.length);
3313
- }
3314
- const ValuesConstructor = array.values.constructor;
3315
- const values = new ValuesConstructor(array.length);
3316
- for (let index = 0; index < array.length; index++) {
3317
- values[index] = array.values[offset + index * stride];
3318
- }
3319
- return values;
3320
- }
3321
- function getArrowTypeForValues(values) {
3322
- if (values instanceof Int8Array) return new arrow7.Int8();
3323
- if (values instanceof Uint8Array || values instanceof Uint8ClampedArray) return new arrow7.Uint8();
3324
- if (values instanceof Int16Array) return new arrow7.Int16();
3325
- if (values instanceof Uint16Array) return new arrow7.Uint16();
3326
- if (values instanceof Int32Array) return new arrow7.Int32();
3327
- if (values instanceof Uint32Array) return new arrow7.Uint32();
3328
- if (values instanceof BigInt64Array) return new arrow7.Int64();
3329
- if (values instanceof BigUint64Array) return new arrow7.Uint64();
3330
- if (values instanceof Float32Array) return new arrow7.Float32();
3331
- if (values instanceof Float64Array) return new arrow7.Float64();
3332
- throw new Error(`Unsupported GeoArrow primitive values ${values.constructor.name}`);
3333
- }
3334
- function makeArrowOffsets(offsets, offset = 0, length, offsetBase = 0) {
3335
- const source = offsets.subarray(offset, offset + length + 1);
3336
- if (offsetBase === 0 || offsetBase === 0n) return source;
3337
- const normalized = offsets instanceof BigInt64Array ? new BigInt64Array(source.length) : new Int32Array(source.length);
3338
- for (let index = 0; index < source.length; index++) {
3339
- if (normalized instanceof BigInt64Array) {
3340
- normalized[index] = BigInt(source[index]) - BigInt(offsetBase);
3341
- } else {
3342
- normalized[index] = Number(source[index]) - Number(offsetBase);
3343
- }
3344
- }
3345
- return normalized;
3346
- }
3347
- function makeCompactValidity(validity, length) {
3348
- if (!validity) return void 0;
3349
- const bitOffset = validity.bitOffset ?? 0;
3350
- if (bitOffset === 0 && validity.values.length === Math.ceil(length / 8)) {
3351
- return validity.values;
3352
- }
3353
- const values = new Uint8Array(Math.ceil(length / 8));
3354
- let nullCount = 0;
3355
- for (let index = 0; index < length; index++) {
3356
- if (isGeoArrowValueValid(validity, index)) values[index >> 3] |= 1 << (index & 7);
3357
- else nullCount++;
3358
- }
3359
- return nullCount > 0 ? values : void 0;
3360
- }
3361
- function isGeoArrowValueValid(validity, index) {
3362
- const bitIndex = (validity.bitOffset ?? 0) + index;
3363
- return Boolean(validity.values[bitIndex >> 3] & 1 << (bitIndex & 7));
3364
- }
3365
- function inferGeoArrowEncodingFromUnionChild(field) {
3366
- const normalizedName = field.name.replace(/[^a-z]/gi, "").toLowerCase();
3367
- const names = {
3368
- point: "geoarrow.point",
3369
- linestring: "geoarrow.linestring",
3370
- polygon: "geoarrow.polygon",
3371
- multipoint: "geoarrow.multipoint",
3372
- multilinestring: "geoarrow.multilinestring",
3373
- multipolygon: "geoarrow.multipolygon",
3374
- geometrycollection: "geoarrow.geometrycollection"
3375
- };
3376
- for (const [name, encoding] of Object.entries(names)) {
3377
- if (normalizedName.startsWith(name)) return encoding;
3378
- }
3379
- return inferGeoArrowEncodingFromArrowType(field.type);
3380
- }
3381
- function inferGeoArrowDimensionFromUnionChild(field) {
3382
- if (/\sZM$/i.test(field.name)) return "xyzm";
3383
- if (/\sM$/i.test(field.name)) return "xym";
3384
- if (/\sZ$/i.test(field.name)) return "xyz";
3385
- return inferGeoArrowDimensionFromArrowType(field.type);
3386
- }
3387
- function getArrowUnionChildName(name, dimension) {
3388
- if (/\s(?:Z|M|ZM)$/i.test(name) || dimension === "xy") return name;
3389
- const suffix = dimension === "xyz" ? "Z" : dimension === "xym" ? "M" : "ZM";
3390
- return `${name} ${suffix}`;
3391
- }
3392
- function getArrowListNesting(type) {
3393
- let nesting = 0;
3394
- let currentType = type;
3395
- while (arrow7.DataType.isList(currentType) || arrow7.DataType.isLargeList(currentType)) {
3396
- nesting++;
3397
- currentType = currentType.children[0].type;
3398
- }
3399
- if (arrow7.DataType.isFixedSizeList(currentType) || arrow7.DataType.isStruct(currentType)) {
3400
- return nesting;
3401
- }
3402
- throw new Error(`GeoArrow type does not terminate in coordinates: ${type.toString()}`);
3403
- }
3404
- function getSerializedArrowType(encoding, offsets) {
3405
- if (encoding === "binary") {
3406
- return offsets instanceof BigInt64Array ? new arrow7.LargeBinary() : new arrow7.Binary();
3407
- }
3408
- return offsets instanceof BigInt64Array ? new arrow7.LargeUtf8() : new arrow7.Utf8();
3409
- }
3410
- function isOffsetSerializedArrowType(type) {
3411
- return arrow7.DataType.isBinary(type) || arrow7.DataType.isLargeBinary(type) || arrow7.DataType.isUtf8(type) || arrow7.DataType.isLargeUtf8(type);
3412
- }
3413
- function isSerializedArrowType(type) {
3414
- return isOffsetSerializedArrowType(type) || arrow7.DataType.isBinaryView(type) || arrow7.DataType.isUtf8View(type);
3415
- }
3416
- function isGeoArrowDimension(value) {
3417
- return value === "xy" || value === "xyz" || value === "xym" || value === "xyzm";
3418
- }
3419
- function mergeGeoArrowDimensions(left, right) {
3420
- if (left === right) return left;
3421
- if (left === "xy") return right;
3422
- if (right === "xy") return left;
3423
- if (left === "xyzm" || right === "xyzm") return "xyzm";
3424
- return left === "xym" && right === "xym" ? "xym" : "xyzm";
3425
- }
3426
-
3427
2994
  // dist/geoarrow/lib/kernels/decode-wkt-native.js
3428
2995
  var UNION_GEOMETRY_KINDS = [
3429
2996
  "Point",
@@ -3471,7 +3038,7 @@ function decodeWKTNativeVector(column, targetEncoding, dimension, coordinates =
3471
3038
  coordinateLayout: coordinates,
3472
3039
  offsetType
3473
3040
  });
3474
- return arrow8.makeVector(GeoArrowBuilder.makeGeometryData(geometryArray));
3041
+ return arrow7.makeVector(GeoArrowBuilder.makeGeometryData(geometryArray));
3475
3042
  }
3476
3043
  function decodeWKTUnionVector(column, dimension, coordinates = "interleaved", offsetType = "int32", geometryTypes, maxGeometryCollectionDepth = 64) {
3477
3044
  const parsedRows = [];
@@ -3552,7 +3119,7 @@ function makeWKTUnionVector(parsedRows, dimension, coordinates, offsetType, geom
3552
3119
  const collectionVector = makeWKTCollectionVector(rows, dimension, coordinates, offsetType, geometryTypes);
3553
3120
  if (!collectionVector)
3554
3121
  return null;
3555
- fields.push(new arrow8.Field(getWKTUnionFieldName(child), collectionVector.type, true));
3122
+ fields.push(new arrow7.Field(getWKTUnionFieldName(child), collectionVector.type, true));
3556
3123
  childData.push(collectionVector.data[0]);
3557
3124
  continue;
3558
3125
  }
@@ -3563,12 +3130,12 @@ function makeWKTUnionVector(parsedRows, dimension, coordinates, offsetType, geom
3563
3130
  coordinateLayout: coordinates,
3564
3131
  offsetType
3565
3132
  });
3566
- const childVector = arrow8.makeVector(GeoArrowBuilder.makeGeometryData(geometryArray));
3567
- fields.push(new arrow8.Field(getWKTUnionFieldName(child), childVector.type, true));
3133
+ const childVector = arrow7.makeVector(GeoArrowBuilder.makeGeometryData(geometryArray));
3134
+ fields.push(new arrow7.Field(getWKTUnionFieldName(child), childVector.type, true));
3568
3135
  childData.push(childVector.data[0]);
3569
3136
  }
3570
- const unionType = new arrow8.DenseUnion(orderedChildren.map(getWKTUnionTypeId), fields);
3571
- return arrow8.makeVector(arrow8.makeData({
3137
+ const unionType = new arrow7.DenseUnion(orderedChildren.map(getWKTUnionTypeId), fields);
3138
+ return arrow7.makeVector(arrow7.makeData({
3572
3139
  type: unionType,
3573
3140
  length: parsedRows.length,
3574
3141
  nullCount: 0,
@@ -3599,9 +3166,9 @@ function makeWKTCollectionVector(parsedRows, dimension, coordinates, offsetType,
3599
3166
  const unionVector = makeWKTUnionVector(flattenedChildren, dimension, coordinates, offsetType, geometryTypes == null ? void 0 : geometryTypes.filter((geometryType) => !geometryType.toLowerCase().startsWith("geometrycollection")), false);
3600
3167
  if (!unionVector)
3601
3168
  return null;
3602
- const listField = new arrow8.Field("geometries", unionVector.type, true);
3603
- const listType = offsetType === "int64" ? new arrow8.LargeList(listField) : new arrow8.List(listField);
3604
- return arrow8.makeVector(arrow8.makeData({
3169
+ const listField = new arrow7.Field("geometries", unionVector.type, true);
3170
+ const listType = offsetType === "int64" ? new arrow7.LargeList(listField) : new arrow7.List(listField);
3171
+ return arrow7.makeVector(arrow7.makeData({
3605
3172
  type: listType,
3606
3173
  length: parsedRows.length,
3607
3174
  nullCount,
@@ -3990,8 +3557,8 @@ function isCoordinate(value) {
3990
3557
  }
3991
3558
 
3992
3559
  // dist/geoarrow/lib/kernels/encode-geoarrow-box.js
3993
- var arrow9 = __toESM(require("apache-arrow"), 1);
3994
- var import_geospatial5 = require("@math.gl/geospatial");
3560
+ var arrow8 = __toESM(require("apache-arrow"), 1);
3561
+ var import_wkb5 = require("@math.gl/arrow/wkb");
3995
3562
  function encodeGeoArrowBoxVector(column, sourceEncoding, dimension) {
3996
3563
  const coordinateSize = dimension ? getDimensionSize2(dimension) : inferDimension2(column, sourceEncoding);
3997
3564
  const effectiveDimension = dimension || getDimensionName(coordinateSize);
@@ -4002,9 +3569,9 @@ function encodeGeoArrowBoxVector(column, sourceEncoding, dimension) {
4002
3569
  bounds.push(rowBounds && normalizeBounds(rowBounds, coordinateSize));
4003
3570
  }
4004
3571
  const fieldNames = getBoxFieldNames2(effectiveDimension);
4005
- const boxType = new arrow9.Struct(fieldNames.map((name) => new arrow9.Field(name, new arrow9.Float64(), true)));
4006
- const children = fieldNames.map((_, fieldIndex) => arrow9.makeData({
4007
- type: new arrow9.Float64(),
3572
+ const boxType = new arrow8.Struct(fieldNames.map((name) => new arrow8.Field(name, new arrow8.Float64(), true)));
3573
+ const children = fieldNames.map((_, fieldIndex) => arrow8.makeData({
3574
+ type: new arrow8.Float64(),
4008
3575
  data: Float64Array.from(bounds, (rowBounds) => (rowBounds == null ? void 0 : rowBounds[fieldIndex]) ?? Number.NaN)
4009
3576
  }));
4010
3577
  const nullBitmap = new Uint8Array(Math.ceil(column.length / 8));
@@ -4015,7 +3582,7 @@ function encodeGeoArrowBoxVector(column, sourceEncoding, dimension) {
4015
3582
  else
4016
3583
  nullCount++;
4017
3584
  }
4018
- return arrow9.makeVector(arrow9.makeData({
3585
+ return arrow8.makeVector(arrow8.makeData({
4019
3586
  type: boxType,
4020
3587
  length: column.length,
4021
3588
  nullCount,
@@ -4028,7 +3595,7 @@ function getRowBounds(value, sourceEncoding, dimension) {
4028
3595
  return null;
4029
3596
  if (sourceEncoding === "geoarrow.wkb") {
4030
3597
  const bytes = value;
4031
- const statistics = (0, import_geospatial5.scanWKB)(bytes);
3598
+ const statistics = (0, import_wkb5.scanWKB)(bytes);
4032
3599
  return statistics.bounds ? boundsFromRecord(statistics.bounds, dimension) : null;
4033
3600
  }
4034
3601
  if (sourceEncoding === "geoarrow.wkt") {
@@ -4151,14 +3718,14 @@ function inferDimension2(column, sourceEncoding) {
4151
3718
  if (value == null)
4152
3719
  continue;
4153
3720
  const bytes = value;
4154
- const statistics = (0, import_geospatial5.scanWKB)(bytes);
3721
+ const statistics = (0, import_wkb5.scanWKB)(bytes);
4155
3722
  const hasZ = ((_a = statistics.bounds) == null ? void 0 : _a.zmin) !== void 0;
4156
3723
  const hasM = ((_b = statistics.bounds) == null ? void 0 : _b.mmin) !== void 0;
4157
3724
  coordinateSize = Math.max(coordinateSize, hasZ && hasM ? 4 : hasZ || hasM ? 3 : 2);
4158
3725
  }
4159
3726
  return coordinateSize;
4160
3727
  }
4161
- if (column.type instanceof arrow9.Struct) {
3728
+ if (column.type instanceof arrow8.Struct) {
4162
3729
  const names = column.type.children.map((child) => child.name);
4163
3730
  if (names.includes("mmin") && names.includes("zmin"))
4164
3731
  return 4;
@@ -4210,7 +3777,7 @@ function getBoxFieldNames2(dimension) {
4210
3777
  }
4211
3778
 
4212
3779
  // dist/geoarrow/lib/kernels/encode-geoarrow-wkt.js
4213
- var arrow10 = __toESM(require("apache-arrow"), 1);
3780
+ var arrow9 = __toESM(require("apache-arrow"), 1);
4214
3781
  function encodeGeoArrowWKTVector(column, sourceEncoding, dimension) {
4215
3782
  if (!isNativeGeometryEncoding(sourceEncoding))
4216
3783
  return null;
@@ -4228,7 +3795,7 @@ function encodeGeoArrowWKTVector(column, sourceEncoding, dimension) {
4228
3795
  return null;
4229
3796
  values.push(wkt);
4230
3797
  }
4231
- return arrow10.vectorFromArray(values, new arrow10.Utf8());
3798
+ return arrow9.vectorFromArray(values, new arrow9.Utf8());
4232
3799
  }
4233
3800
  function isNativeGeometryEncoding(encoding) {
4234
3801
  return encoding === "geoarrow.point" || encoding === "geoarrow.linestring" || encoding === "geoarrow.polygon" || encoding === "geoarrow.multipoint" || encoding === "geoarrow.multilinestring" || encoding === "geoarrow.multipolygon" || encoding === "geoarrow.geometry" || encoding === "geoarrow.geometrycollection";
@@ -4400,7 +3967,7 @@ function getUnionTypeId2(vector, rowIndex) {
4400
3967
  }
4401
3968
  function getUnionField(vector, rowIndex) {
4402
3969
  const unionType = vector.type;
4403
- if (!(unionType instanceof arrow10.DenseUnion))
3970
+ if (!(unionType instanceof arrow9.DenseUnion))
4404
3971
  return void 0;
4405
3972
  const typeId = getUnionTypeId2(vector, rowIndex);
4406
3973
  const childIndex = unionType.typeIds.indexOf(typeId);
@@ -4413,10 +3980,10 @@ function inferDimensionFromTypeId(column, rowIndex, sourceEncoding) {
4413
3980
  return getGeoArrowUnionDimension(field == null ? void 0 : field.name, field == null ? void 0 : field.type, typeId) || "xy";
4414
3981
  }
4415
3982
  let type = column.type;
4416
- while (type instanceof arrow10.List || type instanceof arrow10.LargeList) {
3983
+ while (type instanceof arrow9.List || type instanceof arrow9.LargeList) {
4417
3984
  type = type.children[0].type;
4418
3985
  }
4419
- if (type instanceof arrow10.Struct) {
3986
+ if (type instanceof arrow9.Struct) {
4420
3987
  const names = new Set(type.children.map((field) => field.name));
4421
3988
  if (names.has("z") && names.has("m"))
4422
3989
  return "xyzm";
@@ -4425,7 +3992,7 @@ function inferDimensionFromTypeId(column, rowIndex, sourceEncoding) {
4425
3992
  if (names.has("z"))
4426
3993
  return "xyz";
4427
3994
  }
4428
- if (type instanceof arrow10.FixedSizeList) {
3995
+ if (type instanceof arrow9.FixedSizeList) {
4429
3996
  return type.listSize === 4 ? "xyzm" : type.listSize === 3 ? "xyz" : "xy";
4430
3997
  }
4431
3998
  return "xy";
@@ -4481,11 +4048,11 @@ function isVectorLike3(value) {
4481
4048
  }
4482
4049
 
4483
4050
  // dist/geoarrow/get-geoarrow-vertex-count.js
4484
- var arrow14 = __toESM(require("apache-arrow"), 1);
4485
- var import_geospatial6 = require("@math.gl/geospatial");
4051
+ var arrow13 = __toESM(require("apache-arrow"), 1);
4052
+ var import_wkb6 = require("@math.gl/arrow/wkb");
4486
4053
 
4487
4054
  // dist/geoarrow/geoarrow-functions.js
4488
- var arrow11 = __toESM(require("apache-arrow"), 1);
4055
+ var arrow10 = __toESM(require("apache-arrow"), 1);
4489
4056
  var import_type = require("apache-arrow/type");
4490
4057
  function isGeoArrowBox(type) {
4491
4058
  if (!import_type.DataType.isStruct(type))
@@ -4567,18 +4134,18 @@ function isGeoArrowMultiPolygon(type) {
4567
4134
  return true;
4568
4135
  }
4569
4136
  function isGeoArrowList(type) {
4570
- const LargeList10 = getOptionalArrowListConstructor("LargeList");
4571
- return type instanceof import_type.List || Boolean(LargeList10 && type instanceof LargeList10);
4137
+ const LargeList9 = getOptionalArrowListConstructor("LargeList");
4138
+ return type instanceof import_type.List || Boolean(LargeList9 && type instanceof LargeList9);
4572
4139
  }
4573
4140
  function getOptionalArrowListConstructor(typeName) {
4574
- return arrow11[typeName];
4141
+ return arrow10[typeName];
4575
4142
  }
4576
4143
 
4577
4144
  // dist/geoarrow/get-geoarrow-geometry-info.js
4578
- var arrow13 = __toESM(require("apache-arrow"), 1);
4145
+ var arrow12 = __toESM(require("apache-arrow"), 1);
4579
4146
 
4580
4147
  // dist/geoarrow/geoarrow-layout.js
4581
- var arrow12 = __toESM(require("apache-arrow"), 1);
4148
+ var arrow11 = __toESM(require("apache-arrow"), 1);
4582
4149
  var NATIVE_LAYOUTS = {
4583
4150
  point: { depth: 0, encoding: "geoarrow.point" },
4584
4151
  linestring: { depth: 1, encoding: "geoarrow.linestring" },
@@ -4642,11 +4209,11 @@ function inspectGeoArrowLayout(field) {
4642
4209
  function visitType(type, path, state) {
4643
4210
  const storage = getStorageKind(type);
4644
4211
  state.storageKinds.push(storage);
4645
- if (type instanceof arrow12.List || type instanceof arrow12.LargeList) {
4646
- state.offsetTypes.push(type instanceof arrow12.LargeList ? "int64" : "int32");
4647
- } else if (type instanceof arrow12.Binary || type instanceof arrow12.LargeBinary) {
4648
- state.offsetTypes.push(type instanceof arrow12.LargeBinary ? "int64" : "int32");
4649
- } else if (type instanceof arrow12.DenseUnion) {
4212
+ if (type instanceof arrow11.List || type instanceof arrow11.LargeList) {
4213
+ state.offsetTypes.push(type instanceof arrow11.LargeList ? "int64" : "int32");
4214
+ } else if (type instanceof arrow11.Binary || type instanceof arrow11.LargeBinary) {
4215
+ state.offsetTypes.push(type instanceof arrow11.LargeBinary ? "int64" : "int32");
4216
+ } else if (type instanceof arrow11.DenseUnion) {
4650
4217
  state.unionTypeIds.push(...Array.from(type.typeIds));
4651
4218
  for (let childIndex = 0; childIndex < type.children.length; childIndex++) {
4652
4219
  const child = type.children[childIndex];
@@ -4682,10 +4249,10 @@ function visitType(type, path, state) {
4682
4249
  }
4683
4250
  function classifyField(type, encoding, path, state, issues) {
4684
4251
  var _a;
4685
- if (type instanceof arrow12.Binary || type instanceof arrow12.LargeBinary || type instanceof arrow12.BinaryView) {
4252
+ if (type instanceof arrow11.Binary || type instanceof arrow11.LargeBinary || type instanceof arrow11.BinaryView) {
4686
4253
  return "wkb";
4687
4254
  }
4688
- if (type instanceof arrow12.Utf8 || type instanceof arrow12.LargeUtf8 || type instanceof arrow12.Utf8View) {
4255
+ if (type instanceof arrow11.Utf8 || type instanceof arrow11.LargeUtf8 || type instanceof arrow11.Utf8View) {
4689
4256
  return "wkt";
4690
4257
  }
4691
4258
  if (isBoxType(type)) {
@@ -4694,7 +4261,7 @@ function classifyField(type, encoding, path, state, issues) {
4694
4261
  recordCoordinateSemantics(type, state, "separated");
4695
4262
  return "box";
4696
4263
  }
4697
- if (type instanceof arrow12.DenseUnion) {
4264
+ if (type instanceof arrow11.DenseUnion) {
4698
4265
  validateUnionType(type, path, state, issues);
4699
4266
  if (encoding === "geoarrow.geometrycollection") {
4700
4267
  issues.push({
@@ -4706,7 +4273,7 @@ function classifyField(type, encoding, path, state, issues) {
4706
4273
  validateUnionChildren(type, path, issues, true);
4707
4274
  return "geometry-union";
4708
4275
  }
4709
- if ((type instanceof arrow12.List || type instanceof arrow12.LargeList) && ((_a = type.children[0]) == null ? void 0 : _a.type) instanceof arrow12.DenseUnion) {
4276
+ if ((type instanceof arrow11.List || type instanceof arrow11.LargeList) && ((_a = type.children[0]) == null ? void 0 : _a.type) instanceof arrow11.DenseUnion) {
4710
4277
  validateUnionType(type.children[0].type, `${path}.child[0]`, state, issues);
4711
4278
  validateUnionChildren(type.children[0].type, `${path}.child[0]`, issues, false);
4712
4279
  return "geometrycollection";
@@ -4765,8 +4332,8 @@ function validateDeclaredEncoding(type, encoding, path, state, issues) {
4765
4332
  });
4766
4333
  }
4767
4334
  }
4768
- if (encoding === "geoarrow.geometrycollection" && type instanceof arrow12.List) {
4769
- if (!(((_a = type.children[0]) == null ? void 0 : _a.type) instanceof arrow12.DenseUnion)) {
4335
+ if (encoding === "geoarrow.geometrycollection" && type instanceof arrow11.List) {
4336
+ if (!(((_a = type.children[0]) == null ? void 0 : _a.type) instanceof arrow11.DenseUnion)) {
4770
4337
  addWrongPhysicalType(path, encoding, issues);
4771
4338
  }
4772
4339
  }
@@ -4774,7 +4341,7 @@ function validateDeclaredEncoding(type, encoding, path, state, issues) {
4774
4341
  function validateNativeType(type, expectedDepth, path, state, issues) {
4775
4342
  let current = type;
4776
4343
  for (let depth = 0; depth < expectedDepth; depth++) {
4777
- if (!(current instanceof arrow12.List || current instanceof arrow12.LargeList)) {
4344
+ if (!(current instanceof arrow11.List || current instanceof arrow11.LargeList)) {
4778
4345
  issues.push({
4779
4346
  code: "wrong-child-count",
4780
4347
  path,
@@ -4795,7 +4362,7 @@ function validateNativeType(type, expectedDepth, path, state, issues) {
4795
4362
  validateCoordinateType(current, path, state, issues);
4796
4363
  }
4797
4364
  function validateCoordinateType(type, path, state, issues) {
4798
- if (type instanceof arrow12.FixedSizeList) {
4365
+ if (type instanceof arrow11.FixedSizeList) {
4799
4366
  if (type.children.length !== 1 || !type.children[0]) {
4800
4367
  issues.push({
4801
4368
  code: "wrong-child-count",
@@ -4817,7 +4384,7 @@ function validateCoordinateType(type, path, state, issues) {
4817
4384
  recordFloatPrecision(type.children[0].type, `${path}.child[0]`, state, issues);
4818
4385
  return;
4819
4386
  }
4820
- if (type instanceof arrow12.Struct) {
4387
+ if (type instanceof arrow11.Struct) {
4821
4388
  const names = type.children.map((child) => child.name);
4822
4389
  const dimension = getSeparatedDimension(names);
4823
4390
  if (!dimension) {
@@ -4849,7 +4416,7 @@ function validateCoordinateType(type, path, state, issues) {
4849
4416
  });
4850
4417
  }
4851
4418
  function recordFloatPrecision(type, path, state, issues) {
4852
- if (!(type instanceof arrow12.Float)) {
4419
+ if (!(type instanceof arrow11.Float)) {
4853
4420
  issues.push({
4854
4421
  code: "wrong-coordinate-precision",
4855
4422
  path,
@@ -4857,7 +4424,7 @@ function recordFloatPrecision(type, path, state, issues) {
4857
4424
  });
4858
4425
  return;
4859
4426
  }
4860
- const precision = type.precision === arrow12.Precision.HALF ? "float16" : type.precision === arrow12.Precision.SINGLE ? "float32" : "float64";
4427
+ const precision = type.precision === arrow11.Precision.HALF ? "float16" : type.precision === arrow11.Precision.SINGLE ? "float32" : "float64";
4861
4428
  state.precisions.push(precision);
4862
4429
  if (precision === "float16") {
4863
4430
  issues.push({
@@ -4868,7 +4435,7 @@ function recordFloatPrecision(type, path, state, issues) {
4868
4435
  }
4869
4436
  }
4870
4437
  function validateBoxType(type, path, issues) {
4871
- if (!(type instanceof arrow12.Struct))
4438
+ if (!(type instanceof arrow11.Struct))
4872
4439
  return;
4873
4440
  const names = type.children.map((child) => child.name);
4874
4441
  if (!getBoxDimension(names)) {
@@ -4879,7 +4446,7 @@ function validateBoxType(type, path, issues) {
4879
4446
  });
4880
4447
  }
4881
4448
  for (let childIndex = 0; childIndex < type.children.length; childIndex++) {
4882
- if (!(type.children[childIndex].type instanceof arrow12.Float)) {
4449
+ if (!(type.children[childIndex].type instanceof arrow11.Float)) {
4883
4450
  issues.push({
4884
4451
  code: "wrong-coordinate-precision",
4885
4452
  path: `${path}.child[${childIndex}]`,
@@ -4934,7 +4501,7 @@ function validateUnionChildren(type, path, issues, allowGeometryCollection) {
4934
4501
  });
4935
4502
  continue;
4936
4503
  }
4937
- if (!(child.type instanceof arrow12.List || child.type instanceof arrow12.LargeList) || !(((_a = child.type.children[0]) == null ? void 0 : _a.type) instanceof arrow12.DenseUnion)) {
4504
+ if (!(child.type instanceof arrow11.List || child.type instanceof arrow11.LargeList) || !(((_a = child.type.children[0]) == null ? void 0 : _a.type) instanceof arrow11.DenseUnion)) {
4938
4505
  issues.push({
4939
4506
  code: "wrong-physical-type",
4940
4507
  path: childPath,
@@ -4963,27 +4530,27 @@ function validateUnionChildren(type, path, issues, allowGeometryCollection) {
4963
4530
  }
4964
4531
  }
4965
4532
  function recordCoordinateSemantics(type, state, coordinates) {
4966
- if (!(type instanceof arrow12.Struct))
4533
+ if (!(type instanceof arrow11.Struct))
4967
4534
  return;
4968
4535
  const dimension = getBoxDimension(type.children.map((child) => child.name));
4969
4536
  if (dimension) {
4970
4537
  state.dimensions.push(dimension);
4971
4538
  state.coordinates.push(coordinates);
4972
4539
  for (const child of type.children) {
4973
- if (child.type instanceof arrow12.Float) {
4974
- state.precisions.push(child.type.precision === arrow12.Precision.SINGLE ? "float32" : "float64");
4540
+ if (child.type instanceof arrow11.Float) {
4541
+ state.precisions.push(child.type.precision === arrow11.Precision.SINGLE ? "float32" : "float64");
4975
4542
  }
4976
4543
  }
4977
4544
  }
4978
4545
  }
4979
4546
  function isPotentialNativeType(type) {
4980
- return type instanceof arrow12.FixedSizeList || type instanceof arrow12.Struct || type instanceof arrow12.List || type instanceof arrow12.LargeList;
4547
+ return type instanceof arrow11.FixedSizeList || type instanceof arrow11.Struct || type instanceof arrow11.List || type instanceof arrow11.LargeList;
4981
4548
  }
4982
4549
  function getListDepth(type) {
4983
4550
  var _a;
4984
4551
  let depth = 0;
4985
4552
  let current = type;
4986
- while (current instanceof arrow12.List || current instanceof arrow12.LargeList) {
4553
+ while (current instanceof arrow11.List || current instanceof arrow11.LargeList) {
4987
4554
  depth++;
4988
4555
  current = (_a = current.children[0]) == null ? void 0 : _a.type;
4989
4556
  if (!current)
@@ -4995,7 +4562,7 @@ function getNativeKind(type, encoding) {
4995
4562
  const encodingKind = encoding ? encodingToKind(encoding) : null;
4996
4563
  if (isNativeLayoutKind(encodingKind))
4997
4564
  return encodingKind;
4998
- if (type instanceof arrow12.FixedSizeList || isCoordinateStruct(type))
4565
+ if (type instanceof arrow11.FixedSizeList || isCoordinateStruct(type))
4999
4566
  return "point";
5000
4567
  return null;
5001
4568
  }
@@ -5040,34 +4607,34 @@ function addWrongPhysicalType(path, encoding, issues) {
5040
4607
  });
5041
4608
  }
5042
4609
  function getStorageKind(type) {
5043
- if (type instanceof arrow12.FixedSizeList)
4610
+ if (type instanceof arrow11.FixedSizeList)
5044
4611
  return "fixed-size-list";
5045
- if (type instanceof arrow12.List)
4612
+ if (type instanceof arrow11.List)
5046
4613
  return "list";
5047
- if (type instanceof arrow12.LargeList)
4614
+ if (type instanceof arrow11.LargeList)
5048
4615
  return "large-list";
5049
- if (type instanceof arrow12.Struct)
4616
+ if (type instanceof arrow11.Struct)
5050
4617
  return "struct";
5051
- if (type instanceof arrow12.DenseUnion)
4618
+ if (type instanceof arrow11.DenseUnion)
5052
4619
  return "dense-union";
5053
- if (type instanceof arrow12.Binary)
4620
+ if (type instanceof arrow11.Binary)
5054
4621
  return "binary";
5055
- if (type instanceof arrow12.LargeBinary)
4622
+ if (type instanceof arrow11.LargeBinary)
5056
4623
  return "large-binary";
5057
- if (type instanceof arrow12.BinaryView)
4624
+ if (type instanceof arrow11.BinaryView)
5058
4625
  return "binary-view";
5059
- if (type instanceof arrow12.Utf8)
4626
+ if (type instanceof arrow11.Utf8)
5060
4627
  return "utf8";
5061
- if (type instanceof arrow12.LargeUtf8)
4628
+ if (type instanceof arrow11.LargeUtf8)
5062
4629
  return "large-utf8";
5063
- if (type instanceof arrow12.Utf8View)
4630
+ if (type instanceof arrow11.Utf8View)
5064
4631
  return "utf8-view";
5065
- if (type instanceof arrow12.Float || type instanceof arrow12.Int)
4632
+ if (type instanceof arrow11.Float || type instanceof arrow11.Int)
5066
4633
  return "scalar";
5067
4634
  return "unknown";
5068
4635
  }
5069
4636
  function isCoordinateStruct(type) {
5070
- return type instanceof arrow12.Struct && getSeparatedDimension(type.children.map((child) => child.name)) !== null;
4637
+ return type instanceof arrow11.Struct && getSeparatedDimension(type.children.map((child) => child.name)) !== null;
5071
4638
  }
5072
4639
  function getSeparatedDimension(names) {
5073
4640
  if (sameNames(names, ["x", "y"]))
@@ -5093,7 +4660,7 @@ function getBoxDimension(names) {
5093
4660
  return null;
5094
4661
  }
5095
4662
  function isBoxType(type) {
5096
- return type instanceof arrow12.Struct && getBoxDimension(type.children.map((child) => child.name)) !== null && type.children.every((child) => child.type instanceof arrow12.Float);
4663
+ return type instanceof arrow11.Struct && getBoxDimension(type.children.map((child) => child.name)) !== null && type.children.every((child) => child.type instanceof arrow11.Float);
5097
4664
  }
5098
4665
  function getCommonValue(values) {
5099
4666
  const firstValue = values[0];
@@ -5171,7 +4738,7 @@ function getNesting(kind, type) {
5171
4738
  function getListDepth2(type) {
5172
4739
  let depth = 0;
5173
4740
  let currentType = type;
5174
- while (currentType instanceof arrow13.List || currentType instanceof arrow13.LargeList) {
4741
+ while (currentType instanceof arrow12.List || currentType instanceof arrow12.LargeList) {
5175
4742
  depth++;
5176
4743
  currentType = currentType.children[0].type;
5177
4744
  }
@@ -5180,13 +4747,13 @@ function getListDepth2(type) {
5180
4747
 
5181
4748
  // dist/geoarrow/get-geoarrow-vertex-count.js
5182
4749
  function getGeoarrowVertexCount(input) {
5183
- if (input instanceof arrow14.Table) {
4750
+ if (input instanceof arrow13.Table) {
5184
4751
  return getGeoarrowTableVertexCount(input);
5185
4752
  }
5186
- if (input instanceof arrow14.Vector) {
4753
+ if (input instanceof arrow13.Vector) {
5187
4754
  return getGeoarrowVectorVertexCount(input);
5188
4755
  }
5189
- if (input instanceof arrow14.Data) {
4756
+ if (input instanceof arrow13.Data) {
5190
4757
  return getGeoarrowDataVertexCount(input);
5191
4758
  }
5192
4759
  throw new Error("Expected an Apache Arrow Table, Vector, or Data instance.");
@@ -5213,16 +4780,16 @@ function getGeoarrowVectorVertexCount(vector) {
5213
4780
  }
5214
4781
  function getGeoarrowDataVertexCount(data) {
5215
4782
  var _a, _b, _c, _d, _e, _f, _g;
5216
- if (data.type instanceof arrow14.Binary || data.type instanceof arrow14.LargeBinary || data.type instanceof arrow14.BinaryView) {
4783
+ if (data.type instanceof arrow13.Binary || data.type instanceof arrow13.LargeBinary || data.type instanceof arrow13.BinaryView) {
5217
4784
  return getWKBDataVertexCount(data);
5218
4785
  }
5219
- if (data.type instanceof arrow14.Utf8 || data.type instanceof arrow14.LargeUtf8 || data.type instanceof arrow14.Utf8View) {
4786
+ if (data.type instanceof arrow13.Utf8 || data.type instanceof arrow13.LargeUtf8 || data.type instanceof arrow13.Utf8View) {
5220
4787
  throw new Error("WKT vertex counting is not supported.");
5221
4788
  }
5222
- if (data.type instanceof arrow14.DenseUnion) {
4789
+ if (data.type instanceof arrow13.DenseUnion) {
5223
4790
  return data.children.reduce((vertexCount, child) => vertexCount + getGeoarrowDataVertexCount(child), 0);
5224
4791
  }
5225
- if ((data.type instanceof arrow14.List || data.type instanceof arrow14.LargeList) && ((_a = data.children[0]) == null ? void 0 : _a.type) instanceof arrow14.DenseUnion) {
4792
+ if ((data.type instanceof arrow13.List || data.type instanceof arrow13.LargeList) && ((_a = data.children[0]) == null ? void 0 : _a.type) instanceof arrow13.DenseUnion) {
5226
4793
  return getGeoarrowDataVertexCount(data.children[0]);
5227
4794
  }
5228
4795
  if (isGeoArrowBox(data.type)) {
@@ -5243,16 +4810,16 @@ function getGeoarrowDataVertexCount(data) {
5243
4810
  throw new Error(`Unsupported GeoArrow data type: ${data.type}`);
5244
4811
  }
5245
4812
  function getGeoarrowWKTVertexCount(input) {
5246
- if (input instanceof arrow14.Vector) {
4813
+ if (input instanceof arrow13.Vector) {
5247
4814
  return input.data.reduce((vertexCount, data) => vertexCount + getWKTDataVertexCount(data), 0);
5248
4815
  }
5249
- if (input instanceof arrow14.Data) {
4816
+ if (input instanceof arrow13.Data) {
5250
4817
  return getWKTDataVertexCount(input);
5251
4818
  }
5252
4819
  throw new Error("Expected an Apache Arrow Vector or Data instance.");
5253
4820
  }
5254
4821
  function getWKTDataVertexCount(data) {
5255
- const vector = new arrow14.Vector([data]);
4822
+ const vector = new arrow13.Vector([data]);
5256
4823
  let vertexCount = 0;
5257
4824
  for (let rowIndex = 0; rowIndex < vector.length; rowIndex++) {
5258
4825
  const value = vector.get(rowIndex);
@@ -5283,7 +4850,7 @@ function countGeometryVertices(geometry) {
5283
4850
  }
5284
4851
  }
5285
4852
  function getWKBDataVertexCount(data) {
5286
- const vector = new arrow14.Vector([data]);
4853
+ const vector = new arrow13.Vector([data]);
5287
4854
  let vertexCount = 0;
5288
4855
  for (let rowIndex = 0; rowIndex < vector.length; rowIndex++) {
5289
4856
  const value = vector.get(rowIndex);
@@ -5295,7 +4862,7 @@ function getWKBDataVertexCount(data) {
5295
4862
  }
5296
4863
  function getWKBVertexCount(wkb) {
5297
4864
  try {
5298
- return (0, import_geospatial6.scanWKB)(wkb).coordinateCount;
4865
+ return (0, import_wkb6.scanWKB)(wkb).coordinateCount;
5299
4866
  } catch (error) {
5300
4867
  if (error instanceof Error && error.message.startsWith("Unsupported WKB geometry type")) {
5301
4868
  throw new Error("Unsupported geometry type");
@@ -5352,6 +4919,7 @@ function getVariableLengthByteCount(column, sourceEncoding) {
5352
4919
  }
5353
4920
 
5354
4921
  // dist/geoarrow/geoarrow-converter/convert-geoarrow-geometry.js
4922
+ var import_geoarrow = require("@math.gl/arrow/geoarrow");
5355
4923
  var DEFAULT_MAX_GEOMETRY_COLLECTION_DEPTH = 64;
5356
4924
  function convertGeoArrowVector(column, sourceEncoding, targetEncoding, options) {
5357
4925
  const maxGeometryCollectionDepth = getMaxGeometryCollectionDepth(options);
@@ -5436,7 +5004,7 @@ function convertGeoArrowGeometry(table, targetEncoding, options) {
5436
5004
  const convertedVector = convertedColumns.get(field.name);
5437
5005
  return convertedEncoding && convertedVector ? createConvertedField(field, convertedVector.type, convertedEncoding, (_a2 = conversionOptions.get(field.name)) == null ? void 0 : _a2.geometryTypes, conversionOptions.get(field.name), (_b2 = geoMetadata == null ? void 0 : geoMetadata.columns) == null ? void 0 : _b2[field.name]) : field;
5438
5006
  });
5439
- const nextSchema = new arrow15.Schema(nextFields, nextSchemaMetadata);
5007
+ const nextSchema = new arrow14.Schema(nextFields, nextSchemaMetadata);
5440
5008
  let rowOffset = 0;
5441
5009
  const nextBatches = table.batches.map((batch) => {
5442
5010
  const children = table.schema.fields.map((field) => {
@@ -5455,14 +5023,14 @@ function convertGeoArrowGeometry(table, targetEncoding, options) {
5455
5023
  return batchVector.data[0];
5456
5024
  });
5457
5025
  rowOffset += batch.numRows;
5458
- return new arrow15.RecordBatch(nextSchema, arrow15.makeData({
5459
- type: new arrow15.Struct(nextFields),
5026
+ return new arrow14.RecordBatch(nextSchema, arrow14.makeData({
5027
+ type: new arrow14.Struct(nextFields),
5460
5028
  length: batch.numRows,
5461
5029
  nullCount: 0,
5462
5030
  children
5463
5031
  }));
5464
5032
  });
5465
- return new arrow15.Table(nextSchema, nextBatches);
5033
+ return new arrow14.Table(nextSchema, nextBatches);
5466
5034
  }
5467
5035
  function inferGeometryTypes(table, geometryColumn, sourceEncoding) {
5468
5036
  if (sourceEncoding !== "geoarrow.wkb" && sourceEncoding !== "geoarrow.wkt") {
@@ -5529,7 +5097,7 @@ function convertGeometryColumn(column, sourceEncoding, targetEncoding, geometryC
5529
5097
  }
5530
5098
  const targetValues = geometries.map((geometry) => convertGeometryValue(geometry, targetEncoding, targetDimension, geometryColumn, options));
5531
5099
  const nativeValues = (options == null ? void 0 : options.coordinates) === "separated" ? targetValues.map((value) => separateCoordinateValues(value, targetDimension, targetDimensionName)) : targetValues;
5532
- return arrow15.vectorFromArray(nativeValues, getTargetArrowType(targetEncoding, targetDimension, options, (options == null ? void 0 : options.dimension) || getDimensionFromGeometryTypes(options == null ? void 0 : options.geometryTypes)));
5100
+ return arrow14.vectorFromArray(nativeValues, getTargetArrowType(targetEncoding, targetDimension, options, (options == null ? void 0 : options.dimension) || getDimensionFromGeometryTypes(options == null ? void 0 : options.geometryTypes)));
5533
5101
  }
5534
5102
  function convertGeometryColumnWithMath(column, sourceEncoding, targetEncoding, options) {
5535
5103
  const sourceIsNative = isMathGeoArrowNativeEncoding(sourceEncoding);
@@ -5538,20 +5106,20 @@ function convertGeometryColumnWithMath(column, sourceEncoding, targetEncoding, o
5538
5106
  if (!supportsConversion)
5539
5107
  return null;
5540
5108
  const declaredDimension = getDimensionFromGeometryTypes(options == null ? void 0 : options.geometryTypes);
5541
- const sourceColumn = makeGeoArrowColumnFromArrowVector(column, {
5109
+ const sourceColumn = (0, import_geoarrow.makeGeoArrowColumnFromArrowVector)(column, {
5542
5110
  encoding: sourceEncoding,
5543
5111
  dimension: sourceEncoding === "geoarrow.wkb" ? declaredDimension || "xy" : declaredDimension || (targetEncoding === "geoarrow.wkb" ? options == null ? void 0 : options.dimension : void 0)
5544
5112
  });
5545
5113
  if (sourceEncoding === "geoarrow.wkb") {
5546
5114
  try {
5547
- const decodedColumn = (0, import_geoarrow.decodeGeoArrowWKB)(sourceColumn, {
5115
+ const decodedColumn = (0, import_geoarrow_utils.decodeGeoArrowWKB)(sourceColumn, {
5548
5116
  encoding: targetEncoding,
5549
5117
  dimension: (options == null ? void 0 : options.dimension) || declaredDimension || "infer",
5550
5118
  coordinateLayout: (options == null ? void 0 : options.coordinates) || "interleaved",
5551
5119
  offsetType: (options == null ? void 0 : options.offsetType) || "int32",
5552
5120
  traversal: { maximumDepth: options == null ? void 0 : options.maxGeometryCollectionDepth }
5553
5121
  });
5554
- return makeArrowVectorFromGeoArrowColumn(decodedColumn);
5122
+ return (0, import_geoarrow.makeArrowVectorFromGeoArrowColumn)(decodedColumn);
5555
5123
  } catch (error) {
5556
5124
  if ((options == null ? void 0 : options.maxGeometryCollectionDepth) !== void 0 && error instanceof Error && error.message.includes("nesting exceeds maximumDepth")) {
5557
5125
  throw new Error(`GeometryCollection nesting exceeds maxGeometryCollectionDepth (${options.maxGeometryCollectionDepth}).`);
@@ -5560,15 +5128,15 @@ function convertGeometryColumnWithMath(column, sourceEncoding, targetEncoding, o
5560
5128
  }
5561
5129
  }
5562
5130
  if (targetEncoding === "geoarrow.wkb") {
5563
- return makeArrowVectorFromGeoArrowColumn((0, import_geoarrow.encodeGeoArrowWKB)(sourceColumn));
5131
+ return (0, import_geoarrow.makeArrowVectorFromGeoArrowColumn)((0, import_geoarrow_utils.encodeGeoArrowWKB)(sourceColumn));
5564
5132
  }
5565
- const convertedColumn = (0, import_geoarrow.convertGeoArrowColumn)(sourceColumn, {
5133
+ const convertedColumn = (0, import_geoarrow_utils.convertGeoArrowColumn)(sourceColumn, {
5566
5134
  encoding: targetEncoding,
5567
5135
  dimension: options == null ? void 0 : options.dimension,
5568
5136
  coordinateLayout: (options == null ? void 0 : options.coordinates) || "preserve",
5569
5137
  offsetType: (options == null ? void 0 : options.offsetType) || "preserve"
5570
5138
  });
5571
- return convertedColumn === sourceColumn ? column : makeArrowVectorFromGeoArrowColumn(convertedColumn);
5139
+ return convertedColumn === sourceColumn ? column : (0, import_geoarrow.makeArrowVectorFromGeoArrowColumn)(convertedColumn);
5572
5140
  }
5573
5141
  function isMathGeoArrowNativeEncoding(encoding) {
5574
5142
  return encoding === "geoarrow.point" || encoding === "geoarrow.linestring" || encoding === "geoarrow.polygon" || encoding === "geoarrow.multipoint" || encoding === "geoarrow.multilinestring" || encoding === "geoarrow.multipolygon" || encoding === "geoarrow.geometry" || encoding === "geoarrow.geometrycollection";
@@ -5702,13 +5270,13 @@ function createGeometryUnionVector(geometries, targetDimension, allowGeometryCol
5702
5270
  childValues[childKind].push(geometry ? convertGeometryToUnionChildValue(geometry, targetDimension, geometryColumn) : null);
5703
5271
  }
5704
5272
  const orderedKinds = [...usedKinds].sort((leftKind, rightKind) => getUnionTypeId3(leftKind, targetDimension, targetDimensionName) - getUnionTypeId3(rightKind, targetDimension, targetDimensionName));
5705
- const fields = orderedKinds.map((kind) => new arrow15.Field(getUnionFieldName(kind, targetDimension, targetDimensionName), getUnionChildType(kind, targetDimension, options, geometryCollectionDepth, targetDimensionName), true));
5273
+ const fields = orderedKinds.map((kind) => new arrow14.Field(getUnionFieldName(kind, targetDimension, targetDimensionName), getUnionChildType(kind, targetDimension, options, geometryCollectionDepth, targetDimensionName), true));
5706
5274
  const children = orderedKinds.map((kind) => {
5707
5275
  const values = childValues[kind] || [];
5708
5276
  return createUnionChildVector(kind, values, targetDimension, geometryColumn, options, geometryCollectionDepth, targetDimensionName).data[0];
5709
5277
  });
5710
- const unionType = new arrow15.DenseUnion(orderedKinds.map((kind) => getUnionTypeId3(kind, targetDimension, targetDimensionName)), fields);
5711
- return arrow15.makeVector(arrow15.makeData({
5278
+ const unionType = new arrow14.DenseUnion(orderedKinds.map((kind) => getUnionTypeId3(kind, targetDimension, targetDimensionName)), fields);
5279
+ return arrow14.makeVector(arrow14.makeData({
5712
5280
  type: unionType,
5713
5281
  length: geometries.length,
5714
5282
  nullCount: 0,
@@ -5735,7 +5303,7 @@ function createGeometryCollectionVector(geometries, targetDimension, geometryCol
5735
5303
  valueOffsets.push(flattenedGeometries.length);
5736
5304
  }
5737
5305
  const memberUnionVector = createGeometryUnionVector(flattenedGeometries, targetDimension, false, geometryColumn, options, 0, targetDimensionName);
5738
- const listType = createListType(new arrow15.Field("geometries", memberUnionVector.type, true), options == null ? void 0 : options.offsetType);
5306
+ const listType = createListType(new arrow14.Field("geometries", memberUnionVector.type, true), options == null ? void 0 : options.offsetType);
5739
5307
  const listData = {
5740
5308
  length: geometries.length,
5741
5309
  nullCount: validity.filter((isValid) => !isValid).length,
@@ -5743,16 +5311,16 @@ function createGeometryCollectionVector(geometries, targetDimension, geometryCol
5743
5311
  valueOffsets: createOffsetArray(valueOffsets, options == null ? void 0 : options.offsetType),
5744
5312
  child: memberUnionVector.data[0]
5745
5313
  };
5746
- const listDataValue = listType instanceof arrow15.LargeList ? arrow15.makeData({
5314
+ const listDataValue = listType instanceof arrow14.LargeList ? arrow14.makeData({
5747
5315
  type: listType,
5748
5316
  ...listData,
5749
5317
  valueOffsets: BigInt64Array.from(valueOffsets, BigInt)
5750
- }) : arrow15.makeData({
5318
+ }) : arrow14.makeData({
5751
5319
  type: listType,
5752
5320
  ...listData,
5753
5321
  valueOffsets: Int32Array.from(valueOffsets)
5754
5322
  });
5755
- return arrow15.makeVector(listDataValue);
5323
+ return arrow14.makeVector(listDataValue);
5756
5324
  }
5757
5325
  function convertGeometryToUnionChildValue(geometry, targetDimension, geometryColumn) {
5758
5326
  switch (geometry.type) {
@@ -5777,7 +5345,7 @@ function createUnionChildVector(geometryKind, values, targetDimension, geometryC
5777
5345
  return createGeometryCollectionVector(values, targetDimension, geometryColumn, options, Math.max(geometryCollectionDepth - 1, 0), dimensionName);
5778
5346
  }
5779
5347
  const nativeValues = (options == null ? void 0 : options.coordinates) === "separated" ? values.map((value) => separateCoordinateValues(value, targetDimension, dimensionName)) : values;
5780
- return arrow15.vectorFromArray(nativeValues, getUnionChildType(geometryKind, targetDimension, options, geometryCollectionDepth, dimensionName));
5348
+ return arrow14.vectorFromArray(nativeValues, getUnionChildType(geometryKind, targetDimension, options, geometryCollectionDepth, dimensionName));
5781
5349
  }
5782
5350
  function convertUnionValueToGeometry(value, geometryKind) {
5783
5351
  if (value == null)
@@ -5834,7 +5402,7 @@ function getUnionBufferIndex(bufferLength, offset, rowIndex, useLogicalIndex) {
5834
5402
  }
5835
5403
  function getDenseUnionGeometryKind(vector, rowIndex) {
5836
5404
  var _a;
5837
- if (!(vector.type instanceof arrow15.DenseUnion)) {
5405
+ if (!(vector.type instanceof arrow14.DenseUnion)) {
5838
5406
  throw new Error("GeoArrow geometry storage requires a DenseUnion vector.");
5839
5407
  }
5840
5408
  const { typeId } = getDenseUnionCellInfo(vector, rowIndex);
@@ -5961,7 +5529,7 @@ function createConvertedField(field, type, targetEncoding, geometryTypes, option
5961
5529
  extensionMetadata.geometry_types = [...effectiveGeometryTypes];
5962
5530
  metadata.set("ARROW:extension:metadata", JSON.stringify(extensionMetadata));
5963
5531
  }
5964
- return new arrow15.Field(field.name, type, field.nullable, metadata);
5532
+ return new arrow14.Field(field.name, type, field.nullable, metadata);
5965
5533
  }
5966
5534
  function getPreservedFieldMetadata(sourceGeoColumnMetadata) {
5967
5535
  if (!sourceGeoColumnMetadata)
@@ -6069,18 +5637,18 @@ function getTargetArrowType(targetEncoding, targetDimension, options, dimensionN
6069
5637
  return coordinateType;
6070
5638
  case "geoarrow.linestring":
6071
5639
  case "geoarrow.multipoint":
6072
- return createList(new arrow15.Field("value", coordinateType, true));
5640
+ return createList(new arrow14.Field("value", coordinateType, true));
6073
5641
  case "geoarrow.polygon":
6074
5642
  case "geoarrow.multilinestring":
6075
- return createList(new arrow15.Field("value", createList(new arrow15.Field("value", coordinateType, true)), true));
5643
+ return createList(new arrow14.Field("value", createList(new arrow14.Field("value", coordinateType, true)), true));
6076
5644
  case "geoarrow.multipolygon":
6077
- return createList(new arrow15.Field("value", createList(new arrow15.Field("value", createList(new arrow15.Field("value", coordinateType, true)), true)), true));
5645
+ return createList(new arrow14.Field("value", createList(new arrow14.Field("value", createList(new arrow14.Field("value", coordinateType, true)), true)), true));
6078
5646
  case "geoarrow.box":
6079
- return new arrow15.Struct(getBoxFieldNames3((options == null ? void 0 : options.dimension) || getDimensionName2(targetDimension)).map((name) => new arrow15.Field(name, new arrow15.Float64(), true)));
5647
+ return new arrow14.Struct(getBoxFieldNames3((options == null ? void 0 : options.dimension) || getDimensionName2(targetDimension)).map((name) => new arrow14.Field(name, new arrow14.Float64(), true)));
6080
5648
  case "geoarrow.wkb":
6081
- return new arrow15.Binary();
5649
+ return new arrow14.Binary();
6082
5650
  case "geoarrow.wkt":
6083
- return new arrow15.Utf8();
5651
+ return new arrow14.Utf8();
6084
5652
  default:
6085
5653
  throw new Error(`Unsupported GeoArrow target encoding "${targetEncoding}".`);
6086
5654
  }
@@ -6104,9 +5672,9 @@ function canReuseGeoArrowVector(column, encoding, options) {
6104
5672
  return true;
6105
5673
  }
6106
5674
  function getCoordinateLayout(type) {
6107
- if (type instanceof arrow15.FixedSizeList)
5675
+ if (type instanceof arrow14.FixedSizeList)
6108
5676
  return "interleaved";
6109
- if (type instanceof arrow15.Struct) {
5677
+ if (type instanceof arrow14.Struct) {
6110
5678
  const names = type.children.map((child) => child.name);
6111
5679
  if (names[0] === "x" && names[1] === "y")
6112
5680
  return "separated";
@@ -6117,10 +5685,10 @@ function getCoordinateLayout(type) {
6117
5685
  }
6118
5686
  return null;
6119
5687
  }
6120
- if (type instanceof arrow15.List || type instanceof arrow15.LargeList) {
5688
+ if (type instanceof arrow14.List || type instanceof arrow14.LargeList) {
6121
5689
  return getCoordinateLayout(type.children[0].type);
6122
5690
  }
6123
- if (type instanceof arrow15.DenseUnion) {
5691
+ if (type instanceof arrow14.DenseUnion) {
6124
5692
  for (const child of type.children) {
6125
5693
  const layout = getCoordinateLayout(child.type);
6126
5694
  if (layout)
@@ -6130,18 +5698,18 @@ function getCoordinateLayout(type) {
6130
5698
  return null;
6131
5699
  }
6132
5700
  function getVectorOffsetType(type) {
6133
- if (type instanceof arrow15.List)
5701
+ if (type instanceof arrow14.List)
6134
5702
  return "int32";
6135
- if (type instanceof arrow15.LargeList)
5703
+ if (type instanceof arrow14.LargeList)
6136
5704
  return "int64";
6137
- if (type instanceof arrow15.Struct) {
5705
+ if (type instanceof arrow14.Struct) {
6138
5706
  for (const child of type.children) {
6139
5707
  const offsetType = getVectorOffsetType(child.type);
6140
5708
  if (offsetType)
6141
5709
  return offsetType;
6142
5710
  }
6143
5711
  }
6144
- if (type instanceof arrow15.DenseUnion) {
5712
+ if (type instanceof arrow14.DenseUnion) {
6145
5713
  for (const child of type.children) {
6146
5714
  const offsetType = getVectorOffsetType(child.type);
6147
5715
  if (offsetType)
@@ -6225,10 +5793,10 @@ function buildGeometryUnionType(targetDimension, allowGeometryCollections, optio
6225
5793
  if (allowGeometryCollections && geometryCollectionDepth > 0) {
6226
5794
  geometryKinds.push("GeometryCollection");
6227
5795
  }
6228
- return new arrow15.DenseUnion(geometryKinds.map((geometryKind) => getUnionTypeId3(geometryKind, targetDimension, dimensionName)), geometryKinds.map((geometryKind) => new arrow15.Field(getUnionFieldName(geometryKind, targetDimension, dimensionName), getUnionChildType(geometryKind, targetDimension, options, geometryCollectionDepth, dimensionName), true)));
5796
+ return new arrow14.DenseUnion(geometryKinds.map((geometryKind) => getUnionTypeId3(geometryKind, targetDimension, dimensionName)), geometryKinds.map((geometryKind) => new arrow14.Field(getUnionFieldName(geometryKind, targetDimension, dimensionName), getUnionChildType(geometryKind, targetDimension, options, geometryCollectionDepth, dimensionName), true)));
6229
5797
  }
6230
5798
  function buildGeometryCollectionType(targetDimension, options, geometryCollectionDepth = 0, dimensionName = getDimensionName2(targetDimension)) {
6231
- return createListType(new arrow15.Field("geometries", buildGeometryUnionType(targetDimension, geometryCollectionDepth > 0, options, geometryCollectionDepth, dimensionName), true), options == null ? void 0 : options.offsetType);
5799
+ return createListType(new arrow14.Field("geometries", buildGeometryUnionType(targetDimension, geometryCollectionDepth > 0, options, geometryCollectionDepth, dimensionName), true), options == null ? void 0 : options.offsetType);
6232
5800
  }
6233
5801
  function getUnionBaseTypeId(geometryKind) {
6234
5802
  switch (geometryKind) {
@@ -6321,13 +5889,13 @@ function getBoxFieldNames3(dimension) {
6321
5889
  }
6322
5890
  function getCoordinateType(targetDimension, coordinates = "interleaved", dimensionName = getDimensionName2(targetDimension)) {
6323
5891
  if (coordinates === "interleaved") {
6324
- return new arrow15.FixedSizeList(targetDimension, new arrow15.Field("value", new arrow15.Float64(), true));
5892
+ return new arrow14.FixedSizeList(targetDimension, new arrow14.Field("value", new arrow14.Float64(), true));
6325
5893
  }
6326
5894
  const coordinateNames = dimensionName === "xy" ? ["x", "y"] : dimensionName === "xyz" ? ["x", "y", "z"] : dimensionName === "xym" ? ["x", "y", "m"] : ["x", "y", "z", "m"];
6327
- return new arrow15.Struct(coordinateNames.map((name) => new arrow15.Field(name, new arrow15.Float64(), true)));
5895
+ return new arrow14.Struct(coordinateNames.map((name) => new arrow14.Field(name, new arrow14.Float64(), true)));
6328
5896
  }
6329
5897
  function createListType(field, offsetType = "int32") {
6330
- return offsetType === "int64" ? new arrow15.LargeList(field) : new arrow15.List(field);
5898
+ return offsetType === "int64" ? new arrow14.LargeList(field) : new arrow14.List(field);
6331
5899
  }
6332
5900
  function createOffsetArray(offsets, offsetType = "int32") {
6333
5901
  return offsetType === "int64" ? BigInt64Array.from(offsets, BigInt) : Int32Array.from(offsets);
@@ -6424,17 +5992,18 @@ function padPosition(position, targetDimension) {
6424
5992
  }
6425
5993
 
6426
5994
  // dist/geoarrow/geoarrow-bounds.js
6427
- var import_geospatial7 = require("@math.gl/geospatial");
6428
- var import_geoarrow3 = require("@math.gl/geospatial/geoarrow");
5995
+ var import_wkb7 = require("@math.gl/arrow/wkb");
5996
+ var import_geoarrow2 = require("@math.gl/arrow/geoarrow");
5997
+ var import_geoarrow_utils3 = require("@math.gl/arrow/geoarrow-utils");
6429
5998
 
6430
5999
  // dist/geoarrow/binary-polygon-to-geoarrow.js
6431
- var import_geoarrow2 = require("@math.gl/geospatial/geoarrow");
6000
+ var import_geoarrow_utils2 = require("@math.gl/arrow/geoarrow-utils");
6432
6001
  function makeGeoArrowColumnFromBinaryPolygon(geometry, options) {
6433
6002
  const { dimension } = options;
6434
6003
  if (!["xy", "xyz", "xym", "xyzm"].includes(dimension)) {
6435
6004
  throw new Error("Binary polygon dimension must be xy, xyz, xym, or xyzm.");
6436
6005
  }
6437
- const coordinateSize = (0, import_geoarrow2.getGeoArrowDimensionSize)(dimension);
6006
+ const coordinateSize = (0, import_geoarrow_utils2.getGeoArrowDimensionSize)(dimension);
6438
6007
  const positions = geometry.positions.value;
6439
6008
  if (!(positions instanceof Float32Array || positions instanceof Float64Array) || geometry.positions.size !== coordinateSize || positions.length % coordinateSize !== 0) {
6440
6009
  throw new Error("Binary polygon positions must be floating-point tuples matching dimension.");
@@ -6503,7 +6072,7 @@ function getGeoArrowRowBounds(column, encodingOrOptions) {
6503
6072
  if (typeof encodingOrOptions === "string") {
6504
6073
  throw new Error("Binary polygon bounds require an explicit dimension option.");
6505
6074
  }
6506
- return (0, import_geoarrow3.getGeoArrowRowBounds)(makeGeoArrowColumnFromBinaryPolygon(column, encodingOrOptions));
6075
+ return (0, import_geoarrow_utils3.getGeoArrowRowBounds)(makeGeoArrowColumnFromBinaryPolygon(column, encodingOrOptions));
6507
6076
  }
6508
6077
  if (typeof encodingOrOptions !== "string") {
6509
6078
  throw new Error("Arrow vector bounds require a GeoArrow encoding.");
@@ -6512,7 +6081,7 @@ function getGeoArrowRowBounds(column, encodingOrOptions) {
6512
6081
  if (encoding !== "geoarrow.wkb" && encoding !== "geoarrow.wkt") {
6513
6082
  const names = encoding === "geoarrow.box" ? column.type.children.map((field) => field.name) : [];
6514
6083
  const dimension = encoding === "geoarrow.box" ? names.includes("zmin") ? names.includes("mmin") ? "xyzm" : "xyz" : names.includes("mmin") ? "xym" : "xy" : void 0;
6515
- return (0, import_geoarrow3.getGeoArrowRowBounds)(makeGeoArrowColumnFromArrowVector(column, { encoding, dimension }));
6084
+ return (0, import_geoarrow_utils3.getGeoArrowRowBounds)((0, import_geoarrow2.makeGeoArrowColumnFromArrowVector)(column, { encoding, dimension }));
6516
6085
  }
6517
6086
  const bounds = [];
6518
6087
  for (let rowIndex = 0; rowIndex < column.length; rowIndex++) {
@@ -6525,7 +6094,7 @@ function getGeoArrowBounds(value, encoding) {
6525
6094
  return null;
6526
6095
  if (encoding === "geoarrow.wkb") {
6527
6096
  const bytes = value;
6528
- const statistics = (0, import_geospatial7.scanWKB)(bytes);
6097
+ const statistics = (0, import_wkb7.scanWKB)(bytes);
6529
6098
  return statistics.bounds ? [
6530
6099
  statistics.bounds.xmin,
6531
6100
  statistics.bounds.ymin,