@loaders.gl/arrow 4.0.4 → 4.1.0-alpha.1

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 (51) hide show
  1. package/dist/arrow-worker.js +237 -2
  2. package/dist/dist.dev.js +1398 -610
  3. package/dist/geoarrow/convert-geoarrow-to-binary-geometry.d.ts +4 -2
  4. package/dist/geoarrow/convert-geoarrow-to-binary-geometry.d.ts.map +1 -1
  5. package/dist/geoarrow/convert-geoarrow-to-binary-geometry.js +51 -32
  6. package/dist/geoarrow/convert-geoarrow-to-binary-geometry.js.map +1 -1
  7. package/dist/geoarrow/convert-geoarrow-to-geojson-geometry.d.ts +13 -0
  8. package/dist/geoarrow/convert-geoarrow-to-geojson-geometry.d.ts.map +1 -0
  9. package/dist/geoarrow/{convert-geoarrow-to-geojson.js → convert-geoarrow-to-geojson-geometry.js} +34 -27
  10. package/dist/geoarrow/convert-geoarrow-to-geojson-geometry.js.map +1 -0
  11. package/dist/geoarrow-loader.d.ts.map +1 -1
  12. package/dist/geoarrow-loader.js +0 -1
  13. package/dist/geoarrow-loader.js.map +1 -1
  14. package/dist/index.cjs +361 -332
  15. package/dist/index.d.ts +1 -1
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +1 -1
  18. package/dist/index.js.map +1 -1
  19. package/dist/parsers/parse-arrow-sync.d.ts.map +1 -1
  20. package/dist/parsers/parse-arrow-sync.js +2 -0
  21. package/dist/parsers/parse-arrow-sync.js.map +1 -1
  22. package/dist/tables/convert-arrow-to-columnar-table.d.ts.map +1 -1
  23. package/dist/tables/convert-arrow-to-columnar-table.js +1 -0
  24. package/dist/tables/convert-arrow-to-columnar-table.js.map +1 -1
  25. package/dist/tables/convert-arrow-to-geojson-table.d.ts +1 -1
  26. package/dist/tables/convert-arrow-to-geojson-table.d.ts.map +1 -1
  27. package/dist/tables/convert-arrow-to-geojson-table.js +14 -8
  28. package/dist/tables/convert-arrow-to-geojson-table.js.map +1 -1
  29. package/dist/tables/convert-columnar-to-row-table.d.ts.map +1 -1
  30. package/dist/tables/convert-columnar-to-row-table.js +1 -0
  31. package/dist/tables/convert-columnar-to-row-table.js.map +1 -1
  32. package/dist/triangulate-on-worker.d.ts +1 -1
  33. package/dist/triangulate-on-worker.d.ts.map +1 -1
  34. package/dist/triangulate-on-worker.js.map +1 -1
  35. package/dist/triangulation-worker.js +31 -24
  36. package/dist/workers/triangulation-worker.js +3 -1
  37. package/dist/workers/triangulation-worker.js.map +1 -1
  38. package/package.json +16 -10
  39. package/src/geoarrow/convert-geoarrow-to-binary-geometry.ts +81 -46
  40. package/src/geoarrow/{convert-geoarrow-to-geojson.ts → convert-geoarrow-to-geojson-geometry.ts} +56 -46
  41. package/src/geoarrow-loader.ts +0 -4
  42. package/src/index.ts +1 -1
  43. package/src/parsers/parse-arrow-sync.ts +6 -1
  44. package/src/tables/convert-arrow-to-columnar-table.ts +1 -0
  45. package/src/tables/convert-arrow-to-geojson-table.ts +18 -7
  46. package/src/tables/convert-columnar-to-row-table.ts +1 -0
  47. package/src/triangulate-on-worker.ts +1 -1
  48. package/src/workers/triangulation-worker.ts +1 -1
  49. package/dist/geoarrow/convert-geoarrow-to-geojson.d.ts +0 -20
  50. package/dist/geoarrow/convert-geoarrow-to-geojson.d.ts.map +0 -1
  51. package/dist/geoarrow/convert-geoarrow-to-geojson.js.map +0 -1
package/dist/dist.dev.js CHANGED
@@ -12427,252 +12427,519 @@ return true;`);
12427
12427
  }
12428
12428
  return {
12429
12429
  shape: "columnar-table",
12430
+ schema: table.schema,
12430
12431
  data: columnarTable
12431
12432
  };
12432
12433
  }
12433
12434
 
12434
- // src/parsers/parse-arrow-sync.ts
12435
- function parseArrowSync(arrayBuffer, options) {
12436
- const apacheArrowTable = tableFromIPC([new Uint8Array(arrayBuffer)]);
12437
- const arrowTable = {
12438
- shape: "arrow-table",
12439
- data: apacheArrowTable
12435
+ // src/schema/convert-arrow-schema.ts
12436
+ function serializeArrowSchema(arrowSchema) {
12437
+ return {
12438
+ fields: arrowSchema.fields.map((arrowField) => serializeArrowField(arrowField)),
12439
+ metadata: serializeArrowMetadata(arrowSchema.metadata)
12440
12440
  };
12441
- const shape = options?.shape || "arrow-table";
12442
- switch (shape) {
12443
- case "arrow-table":
12444
- return arrowTable;
12445
- case "columnar-table":
12446
- return convertArrowToColumnarTable(arrowTable);
12447
- case "object-row-table":
12448
- let columnarTable = convertArrowToColumnarTable(arrowTable);
12449
- return convertTable(columnarTable, "object-row-table");
12450
- case "array-row-table":
12451
- columnarTable = convertArrowToColumnarTable(arrowTable);
12452
- return convertTable(columnarTable, "array-row-table");
12453
- default:
12454
- throw new Error(shape);
12455
- }
12456
- }
12457
-
12458
- // src/parsers/parse-arrow-in-batches.ts
12459
- function parseArrowInBatches(asyncIterator) {
12460
- async function* makeArrowAsyncIterator() {
12461
- const readers = RecordBatchReader.readAll(asyncIterator);
12462
- for await (const reader of readers) {
12463
- for await (const recordBatch of reader) {
12464
- const arrowTabledBatch = {
12465
- shape: "arrow-table",
12466
- batchType: "data",
12467
- data: new Table([recordBatch]),
12468
- length: recordBatch.data.length
12469
- };
12470
- yield arrowTabledBatch;
12471
- }
12472
- break;
12473
- }
12474
- }
12475
- return makeArrowAsyncIterator();
12476
- }
12477
-
12478
- // src/arrow-loader.ts
12479
- var VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
12480
- var ArrowWorkerLoader = {
12481
- name: "Apache Arrow",
12482
- id: "arrow",
12483
- module: "arrow",
12484
- version: VERSION,
12485
- category: "table",
12486
- extensions: ["arrow", "feather"],
12487
- mimeTypes: ["application/vnd.apache.arrow.file", "application/vnd.apache.arrow.stream", "application/octet-stream"],
12488
- binary: true,
12489
- tests: ["ARROW"],
12490
- options: {
12491
- arrow: {
12492
- shape: "columnar-table"
12493
- }
12494
- }
12495
- };
12496
- var ArrowLoader = {
12497
- ...ArrowWorkerLoader,
12498
- parse: async (arraybuffer, options) => parseArrowSync(arraybuffer, options?.arrow),
12499
- parseSync: (arraybuffer, options) => parseArrowSync(arraybuffer, options?.arrow),
12500
- parseInBatches: parseArrowInBatches
12501
- };
12502
-
12503
- // src/lib/encode-arrow.ts
12504
- function encodeArrowSync(data) {
12505
- const vectors = {};
12506
- for (const arrayData of data) {
12507
- const arrayVector = createVector(arrayData.array, arrayData.type);
12508
- vectors[arrayData.name] = arrayVector;
12509
- }
12510
- const table = new Table(vectors);
12511
- const arrowBuffer = tableToIPC(table);
12512
- return arrowBuffer;
12513
- }
12514
- function createVector(array, type) {
12515
- switch (type) {
12516
- case VECTOR_TYPES.DATE:
12517
- return vectorFromArray(array);
12518
- case VECTOR_TYPES.FLOAT:
12519
- default:
12520
- return vectorFromArray(array);
12521
- }
12522
- }
12523
-
12524
- // src/arrow-writer.ts
12525
- var VERSION2 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
12526
- var ArrowWriter = {
12527
- name: "Apache Arrow",
12528
- id: "arrow",
12529
- module: "arrow",
12530
- version: VERSION2,
12531
- extensions: ["arrow", "feather"],
12532
- mimeTypes: ["application/vnd.apache.arrow.file", "application/vnd.apache.arrow.stream", "application/octet-stream"],
12533
- binary: true,
12534
- options: {},
12535
- encode: async function encodeArrow(data, options) {
12536
- return encodeArrowSync(data);
12537
- },
12538
- encodeSync(data, options) {
12539
- return encodeArrowSync(data);
12540
- }
12541
- };
12542
-
12543
- // ../gis/src/lib/geo/geoarrow-metadata.ts
12544
- var GEOARROW_ENCODINGS = ["geoarrow.multipolygon", "geoarrow.polygon", "geoarrow.multilinestring", "geoarrow.linestring", "geoarrow.multipoint", "geoarrow.point", "geoarrow.wkb", "geoarrow.wkt"];
12545
- var GEOARROW_COLUMN_METADATA_ENCODING = "ARROW:extension:name";
12546
- var GEOARROW_COLUMN_METADATA_METADATA = "ARROW:extension:metadata";
12547
- function getGeometryColumnsFromSchema(schema) {
12548
- const geometryColumns = {};
12549
- for (const field of schema.fields) {
12550
- const metadata = getGeometryMetadataForField(field);
12551
- if (metadata) {
12552
- geometryColumns[field.name] = metadata;
12553
- }
12554
- }
12555
- return geometryColumns;
12556
- }
12557
- function getGeometryMetadataForField(field) {
12558
- let metadata = null;
12559
- const columnMetadata = field.metadata?.[GEOARROW_COLUMN_METADATA_METADATA];
12560
- if (columnMetadata) {
12561
- try {
12562
- metadata = JSON.parse(columnMetadata);
12563
- } catch (error) {
12564
- console.warn("Failed to parse GeoArrow metadata", error);
12565
- }
12566
- }
12567
- let geoEncoding = field.metadata?.[GEOARROW_COLUMN_METADATA_ENCODING];
12568
- if (geoEncoding) {
12569
- geoEncoding = geoEncoding.toLowerCase();
12570
- if (!GEOARROW_ENCODINGS.includes(geoEncoding)) {
12571
- console.warn(`Invalid GeoArrow encoding: ${geoEncoding}`);
12572
- } else {
12573
- metadata = metadata || {};
12574
- metadata.encoding = geoEncoding;
12575
- }
12576
- }
12577
- return metadata || null;
12578
12441
  }
12579
-
12580
- // ../../node_modules/@babel/runtime/helpers/esm/typeof.js
12581
- function _typeof(obj) {
12582
- "@babel/helpers - typeof";
12583
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
12584
- return typeof obj2;
12585
- } : function(obj2) {
12586
- return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
12587
- }, _typeof(obj);
12442
+ function deserializeArrowSchema(schema) {
12443
+ return new Schema2(schema.fields.map((field) => deserializeArrowField(field)), deserializeArrowMetadata(schema.metadata));
12588
12444
  }
12589
-
12590
- // ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
12591
- function _toPrimitive(input, hint) {
12592
- if (_typeof(input) !== "object" || input === null)
12593
- return input;
12594
- var prim = input[Symbol.toPrimitive];
12595
- if (prim !== void 0) {
12596
- var res = prim.call(input, hint || "default");
12597
- if (_typeof(res) !== "object")
12598
- return res;
12599
- throw new TypeError("@@toPrimitive must return a primitive value.");
12600
- }
12601
- return (hint === "string" ? String : Number)(input);
12445
+ function serializeArrowMetadata(arrowMetadata) {
12446
+ return Object.fromEntries(arrowMetadata);
12602
12447
  }
12603
-
12604
- // ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
12605
- function _toPropertyKey(arg) {
12606
- var key = _toPrimitive(arg, "string");
12607
- return _typeof(key) === "symbol" ? key : String(key);
12448
+ function deserializeArrowMetadata(metadata) {
12449
+ return metadata ? new Map(Object.entries(metadata)) : /* @__PURE__ */ new Map();
12608
12450
  }
12609
-
12610
- // ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
12611
- function _defineProperty(obj, key, value) {
12612
- key = _toPropertyKey(key);
12613
- if (key in obj) {
12614
- Object.defineProperty(obj, key, {
12615
- value,
12616
- enumerable: true,
12617
- configurable: true,
12618
- writable: true
12619
- });
12620
- } else {
12621
- obj[key] = value;
12622
- }
12623
- return obj;
12451
+ function serializeArrowField(field) {
12452
+ return {
12453
+ name: field.name,
12454
+ type: serializeArrowType(field.type),
12455
+ nullable: field.nullable,
12456
+ metadata: serializeArrowMetadata(field.metadata)
12457
+ };
12624
12458
  }
12625
-
12626
- // ../../node_modules/@math.gl/polygon/dist/polygon-utils.js
12627
- var DimIndex = {
12628
- x: 0,
12629
- y: 1,
12630
- z: 2
12631
- };
12632
- function getPolygonSignedArea(points, options = {}) {
12633
- const {
12634
- start = 0,
12635
- end = points.length,
12636
- plane = "xy"
12637
- } = options;
12638
- const dim = options.size || 2;
12639
- let area2 = 0;
12640
- const i0 = DimIndex[plane[0]];
12641
- const i1 = DimIndex[plane[1]];
12642
- for (let i = start, j = end - dim; i < end; i += dim) {
12643
- area2 += (points[i + i0] - points[j + i0]) * (points[i + i1] + points[j + i1]);
12644
- j = i;
12645
- }
12646
- return area2 / 2;
12459
+ function deserializeArrowField(field) {
12460
+ return new Field2(field.name, deserializeArrowType(field.type), field.nullable, deserializeArrowMetadata(field.metadata));
12647
12461
  }
12648
-
12649
- // ../../node_modules/@math.gl/polygon/dist/earcut.js
12650
- function earcut(positions, holeIndices, dim = 2, areas, plane = "xy") {
12651
- const hasHoles = holeIndices && holeIndices.length;
12652
- const outerLen = hasHoles ? holeIndices[0] * dim : positions.length;
12653
- let outerNode = linkedList(positions, 0, outerLen, dim, true, areas && areas[0], plane);
12654
- const triangles = [];
12655
- if (!outerNode || outerNode.next === outerNode.prev)
12656
- return triangles;
12657
- let invSize;
12658
- let maxX;
12659
- let maxY;
12660
- let minX;
12661
- let minY;
12662
- let x;
12663
- let y;
12664
- if (hasHoles)
12665
- outerNode = eliminateHoles(positions, holeIndices, outerNode, dim, areas, plane);
12666
- if (positions.length > 80 * dim) {
12667
- minX = maxX = positions[0];
12668
- minY = maxY = positions[1];
12669
- for (let i = dim; i < outerLen; i += dim) {
12670
- x = positions[i];
12671
- y = positions[i + 1];
12672
- if (x < minX)
12673
- minX = x;
12674
- if (y < minY)
12675
- minY = y;
12462
+ function serializeArrowType(arrowType) {
12463
+ switch (arrowType.constructor) {
12464
+ case Null:
12465
+ return "null";
12466
+ case Binary:
12467
+ return "binary";
12468
+ case Bool:
12469
+ return "bool";
12470
+ case Int_:
12471
+ const intType = arrowType;
12472
+ return `${intType.isSigned ? "u" : ""}int${intType.bitWidth}`;
12473
+ case Int8:
12474
+ return "int8";
12475
+ case Int16:
12476
+ return "int16";
12477
+ case Int32:
12478
+ return "int32";
12479
+ case Int64:
12480
+ return "int64";
12481
+ case Uint8:
12482
+ return "uint8";
12483
+ case Uint16:
12484
+ return "uint16";
12485
+ case Uint32:
12486
+ return "uint32";
12487
+ case Uint64:
12488
+ return "uint64";
12489
+ case Float:
12490
+ const precision = arrowType.precision;
12491
+ switch (precision) {
12492
+ case Precision.HALF:
12493
+ return "float16";
12494
+ case Precision.SINGLE:
12495
+ return "float32";
12496
+ case Precision.DOUBLE:
12497
+ return "float64";
12498
+ default:
12499
+ return "float16";
12500
+ }
12501
+ case Float16:
12502
+ return "float16";
12503
+ case Float32:
12504
+ return "float32";
12505
+ case Float64:
12506
+ return "float64";
12507
+ case Utf8:
12508
+ return "utf8";
12509
+ case Decimal:
12510
+ const decimal = arrowType;
12511
+ return {
12512
+ type: "decimal",
12513
+ bitWidth: decimal.bitWidth,
12514
+ precision: decimal.precision,
12515
+ scale: decimal.scale
12516
+ };
12517
+ case Date_:
12518
+ const dateUnit = arrowType.unit;
12519
+ return dateUnit === DateUnit.DAY ? "date-day" : "date-millisecond";
12520
+ case DateDay:
12521
+ return "date-day";
12522
+ case DateMillisecond:
12523
+ return "date-millisecond";
12524
+ case Time_:
12525
+ const timeUnit = arrowType.unit;
12526
+ switch (timeUnit) {
12527
+ case TimeUnit.SECOND:
12528
+ return "time-second";
12529
+ case TimeUnit.MILLISECOND:
12530
+ return "time-millisecond";
12531
+ case TimeUnit.MICROSECOND:
12532
+ return "time-microsecond";
12533
+ case TimeUnit.NANOSECOND:
12534
+ return "time-nanosecond";
12535
+ default:
12536
+ return "time-second";
12537
+ }
12538
+ case TimeMillisecond:
12539
+ return "time-millisecond";
12540
+ case TimeSecond:
12541
+ return "time-second";
12542
+ case TimeMicrosecond:
12543
+ return "time-microsecond";
12544
+ case TimeNanosecond:
12545
+ return "time-nanosecond";
12546
+ case Timestamp_:
12547
+ const timeStampUnit = arrowType.unit;
12548
+ switch (timeStampUnit) {
12549
+ case TimeUnit.SECOND:
12550
+ return "timestamp-second";
12551
+ case TimeUnit.MILLISECOND:
12552
+ return "timestamp-millisecond";
12553
+ case TimeUnit.MICROSECOND:
12554
+ return "timestamp-microsecond";
12555
+ case TimeUnit.NANOSECOND:
12556
+ return "timestamp-nanosecond";
12557
+ default:
12558
+ return "timestamp-second";
12559
+ }
12560
+ case TimestampSecond:
12561
+ return "timestamp-second";
12562
+ case TimestampMillisecond:
12563
+ return "timestamp-millisecond";
12564
+ case TimestampMicrosecond:
12565
+ return "timestamp-microsecond";
12566
+ case TimestampNanosecond:
12567
+ return "timestamp-nanosecond";
12568
+ case Interval_:
12569
+ const intervalUnit = arrowType.unit;
12570
+ switch (intervalUnit) {
12571
+ case IntervalUnit.DAY_TIME:
12572
+ return "interval-daytime";
12573
+ case IntervalUnit.YEAR_MONTH:
12574
+ return "interval-yearmonth";
12575
+ default:
12576
+ return "interval-daytime";
12577
+ }
12578
+ case IntervalDayTime:
12579
+ return "interval-daytime";
12580
+ case IntervalYearMonth:
12581
+ return "interval-yearmonth";
12582
+ case Map_:
12583
+ const mapType = arrowType;
12584
+ return {
12585
+ type: "map",
12586
+ keysSorted: mapType.keysSorted,
12587
+ children: mapType.children.map((arrowField) => serializeArrowField(arrowField))
12588
+ };
12589
+ case List:
12590
+ const listType = arrowType;
12591
+ const listField = listType.valueField;
12592
+ return {
12593
+ type: "list",
12594
+ children: [serializeArrowField(listField)]
12595
+ };
12596
+ case FixedSizeList:
12597
+ const fixedSizeList = arrowType;
12598
+ return {
12599
+ type: "fixed-size-list",
12600
+ listSize: fixedSizeList.listSize,
12601
+ children: [serializeArrowField(fixedSizeList.children[0])]
12602
+ };
12603
+ case Struct:
12604
+ const structType = arrowType;
12605
+ return {
12606
+ type: "struct",
12607
+ children: structType.children.map((arrowField) => serializeArrowField(arrowField))
12608
+ };
12609
+ default:
12610
+ throw new Error(`arrow type not supported: ${arrowType.constructor.name}`);
12611
+ }
12612
+ }
12613
+ function deserializeArrowType(dataType) {
12614
+ if (typeof dataType === "object") {
12615
+ switch (dataType.type) {
12616
+ case "decimal":
12617
+ return new Decimal(dataType.precision, dataType.scale, dataType.bitWidth);
12618
+ case "map":
12619
+ let children = dataType.children.map((arrowField) => deserializeArrowField(arrowField));
12620
+ return new Map_(children, dataType.keysSorted);
12621
+ case "list":
12622
+ const field = deserializeArrowField(dataType.children[0]);
12623
+ return new List(field);
12624
+ case "fixed-size-list":
12625
+ const child = deserializeArrowField(dataType.children[0]);
12626
+ return new FixedSizeList(dataType.listSize, child);
12627
+ case "struct":
12628
+ children = dataType.children.map((arrowField) => deserializeArrowField(arrowField));
12629
+ return new Struct(children);
12630
+ default:
12631
+ throw new Error("array type not supported");
12632
+ }
12633
+ }
12634
+ switch (dataType) {
12635
+ case "null":
12636
+ return new Null();
12637
+ case "binary":
12638
+ return new Binary();
12639
+ case "bool":
12640
+ return new Bool();
12641
+ case "int8":
12642
+ return new Int8();
12643
+ case "int16":
12644
+ return new Int16();
12645
+ case "int32":
12646
+ return new Int32();
12647
+ case "int64":
12648
+ return new Int64();
12649
+ case "uint8":
12650
+ return new Uint8();
12651
+ case "uint16":
12652
+ return new Uint16();
12653
+ case "uint32":
12654
+ return new Uint32();
12655
+ case "uint64":
12656
+ return new Uint64();
12657
+ case "float16":
12658
+ return new Float16();
12659
+ case "float32":
12660
+ return new Float32();
12661
+ case "float64":
12662
+ return new Float64();
12663
+ case "utf8":
12664
+ return new Utf8();
12665
+ case "date-day":
12666
+ return new DateDay();
12667
+ case "date-millisecond":
12668
+ return new DateMillisecond();
12669
+ case "time-second":
12670
+ return new TimeSecond();
12671
+ case "time-millisecond":
12672
+ return new TimeMillisecond();
12673
+ case "time-microsecond":
12674
+ return new TimeMicrosecond();
12675
+ case "time-nanosecond":
12676
+ return new TimeNanosecond();
12677
+ case "timestamp-second":
12678
+ return new TimestampSecond();
12679
+ case "timestamp-millisecond":
12680
+ return new TimestampMillisecond();
12681
+ case "timestamp-microsecond":
12682
+ return new TimestampMicrosecond();
12683
+ case "timestamp-nanosecond":
12684
+ return new TimestampNanosecond();
12685
+ case "interval-daytime":
12686
+ return new IntervalDayTime();
12687
+ case "interval-yearmonth":
12688
+ return new IntervalYearMonth();
12689
+ default:
12690
+ throw new Error("array type not supported");
12691
+ }
12692
+ }
12693
+
12694
+ // src/parsers/parse-arrow-sync.ts
12695
+ function parseArrowSync(arrayBuffer, options) {
12696
+ const apacheArrowTable = tableFromIPC([new Uint8Array(arrayBuffer)]);
12697
+ const arrowTable = {
12698
+ shape: "arrow-table",
12699
+ schema: serializeArrowSchema(apacheArrowTable.schema),
12700
+ data: apacheArrowTable
12701
+ };
12702
+ const shape = options?.shape || "arrow-table";
12703
+ switch (shape) {
12704
+ case "arrow-table":
12705
+ return arrowTable;
12706
+ case "columnar-table":
12707
+ return convertArrowToColumnarTable(arrowTable);
12708
+ case "object-row-table":
12709
+ let columnarTable = convertArrowToColumnarTable(arrowTable);
12710
+ return convertTable(columnarTable, "object-row-table");
12711
+ case "array-row-table":
12712
+ columnarTable = convertArrowToColumnarTable(arrowTable);
12713
+ return convertTable(columnarTable, "array-row-table");
12714
+ default:
12715
+ throw new Error(shape);
12716
+ }
12717
+ }
12718
+
12719
+ // src/parsers/parse-arrow-in-batches.ts
12720
+ function parseArrowInBatches(asyncIterator) {
12721
+ async function* makeArrowAsyncIterator() {
12722
+ const readers = RecordBatchReader.readAll(asyncIterator);
12723
+ for await (const reader of readers) {
12724
+ for await (const recordBatch of reader) {
12725
+ const arrowTabledBatch = {
12726
+ shape: "arrow-table",
12727
+ batchType: "data",
12728
+ data: new Table([recordBatch]),
12729
+ length: recordBatch.data.length
12730
+ };
12731
+ yield arrowTabledBatch;
12732
+ }
12733
+ break;
12734
+ }
12735
+ }
12736
+ return makeArrowAsyncIterator();
12737
+ }
12738
+
12739
+ // src/arrow-loader.ts
12740
+ var VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
12741
+ var ArrowWorkerLoader = {
12742
+ name: "Apache Arrow",
12743
+ id: "arrow",
12744
+ module: "arrow",
12745
+ version: VERSION,
12746
+ category: "table",
12747
+ extensions: ["arrow", "feather"],
12748
+ mimeTypes: ["application/vnd.apache.arrow.file", "application/vnd.apache.arrow.stream", "application/octet-stream"],
12749
+ binary: true,
12750
+ tests: ["ARROW"],
12751
+ options: {
12752
+ arrow: {
12753
+ shape: "columnar-table"
12754
+ }
12755
+ }
12756
+ };
12757
+ var ArrowLoader = {
12758
+ ...ArrowWorkerLoader,
12759
+ parse: async (arraybuffer, options) => parseArrowSync(arraybuffer, options?.arrow),
12760
+ parseSync: (arraybuffer, options) => parseArrowSync(arraybuffer, options?.arrow),
12761
+ parseInBatches: parseArrowInBatches
12762
+ };
12763
+
12764
+ // src/lib/encode-arrow.ts
12765
+ function encodeArrowSync(data) {
12766
+ const vectors = {};
12767
+ for (const arrayData of data) {
12768
+ const arrayVector = createVector(arrayData.array, arrayData.type);
12769
+ vectors[arrayData.name] = arrayVector;
12770
+ }
12771
+ const table = new Table(vectors);
12772
+ const arrowBuffer = tableToIPC(table);
12773
+ return arrowBuffer;
12774
+ }
12775
+ function createVector(array, type) {
12776
+ switch (type) {
12777
+ case VECTOR_TYPES.DATE:
12778
+ return vectorFromArray(array);
12779
+ case VECTOR_TYPES.FLOAT:
12780
+ default:
12781
+ return vectorFromArray(array);
12782
+ }
12783
+ }
12784
+
12785
+ // src/arrow-writer.ts
12786
+ var VERSION2 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
12787
+ var ArrowWriter = {
12788
+ name: "Apache Arrow",
12789
+ id: "arrow",
12790
+ module: "arrow",
12791
+ version: VERSION2,
12792
+ extensions: ["arrow", "feather"],
12793
+ mimeTypes: ["application/vnd.apache.arrow.file", "application/vnd.apache.arrow.stream", "application/octet-stream"],
12794
+ binary: true,
12795
+ options: {},
12796
+ encode: async function encodeArrow(data, options) {
12797
+ return encodeArrowSync(data);
12798
+ },
12799
+ encodeSync(data, options) {
12800
+ return encodeArrowSync(data);
12801
+ }
12802
+ };
12803
+
12804
+ // ../gis/src/lib/geo/geoarrow-metadata.ts
12805
+ var GEOARROW_ENCODINGS = ["geoarrow.multipolygon", "geoarrow.polygon", "geoarrow.multilinestring", "geoarrow.linestring", "geoarrow.multipoint", "geoarrow.point", "geoarrow.wkb", "geoarrow.wkt"];
12806
+ var GEOARROW_COLUMN_METADATA_ENCODING = "ARROW:extension:name";
12807
+ var GEOARROW_COLUMN_METADATA_METADATA = "ARROW:extension:metadata";
12808
+ function getGeometryColumnsFromSchema(schema) {
12809
+ const geometryColumns = {};
12810
+ for (const field of schema.fields) {
12811
+ const metadata = getGeometryMetadataForField(field);
12812
+ if (metadata) {
12813
+ geometryColumns[field.name] = metadata;
12814
+ }
12815
+ }
12816
+ return geometryColumns;
12817
+ }
12818
+ function getGeometryMetadataForField(field) {
12819
+ let metadata = null;
12820
+ let geoEncoding = field.metadata?.[GEOARROW_COLUMN_METADATA_ENCODING];
12821
+ if (geoEncoding) {
12822
+ geoEncoding = geoEncoding.toLowerCase();
12823
+ if (geoEncoding === "wkb") {
12824
+ geoEncoding = "geoarrow.wkb";
12825
+ }
12826
+ if (geoEncoding === "wkt") {
12827
+ geoEncoding = "geoarrow.wkt";
12828
+ }
12829
+ if (!GEOARROW_ENCODINGS.includes(geoEncoding)) {
12830
+ console.warn(`Invalid GeoArrow encoding: ${geoEncoding}`);
12831
+ } else {
12832
+ metadata = metadata || {};
12833
+ metadata.encoding = geoEncoding;
12834
+ }
12835
+ }
12836
+ const columnMetadata = field.metadata?.[GEOARROW_COLUMN_METADATA_METADATA];
12837
+ if (columnMetadata) {
12838
+ try {
12839
+ metadata = JSON.parse(columnMetadata);
12840
+ } catch (error) {
12841
+ console.warn("Failed to parse GeoArrow metadata", error);
12842
+ }
12843
+ }
12844
+ return metadata || null;
12845
+ }
12846
+
12847
+ // ../../node_modules/@babel/runtime/helpers/esm/typeof.js
12848
+ function _typeof(obj) {
12849
+ "@babel/helpers - typeof";
12850
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
12851
+ return typeof obj2;
12852
+ } : function(obj2) {
12853
+ return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
12854
+ }, _typeof(obj);
12855
+ }
12856
+
12857
+ // ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
12858
+ function _toPrimitive(input, hint) {
12859
+ if (_typeof(input) !== "object" || input === null)
12860
+ return input;
12861
+ var prim = input[Symbol.toPrimitive];
12862
+ if (prim !== void 0) {
12863
+ var res = prim.call(input, hint || "default");
12864
+ if (_typeof(res) !== "object")
12865
+ return res;
12866
+ throw new TypeError("@@toPrimitive must return a primitive value.");
12867
+ }
12868
+ return (hint === "string" ? String : Number)(input);
12869
+ }
12870
+
12871
+ // ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
12872
+ function _toPropertyKey(arg) {
12873
+ var key = _toPrimitive(arg, "string");
12874
+ return _typeof(key) === "symbol" ? key : String(key);
12875
+ }
12876
+
12877
+ // ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
12878
+ function _defineProperty(obj, key, value) {
12879
+ key = _toPropertyKey(key);
12880
+ if (key in obj) {
12881
+ Object.defineProperty(obj, key, {
12882
+ value,
12883
+ enumerable: true,
12884
+ configurable: true,
12885
+ writable: true
12886
+ });
12887
+ } else {
12888
+ obj[key] = value;
12889
+ }
12890
+ return obj;
12891
+ }
12892
+
12893
+ // ../../node_modules/@math.gl/polygon/dist/polygon-utils.js
12894
+ var DimIndex = {
12895
+ x: 0,
12896
+ y: 1,
12897
+ z: 2
12898
+ };
12899
+ function getPolygonSignedArea(points, options = {}) {
12900
+ const {
12901
+ start = 0,
12902
+ end = points.length,
12903
+ plane = "xy"
12904
+ } = options;
12905
+ const dim = options.size || 2;
12906
+ let area2 = 0;
12907
+ const i0 = DimIndex[plane[0]];
12908
+ const i1 = DimIndex[plane[1]];
12909
+ for (let i = start, j = end - dim; i < end; i += dim) {
12910
+ area2 += (points[i + i0] - points[j + i0]) * (points[i + i1] + points[j + i1]);
12911
+ j = i;
12912
+ }
12913
+ return area2 / 2;
12914
+ }
12915
+
12916
+ // ../../node_modules/@math.gl/polygon/dist/earcut.js
12917
+ function earcut(positions, holeIndices, dim = 2, areas, plane = "xy") {
12918
+ const hasHoles = holeIndices && holeIndices.length;
12919
+ const outerLen = hasHoles ? holeIndices[0] * dim : positions.length;
12920
+ let outerNode = linkedList(positions, 0, outerLen, dim, true, areas && areas[0], plane);
12921
+ const triangles = [];
12922
+ if (!outerNode || outerNode.next === outerNode.prev)
12923
+ return triangles;
12924
+ let invSize;
12925
+ let maxX;
12926
+ let maxY;
12927
+ let minX;
12928
+ let minY;
12929
+ let x;
12930
+ let y;
12931
+ if (hasHoles)
12932
+ outerNode = eliminateHoles(positions, holeIndices, outerNode, dim, areas, plane);
12933
+ if (positions.length > 80 * dim) {
12934
+ minX = maxX = positions[0];
12935
+ minY = maxY = positions[1];
12936
+ for (let i = dim; i < outerLen; i += dim) {
12937
+ x = positions[i];
12938
+ y = positions[i + 1];
12939
+ if (x < minX)
12940
+ minX = x;
12941
+ if (y < minY)
12942
+ minY = y;
12676
12943
  if (x > maxX)
12677
12944
  maxX = x;
12678
12945
  if (y > maxY)
@@ -13136,329 +13403,175 @@ return true;`);
13136
13403
  }
13137
13404
  };
13138
13405
 
13139
- // src/tables/convert-arrow-to-geojson-table.ts
13140
- function convertArrowToGeoJSONTable(table) {
13141
- const arrowTable = table.data;
13142
- const schema = serializeArrowSchema(arrowTable.schema);
13143
- const geometryColumns = getGeometryColumnsFromSchema(schema);
13144
- const encoding = geometryColumns.geometry.encoding;
13145
- const features = [];
13146
- for (let row = 0; row < arrowTable.numRows; row++) {
13147
- const arrowGeometry = arrowTable.getChild("geometry")?.get(row);
13148
- const arrowGeometryObject = {
13149
- encoding,
13150
- data: arrowGeometry
13151
- };
13152
- const feature = parseGeometryFromArrow(arrowGeometryObject);
13153
- if (feature) {
13154
- features.push(feature);
13155
- }
13156
- }
13157
- return {
13158
- shape: "geojson-table",
13159
- type: "FeatureCollection",
13160
- features
13161
- };
13162
- }
13163
-
13164
- // src/parsers/parse-geoarrow-sync.ts
13165
- function parseGeoArrowSync(arrayBuffer, options) {
13166
- const table = parseArrowSync(arrayBuffer, {
13167
- shape: "arrow-table"
13168
- });
13169
- switch (options?.shape) {
13170
- case "geojson-table":
13171
- return convertArrowToGeoJSONTable(table);
13406
+ // ../gis/src/lib/binary-features/binary-to-geojson.ts
13407
+ function binaryToGeometry(data, startIndex, endIndex) {
13408
+ switch (data.type) {
13409
+ case "Point":
13410
+ return pointToGeoJson(data, startIndex, endIndex);
13411
+ case "LineString":
13412
+ return lineStringToGeoJson(data, startIndex, endIndex);
13413
+ case "Polygon":
13414
+ return polygonToGeoJson(data, startIndex, endIndex);
13172
13415
  default:
13173
- return table;
13416
+ const unexpectedInput = data;
13417
+ throw new Error(`Unsupported geometry type: ${unexpectedInput?.type}`);
13174
13418
  }
13175
13419
  }
13176
-
13177
- // src/parsers/parse-geoarrow-in-batches.ts
13178
- function parseGeoArrowInBatches(asyncIterator) {
13179
- return parseArrowInBatches(asyncIterator);
13180
- }
13181
-
13182
- // src/geoarrow-loader.ts
13183
- var GeoArrowWorkerLoader = {
13184
- ...ArrowWorkerLoader,
13185
- options: {
13186
- arrow: {
13187
- shape: "arrow-table"
13188
- }
13189
- }
13190
- };
13191
- var GeoArrowLoader = {
13192
- ...ArrowWorkerLoader,
13193
- options: {
13194
- arrow: {
13195
- shape: "arrow-table"
13420
+ function polygonToGeoJson(data, startIndex = -Infinity, endIndex = Infinity) {
13421
+ const {
13422
+ positions
13423
+ } = data;
13424
+ const polygonIndices = data.polygonIndices.value.filter((x) => x >= startIndex && x <= endIndex);
13425
+ const primitivePolygonIndices = data.primitivePolygonIndices.value.filter((x) => x >= startIndex && x <= endIndex);
13426
+ const multi = polygonIndices.length > 2;
13427
+ if (!multi) {
13428
+ const coordinates2 = [];
13429
+ for (let i = 0; i < primitivePolygonIndices.length - 1; i++) {
13430
+ const startRingIndex = primitivePolygonIndices[i];
13431
+ const endRingIndex = primitivePolygonIndices[i + 1];
13432
+ const ringCoordinates = ringToGeoJson(positions, startRingIndex, endRingIndex);
13433
+ coordinates2.push(ringCoordinates);
13196
13434
  }
13197
- },
13198
- parse: async (arraybuffer, options) => parseGeoArrowSync(arraybuffer, options?.arrow),
13199
- parseSync: (arraybuffer, options) => parseGeoArrowSync(arraybuffer, options?.arrow),
13200
- parseInBatches: parseGeoArrowInBatches
13201
- };
13202
-
13203
- // src/schema/convert-arrow-schema.ts
13204
- function serializeArrowSchema(arrowSchema) {
13205
- return {
13206
- fields: arrowSchema.fields.map((arrowField) => serializeArrowField(arrowField)),
13207
- metadata: serializeArrowMetadata(arrowSchema.metadata)
13208
- };
13209
- }
13210
- function deserializeArrowSchema(schema) {
13211
- return new Schema2(schema.fields.map((field) => deserializeArrowField(field)), deserializeArrowMetadata(schema.metadata));
13212
- }
13213
- function serializeArrowMetadata(arrowMetadata) {
13214
- return Object.fromEntries(arrowMetadata);
13215
- }
13216
- function deserializeArrowMetadata(metadata) {
13217
- return metadata ? new Map(Object.entries(metadata)) : /* @__PURE__ */ new Map();
13218
- }
13219
- function serializeArrowField(field) {
13435
+ return {
13436
+ type: "Polygon",
13437
+ coordinates: coordinates2
13438
+ };
13439
+ }
13440
+ const coordinates = [];
13441
+ for (let i = 0; i < polygonIndices.length - 1; i++) {
13442
+ const startPolygonIndex = polygonIndices[i];
13443
+ const endPolygonIndex = polygonIndices[i + 1];
13444
+ const polygonCoordinates = polygonToGeoJson(data, startPolygonIndex, endPolygonIndex).coordinates;
13445
+ coordinates.push(polygonCoordinates);
13446
+ }
13220
13447
  return {
13221
- name: field.name,
13222
- type: serializeArrowType(field.type),
13223
- nullable: field.nullable,
13224
- metadata: serializeArrowMetadata(field.metadata)
13448
+ type: "MultiPolygon",
13449
+ coordinates
13225
13450
  };
13226
13451
  }
13227
- function deserializeArrowField(field) {
13228
- return new Field2(field.name, deserializeArrowType(field.type), field.nullable, deserializeArrowMetadata(field.metadata));
13452
+ function lineStringToGeoJson(data, startIndex = -Infinity, endIndex = Infinity) {
13453
+ const {
13454
+ positions
13455
+ } = data;
13456
+ const pathIndices = data.pathIndices.value.filter((x) => x >= startIndex && x <= endIndex);
13457
+ const multi = pathIndices.length > 2;
13458
+ if (!multi) {
13459
+ const coordinates2 = ringToGeoJson(positions, pathIndices[0], pathIndices[1]);
13460
+ return {
13461
+ type: "LineString",
13462
+ coordinates: coordinates2
13463
+ };
13464
+ }
13465
+ const coordinates = [];
13466
+ for (let i = 0; i < pathIndices.length - 1; i++) {
13467
+ const ringCoordinates = ringToGeoJson(positions, pathIndices[i], pathIndices[i + 1]);
13468
+ coordinates.push(ringCoordinates);
13469
+ }
13470
+ return {
13471
+ type: "MultiLineString",
13472
+ coordinates
13473
+ };
13229
13474
  }
13230
- function serializeArrowType(arrowType) {
13231
- switch (arrowType.constructor) {
13232
- case Null:
13233
- return "null";
13234
- case Binary:
13235
- return "binary";
13236
- case Bool:
13237
- return "bool";
13238
- case Int_:
13239
- const intType = arrowType;
13240
- return `${intType.isSigned ? "u" : ""}int${intType.bitWidth}`;
13241
- case Int8:
13242
- return "int8";
13243
- case Int16:
13244
- return "int16";
13245
- case Int32:
13246
- return "int32";
13247
- case Int64:
13248
- return "int64";
13249
- case Uint8:
13250
- return "uint8";
13251
- case Uint16:
13252
- return "uint16";
13253
- case Uint32:
13254
- return "uint32";
13255
- case Uint64:
13256
- return "uint64";
13257
- case Float:
13258
- const precision = arrowType.precision;
13259
- switch (precision) {
13260
- case Precision.HALF:
13261
- return "float16";
13262
- case Precision.SINGLE:
13263
- return "float32";
13264
- case Precision.DOUBLE:
13265
- return "float64";
13266
- default:
13267
- return "float16";
13268
- }
13269
- case Float16:
13270
- return "float16";
13271
- case Float32:
13272
- return "float32";
13273
- case Float64:
13274
- return "float64";
13275
- case Utf8:
13276
- return "utf8";
13277
- case Decimal:
13278
- const decimal = arrowType;
13279
- return {
13280
- type: "decimal",
13281
- bitWidth: decimal.bitWidth,
13282
- precision: decimal.precision,
13283
- scale: decimal.scale
13284
- };
13285
- case Date_:
13286
- const dateUnit = arrowType.unit;
13287
- return dateUnit === DateUnit.DAY ? "date-day" : "date-millisecond";
13288
- case DateDay:
13289
- return "date-day";
13290
- case DateMillisecond:
13291
- return "date-millisecond";
13292
- case Time_:
13293
- const timeUnit = arrowType.unit;
13294
- switch (timeUnit) {
13295
- case TimeUnit.SECOND:
13296
- return "time-second";
13297
- case TimeUnit.MILLISECOND:
13298
- return "time-millisecond";
13299
- case TimeUnit.MICROSECOND:
13300
- return "time-microsecond";
13301
- case TimeUnit.NANOSECOND:
13302
- return "time-nanosecond";
13303
- default:
13304
- return "time-second";
13305
- }
13306
- case TimeMillisecond:
13307
- return "time-millisecond";
13308
- case TimeSecond:
13309
- return "time-second";
13310
- case TimeMicrosecond:
13311
- return "time-microsecond";
13312
- case TimeNanosecond:
13313
- return "time-nanosecond";
13314
- case Timestamp_:
13315
- const timeStampUnit = arrowType.unit;
13316
- switch (timeStampUnit) {
13317
- case TimeUnit.SECOND:
13318
- return "timestamp-second";
13319
- case TimeUnit.MILLISECOND:
13320
- return "timestamp-millisecond";
13321
- case TimeUnit.MICROSECOND:
13322
- return "timestamp-microsecond";
13323
- case TimeUnit.NANOSECOND:
13324
- return "timestamp-nanosecond";
13325
- default:
13326
- return "timestamp-second";
13327
- }
13328
- case TimestampSecond:
13329
- return "timestamp-second";
13330
- case TimestampMillisecond:
13331
- return "timestamp-millisecond";
13332
- case TimestampMicrosecond:
13333
- return "timestamp-microsecond";
13334
- case TimestampNanosecond:
13335
- return "timestamp-nanosecond";
13336
- case Interval_:
13337
- const intervalUnit = arrowType.unit;
13338
- switch (intervalUnit) {
13339
- case IntervalUnit.DAY_TIME:
13340
- return "interval-daytime";
13341
- case IntervalUnit.YEAR_MONTH:
13342
- return "interval-yearmonth";
13343
- default:
13344
- return "interval-daytime";
13345
- }
13346
- case IntervalDayTime:
13347
- return "interval-daytime";
13348
- case IntervalYearMonth:
13349
- return "interval-yearmonth";
13350
- case Map_:
13351
- const mapType = arrowType;
13352
- return {
13353
- type: "map",
13354
- keysSorted: mapType.keysSorted,
13355
- children: mapType.children.map((arrowField) => serializeArrowField(arrowField))
13356
- };
13357
- case List:
13358
- const listType = arrowType;
13359
- const listField = listType.valueField;
13360
- return {
13361
- type: "list",
13362
- children: [serializeArrowField(listField)]
13363
- };
13364
- case FixedSizeList:
13365
- const fixedSizeList = arrowType;
13366
- return {
13367
- type: "fixed-size-list",
13368
- listSize: fixedSizeList.listSize,
13369
- children: [serializeArrowField(fixedSizeList.children[0])]
13370
- };
13371
- case Struct:
13372
- const structType = arrowType;
13373
- return {
13374
- type: "struct",
13375
- children: structType.children.map((arrowField) => serializeArrowField(arrowField))
13376
- };
13377
- default:
13378
- throw new Error(`arrow type not supported: ${arrowType.constructor.name}`);
13475
+ function pointToGeoJson(data, startIndex, endIndex) {
13476
+ const {
13477
+ positions
13478
+ } = data;
13479
+ const coordinates = ringToGeoJson(positions, startIndex, endIndex);
13480
+ const multi = coordinates.length > 1;
13481
+ if (multi) {
13482
+ return {
13483
+ type: "MultiPoint",
13484
+ coordinates
13485
+ };
13379
13486
  }
13487
+ return {
13488
+ type: "Point",
13489
+ coordinates: coordinates[0]
13490
+ };
13380
13491
  }
13381
- function deserializeArrowType(dataType) {
13382
- if (typeof dataType === "object") {
13383
- switch (dataType.type) {
13384
- case "decimal":
13385
- return new Decimal(dataType.precision, dataType.scale, dataType.bitWidth);
13386
- case "map":
13387
- let children = dataType.children.map((arrowField) => deserializeArrowField(arrowField));
13388
- return new Map_(children, dataType.keysSorted);
13389
- case "list":
13390
- const field = deserializeArrowField(dataType.children[0]);
13391
- return new List(field);
13392
- case "fixed-size-list":
13393
- const child = deserializeArrowField(dataType.children[0]);
13394
- return new FixedSizeList(dataType.listSize, child);
13395
- case "struct":
13396
- children = dataType.children.map((arrowField) => deserializeArrowField(arrowField));
13397
- return new Struct(children);
13398
- default:
13399
- throw new Error("array type not supported");
13492
+ function ringToGeoJson(positions, startIndex, endIndex) {
13493
+ startIndex = startIndex || 0;
13494
+ endIndex = endIndex || positions.value.length / positions.size;
13495
+ const ringCoordinates = [];
13496
+ for (let j = startIndex; j < endIndex; j++) {
13497
+ const coord = Array();
13498
+ for (let k = j * positions.size; k < (j + 1) * positions.size; k++) {
13499
+ coord.push(Number(positions.value[k]));
13400
13500
  }
13501
+ ringCoordinates.push(coord);
13401
13502
  }
13402
- switch (dataType) {
13403
- case "null":
13404
- return new Null();
13405
- case "binary":
13406
- return new Binary();
13407
- case "bool":
13408
- return new Bool();
13409
- case "int8":
13410
- return new Int8();
13411
- case "int16":
13412
- return new Int16();
13413
- case "int32":
13414
- return new Int32();
13415
- case "int64":
13416
- return new Int64();
13417
- case "uint8":
13418
- return new Uint8();
13419
- case "uint16":
13420
- return new Uint16();
13421
- case "uint32":
13422
- return new Uint32();
13423
- case "uint64":
13424
- return new Uint64();
13425
- case "float16":
13426
- return new Float16();
13427
- case "float32":
13428
- return new Float32();
13429
- case "float64":
13430
- return new Float64();
13431
- case "utf8":
13432
- return new Utf8();
13433
- case "date-day":
13434
- return new DateDay();
13435
- case "date-millisecond":
13436
- return new DateMillisecond();
13437
- case "time-second":
13438
- return new TimeSecond();
13439
- case "time-millisecond":
13440
- return new TimeMillisecond();
13441
- case "time-microsecond":
13442
- return new TimeMicrosecond();
13443
- case "time-nanosecond":
13444
- return new TimeNanosecond();
13445
- case "timestamp-second":
13446
- return new TimestampSecond();
13447
- case "timestamp-millisecond":
13448
- return new TimestampMillisecond();
13449
- case "timestamp-microsecond":
13450
- return new TimestampMicrosecond();
13451
- case "timestamp-nanosecond":
13452
- return new TimestampNanosecond();
13453
- case "interval-daytime":
13454
- return new IntervalDayTime();
13455
- case "interval-yearmonth":
13456
- return new IntervalYearMonth();
13503
+ return ringCoordinates;
13504
+ }
13505
+
13506
+ // src/tables/convert-arrow-to-geojson-table.ts
13507
+ function convertArrowToGeoJSONTable(table) {
13508
+ const arrowTable = table.data;
13509
+ const schema = serializeArrowSchema(arrowTable.schema);
13510
+ const geometryColumns = getGeometryColumnsFromSchema(schema);
13511
+ const encoding = geometryColumns.geometry.encoding;
13512
+ const features = [];
13513
+ const propertyColumnNames = arrowTable.schema.fields.map((field) => field.name).filter((name) => !(name in geometryColumns));
13514
+ const propertiesTable = arrowTable.select(propertyColumnNames);
13515
+ const arrowGeometryColumn = arrowTable.getChild("geometry");
13516
+ for (let row = 0; row < arrowTable.numRows; row++) {
13517
+ const arrowGeometry = arrowGeometryColumn?.get(row);
13518
+ const feature = parseGeometryFromArrow(arrowGeometry, encoding);
13519
+ if (feature) {
13520
+ const properties = propertiesTable.get(row)?.toJSON() || {};
13521
+ features.push({
13522
+ type: "Feature",
13523
+ geometry: feature,
13524
+ properties
13525
+ });
13526
+ }
13527
+ }
13528
+ return {
13529
+ shape: "geojson-table",
13530
+ type: "FeatureCollection",
13531
+ schema: table.schema,
13532
+ features
13533
+ };
13534
+ }
13535
+
13536
+ // src/parsers/parse-geoarrow-sync.ts
13537
+ function parseGeoArrowSync(arrayBuffer, options) {
13538
+ const table = parseArrowSync(arrayBuffer, {
13539
+ shape: "arrow-table"
13540
+ });
13541
+ switch (options?.shape) {
13542
+ case "geojson-table":
13543
+ return convertArrowToGeoJSONTable(table);
13457
13544
  default:
13458
- throw new Error("array type not supported");
13545
+ return table;
13459
13546
  }
13460
13547
  }
13461
13548
 
13549
+ // src/parsers/parse-geoarrow-in-batches.ts
13550
+ function parseGeoArrowInBatches(asyncIterator) {
13551
+ return parseArrowInBatches(asyncIterator);
13552
+ }
13553
+
13554
+ // src/geoarrow-loader.ts
13555
+ var GeoArrowWorkerLoader = {
13556
+ ...ArrowWorkerLoader,
13557
+ options: {
13558
+ arrow: {
13559
+ shape: "arrow-table"
13560
+ }
13561
+ }
13562
+ };
13563
+ var GeoArrowLoader = {
13564
+ ...ArrowWorkerLoader,
13565
+ options: {
13566
+ arrow: {
13567
+ shape: "arrow-table"
13568
+ }
13569
+ },
13570
+ parse: async (arraybuffer, options) => parseGeoArrowSync(arraybuffer, options?.arrow),
13571
+ parseSync: (arraybuffer, options) => parseGeoArrowSync(arraybuffer, options?.arrow),
13572
+ parseInBatches: parseGeoArrowInBatches
13573
+ };
13574
+
13462
13575
  // src/geoarrow/get-arrow-bounds.ts
13463
13576
  function updateBoundsFromGeoArrowSamples(flatCoords, nDim, bounds, sampleSize = 100) {
13464
13577
  const numberOfFeatures = flatCoords.length / nDim;
@@ -13484,6 +13597,12 @@ return true;`);
13484
13597
  }
13485
13598
 
13486
13599
  // src/geoarrow/convert-geoarrow-to-binary-geometry.ts
13600
+ var BinaryGeometryType = function(BinaryGeometryType2) {
13601
+ BinaryGeometryType2["points"] = "points";
13602
+ BinaryGeometryType2["lines"] = "lines";
13603
+ BinaryGeometryType2["polygons"] = "polygons";
13604
+ return BinaryGeometryType2;
13605
+ }(BinaryGeometryType || {});
13487
13606
  var BINARY_GEOMETRY_TEMPLATE = {
13488
13607
  globalFeatureIds: {
13489
13608
  value: new Uint32Array(0),
@@ -13517,7 +13636,7 @@ return true;`);
13517
13636
  nDim,
13518
13637
  geomOffset,
13519
13638
  triangles
13520
- } = getBinaryGeometriesFromChunk(chunk, geoEncoding);
13639
+ } = getBinaryGeometriesFromChunk(chunk, geoEncoding, options);
13521
13640
  const globalFeatureIds = new Uint32Array(featureIds.length);
13522
13641
  for (let i = 0; i < featureIds.length; i++) {
13523
13642
  globalFeatureIds[i] = featureIds[i] + globalFeatureIdOffset;
@@ -13582,7 +13701,7 @@ return true;`);
13582
13701
  binaryGeometries,
13583
13702
  bounds,
13584
13703
  featureTypes,
13585
- ...options?.meanCenter ? {
13704
+ ...options?.calculateMeanCenters ? {
13586
13705
  meanCenters: getMeanCentersFromBinaryGeometries(binaryGeometries)
13587
13706
  } : {}
13588
13707
  };
@@ -13592,18 +13711,18 @@ return true;`);
13592
13711
  binaryGeometries.forEach((binaryGeometry) => {
13593
13712
  let binaryGeometryType = null;
13594
13713
  if (binaryGeometry.points && binaryGeometry.points.positions.value.length > 0) {
13595
- binaryGeometryType = "points";
13714
+ binaryGeometryType = BinaryGeometryType.points;
13596
13715
  } else if (binaryGeometry.lines && binaryGeometry.lines.positions.value.length > 0) {
13597
- binaryGeometryType = "lines";
13716
+ binaryGeometryType = BinaryGeometryType.lines;
13598
13717
  } else if (binaryGeometry.polygons && binaryGeometry.polygons.positions.value.length > 0) {
13599
- binaryGeometryType = "polygons";
13718
+ binaryGeometryType = BinaryGeometryType.polygons;
13600
13719
  }
13601
13720
  const binaryContent = binaryGeometryType ? binaryGeometry[binaryGeometryType] : null;
13602
13721
  if (binaryContent && binaryGeometryType !== null) {
13603
13722
  const featureIds = binaryContent.featureIds.value;
13604
13723
  const flatCoordinateArray = binaryContent.positions.value;
13605
13724
  const nDim = binaryContent.positions.size;
13606
- const primitivePolygonIndices = binaryContent.primitivePolygonIndices?.value;
13725
+ const primitivePolygonIndices = binaryContent.type === "Polygon" ? binaryContent.primitivePolygonIndices?.value : void 0;
13607
13726
  const meanCenters = getMeanCentersFromGeometry(featureIds, flatCoordinateArray, nDim, binaryGeometryType, primitivePolygonIndices);
13608
13727
  meanCenters.forEach((center) => {
13609
13728
  globalMeanCenters.push(center);
@@ -13616,19 +13735,23 @@ return true;`);
13616
13735
  const meanCenters = [];
13617
13736
  const vertexCount = flatCoordinateArray.length;
13618
13737
  let vertexIndex = 0;
13738
+ let coordIdx = 0;
13739
+ let primitiveIdx = 0;
13619
13740
  while (vertexIndex < vertexCount) {
13620
13741
  const featureId = featureIds[vertexIndex / nDim];
13621
13742
  const center = [0, 0];
13622
13743
  let vertexCountInFeature = 0;
13623
- while (vertexIndex < vertexCount && featureIds[vertexIndex / nDim] === featureId) {
13624
- if (geometryType === "polygons" && primitivePolygonIndices && primitivePolygonIndices.indexOf(vertexIndex / nDim) >= 0) {
13744
+ while (vertexIndex < vertexCount && featureIds[coordIdx] === featureId) {
13745
+ if (geometryType === BinaryGeometryType.polygons && primitivePolygonIndices?.[primitiveIdx] === coordIdx) {
13625
13746
  vertexIndex += nDim;
13747
+ primitiveIdx++;
13626
13748
  } else {
13627
13749
  center[0] += flatCoordinateArray[vertexIndex];
13628
13750
  center[1] += flatCoordinateArray[vertexIndex + 1];
13629
13751
  vertexIndex += nDim;
13630
13752
  vertexCountInFeature++;
13631
13753
  }
13754
+ coordIdx += 1;
13632
13755
  }
13633
13756
  center[0] /= vertexCountInFeature;
13634
13757
  center[1] /= vertexCountInFeature;
@@ -13636,7 +13759,7 @@ return true;`);
13636
13759
  }
13637
13760
  return meanCenters;
13638
13761
  }
13639
- function getBinaryGeometriesFromChunk(chunk, geoEncoding) {
13762
+ function getBinaryGeometriesFromChunk(chunk, geoEncoding, options) {
13640
13763
  switch (geoEncoding) {
13641
13764
  case "geoarrow.point":
13642
13765
  case "geoarrow.multipoint":
@@ -13646,37 +13769,44 @@ return true;`);
13646
13769
  return getBinaryLinesFromChunk(chunk, geoEncoding);
13647
13770
  case "geoarrow.polygon":
13648
13771
  case "geoarrow.multipolygon":
13649
- return getBinaryPolygonsFromChunk(chunk, geoEncoding);
13772
+ return getBinaryPolygonsFromChunk(chunk, geoEncoding, options);
13650
13773
  default:
13651
13774
  throw Error("invalid geoarrow encoding");
13652
13775
  }
13653
13776
  }
13654
13777
  function getTriangleIndices(polygonIndices, primitivePolygonIndices, flatCoordinateArray, nDim) {
13655
- let primitiveIndex = 0;
13656
- const triangles = [];
13657
- for (let i = 0; i < polygonIndices.length - 1; i++) {
13658
- const startIdx = polygonIndices[i];
13659
- const endIdx = polygonIndices[i + 1];
13660
- const slicedFlatCoords = flatCoordinateArray.subarray(startIdx * nDim, endIdx * nDim);
13661
- const holeIndices = [];
13662
- while (primitivePolygonIndices[primitiveIndex] < endIdx) {
13663
- if (primitivePolygonIndices[primitiveIndex] > startIdx) {
13664
- holeIndices.push(primitivePolygonIndices[primitiveIndex] - startIdx);
13778
+ try {
13779
+ let primitiveIndex = 0;
13780
+ const triangles = [];
13781
+ for (let i = 0; i < polygonIndices.length - 1; i++) {
13782
+ const startIdx = polygonIndices[i];
13783
+ const endIdx = polygonIndices[i + 1];
13784
+ const slicedFlatCoords = flatCoordinateArray.subarray(startIdx * nDim, endIdx * nDim);
13785
+ const holeIndices = [];
13786
+ while (primitivePolygonIndices[primitiveIndex] < endIdx) {
13787
+ if (primitivePolygonIndices[primitiveIndex] > startIdx) {
13788
+ holeIndices.push(primitivePolygonIndices[primitiveIndex] - startIdx);
13789
+ }
13790
+ primitiveIndex++;
13791
+ }
13792
+ const triangleIndices = earcut(slicedFlatCoords, holeIndices.length > 0 ? holeIndices : void 0, nDim);
13793
+ if (triangleIndices.length === 0) {
13794
+ throw Error("can not tesselate invalid polygon");
13795
+ }
13796
+ for (let j = 0; j < triangleIndices.length; j++) {
13797
+ triangles.push(triangleIndices[j] + startIdx);
13665
13798
  }
13666
- primitiveIndex++;
13667
13799
  }
13668
- const triangleIndices = earcut(slicedFlatCoords, holeIndices.length > 0 ? holeIndices : void 0, nDim);
13669
- for (let j = 0; j < triangleIndices.length; j++) {
13670
- triangles.push(triangleIndices[j] + startIdx);
13800
+ const trianglesUint32 = new Uint32Array(triangles.length);
13801
+ for (let i = 0; i < triangles.length; i++) {
13802
+ trianglesUint32[i] = triangles[i];
13671
13803
  }
13804
+ return trianglesUint32;
13805
+ } catch (error) {
13806
+ return null;
13672
13807
  }
13673
- const trianglesUint32 = new Uint32Array(triangles.length);
13674
- for (let i = 0; i < triangles.length; i++) {
13675
- trianglesUint32[i] = triangles[i];
13676
- }
13677
- return trianglesUint32;
13678
13808
  }
13679
- function getBinaryPolygonsFromChunk(chunk, geoEncoding) {
13809
+ function getBinaryPolygonsFromChunk(chunk, geoEncoding, options) {
13680
13810
  const isMultiPolygon = geoEncoding === "geoarrow.multipolygon";
13681
13811
  const polygonData = isMultiPolygon ? chunk.children[0] : chunk;
13682
13812
  const polygonOffset = polygonData.valueOffsets;
@@ -13700,14 +13830,16 @@ return true;`);
13700
13830
  featureIds[j] = i;
13701
13831
  }
13702
13832
  }
13703
- const triangles = getTriangleIndices(geometryIndicies, geomOffset, flatCoordinateArray, nDim);
13833
+ const triangles = options?.triangulate ? getTriangleIndices(geometryIndicies, geomOffset, flatCoordinateArray, nDim) : null;
13704
13834
  return {
13705
13835
  featureIds,
13706
13836
  flatCoordinateArray,
13707
13837
  nDim,
13708
13838
  geomOffset,
13709
13839
  geometryIndicies,
13710
- triangles
13840
+ ...options?.triangulate && triangles ? {
13841
+ triangles
13842
+ } : {}
13711
13843
  };
13712
13844
  }
13713
13845
  function getBinaryLinesFromChunk(chunk, geoEncoding) {
@@ -13780,46 +13912,706 @@ return true;`);
13780
13912
  };
13781
13913
  }
13782
13914
 
13783
- // src/geoarrow/convert-geoarrow-to-geojson.ts
13784
- function parseGeometryFromArrow(rawData) {
13785
- const encoding = rawData.encoding?.toLowerCase();
13786
- const data = rawData.data;
13787
- if (!encoding || !data) {
13915
+ // ../wkt/src/lib/utils/version.ts
13916
+ var VERSION3 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
13917
+
13918
+ // ../wkt/src/lib/parse-wkt.ts
13919
+ var numberRegexp = /[-+]?([0-9]*\.[0-9]+|[0-9]+)([eE][-+]?[0-9]+)?/;
13920
+ var tuples = new RegExp("^" + numberRegexp.source + "(\\s" + numberRegexp.source + "){1,}");
13921
+ var WKT_MAGIC_STRINGS = ["POINT(", "LINESTRING(", "POLYGON(", "MULTIPOINT(", "MULTILINESTRING(", "MULTIPOLYGON(", "GEOMETRYCOLLECTION("];
13922
+ function isWKT(input) {
13923
+ return WKT_MAGIC_STRINGS.some((magicString) => input.startsWith(magicString));
13924
+ }
13925
+ function parseWKT(input, options) {
13926
+ return parseWKTToGeometry(input, options);
13927
+ }
13928
+ function parseWKTToGeometry(input, options) {
13929
+ const parts = input.split(";");
13930
+ let _ = parts.pop();
13931
+ const srid = (parts.shift() || "").split("=").pop();
13932
+ const state = {
13933
+ parts,
13934
+ _,
13935
+ i: 0
13936
+ };
13937
+ const geometry = parseGeometry(state);
13938
+ return options?.wkt?.crs ? addCRS(geometry, srid) : geometry;
13939
+ }
13940
+ function parseGeometry(state) {
13941
+ return parsePoint(state) || parseLineString(state) || parsePolygon(state) || parseMultiPoint(state) || parseMultiLineString(state) || parseMultiPolygon(state) || parseGeometryCollection(state);
13942
+ }
13943
+ function addCRS(obj, srid) {
13944
+ if (obj && srid?.match(/\d+/)) {
13945
+ const crs = {
13946
+ type: "name",
13947
+ properties: {
13948
+ name: "urn:ogc:def:crs:EPSG::" + srid
13949
+ }
13950
+ };
13951
+ obj.crs = crs;
13952
+ }
13953
+ return obj;
13954
+ }
13955
+ function parsePoint(state) {
13956
+ if (!$(/^(POINT(\sz)?)/i, state)) {
13957
+ return null;
13958
+ }
13959
+ white(state);
13960
+ if (!$(/^(\()/, state)) {
13961
+ return null;
13962
+ }
13963
+ const c = coords(state);
13964
+ if (!c) {
13965
+ return null;
13966
+ }
13967
+ white(state);
13968
+ if (!$(/^(\))/, state)) {
13969
+ return null;
13970
+ }
13971
+ return {
13972
+ type: "Point",
13973
+ coordinates: c[0]
13974
+ };
13975
+ }
13976
+ function parseMultiPoint(state) {
13977
+ if (!$(/^(MULTIPOINT)/i, state)) {
13978
+ return null;
13979
+ }
13980
+ white(state);
13981
+ const newCoordsFormat = state._?.substring(state._?.indexOf("(") + 1, state._.length - 1).replace(/\(/g, "").replace(/\)/g, "");
13982
+ state._ = "MULTIPOINT (" + newCoordsFormat + ")";
13983
+ const c = multicoords(state);
13984
+ if (!c) {
13985
+ return null;
13986
+ }
13987
+ white(state);
13988
+ return {
13989
+ type: "MultiPoint",
13990
+ coordinates: c
13991
+ };
13992
+ }
13993
+ function parseLineString(state) {
13994
+ if (!$(/^(LINESTRING(\sz)?)/i, state)) {
13995
+ return null;
13996
+ }
13997
+ white(state);
13998
+ if (!$(/^(\()/, state)) {
13999
+ return null;
14000
+ }
14001
+ const c = coords(state);
14002
+ if (!c) {
14003
+ return null;
14004
+ }
14005
+ if (!$(/^(\))/, state)) {
14006
+ return null;
14007
+ }
14008
+ return {
14009
+ type: "LineString",
14010
+ coordinates: c
14011
+ };
14012
+ }
14013
+ function parseMultiLineString(state) {
14014
+ if (!$(/^(MULTILINESTRING)/i, state))
14015
+ return null;
14016
+ white(state);
14017
+ const c = multicoords(state);
14018
+ if (!c) {
14019
+ return null;
14020
+ }
14021
+ white(state);
14022
+ return {
14023
+ type: "MultiLineString",
14024
+ coordinates: c
14025
+ };
14026
+ }
14027
+ function parsePolygon(state) {
14028
+ if (!$(/^(POLYGON(\sz)?)/i, state)) {
14029
+ return null;
14030
+ }
14031
+ white(state);
14032
+ const c = multicoords(state);
14033
+ if (!c) {
14034
+ return null;
14035
+ }
14036
+ return {
14037
+ type: "Polygon",
14038
+ coordinates: c
14039
+ };
14040
+ }
14041
+ function parseMultiPolygon(state) {
14042
+ if (!$(/^(MULTIPOLYGON)/i, state)) {
14043
+ return null;
14044
+ }
14045
+ white(state);
14046
+ const c = multicoords(state);
14047
+ if (!c) {
14048
+ return null;
14049
+ }
14050
+ return {
14051
+ type: "MultiPolygon",
14052
+ coordinates: c
14053
+ };
14054
+ }
14055
+ function parseGeometryCollection(state) {
14056
+ const geometries = [];
14057
+ let geometry;
14058
+ if (!$(/^(GEOMETRYCOLLECTION)/i, state)) {
14059
+ return null;
14060
+ }
14061
+ white(state);
14062
+ if (!$(/^(\()/, state)) {
14063
+ return null;
14064
+ }
14065
+ while (geometry = parseGeometry(state)) {
14066
+ geometries.push(geometry);
14067
+ white(state);
14068
+ $(/^(,)/, state);
14069
+ white(state);
14070
+ }
14071
+ if (!$(/^(\))/, state)) {
14072
+ return null;
14073
+ }
14074
+ return {
14075
+ type: "GeometryCollection",
14076
+ geometries
14077
+ };
14078
+ }
14079
+ function multicoords(state) {
14080
+ white(state);
14081
+ let depth = 0;
14082
+ const rings = [];
14083
+ const stack = [rings];
14084
+ let pointer = rings;
14085
+ let elem;
14086
+ while (elem = $(/^(\()/, state) || $(/^(\))/, state) || $(/^(,)/, state) || $(tuples, state)) {
14087
+ if (elem === "(") {
14088
+ stack.push(pointer);
14089
+ pointer = [];
14090
+ stack[stack.length - 1].push(pointer);
14091
+ depth++;
14092
+ } else if (elem === ")") {
14093
+ if (pointer.length === 0)
14094
+ return null;
14095
+ pointer = stack.pop();
14096
+ if (!pointer)
14097
+ return null;
14098
+ depth--;
14099
+ if (depth === 0)
14100
+ break;
14101
+ } else if (elem === ",") {
14102
+ pointer = [];
14103
+ stack[stack.length - 1].push(pointer);
14104
+ } else if (!elem.split(/\s/g).some(isNaN)) {
14105
+ Array.prototype.push.apply(pointer, elem.split(/\s/g).map(parseFloat));
14106
+ } else {
14107
+ return null;
14108
+ }
14109
+ white(state);
14110
+ }
14111
+ if (depth !== 0)
14112
+ return null;
14113
+ return rings;
14114
+ }
14115
+ function coords(state) {
14116
+ const list = [];
14117
+ let item;
14118
+ let pt;
14119
+ while (pt = $(tuples, state) || $(/^(,)/, state)) {
14120
+ if (pt === ",") {
14121
+ list.push(item);
14122
+ item = [];
14123
+ } else if (!pt.split(/\s/g).some(isNaN)) {
14124
+ if (!item)
14125
+ item = [];
14126
+ Array.prototype.push.apply(item, pt.split(/\s/g).map(parseFloat));
14127
+ }
14128
+ white(state);
14129
+ }
14130
+ if (item)
14131
+ list.push(item);
14132
+ else
14133
+ return null;
14134
+ return list.length ? list : null;
14135
+ }
14136
+ function $(regexp, state) {
14137
+ const match = state._?.substring(state.i).match(regexp);
14138
+ if (!match)
14139
+ return null;
14140
+ else {
14141
+ state.i += match[0].length;
14142
+ return match[0];
14143
+ }
14144
+ }
14145
+ function white(state) {
14146
+ $(/^\s*/, state);
14147
+ }
14148
+
14149
+ // ../wkt/src/wkt-loader.ts
14150
+ var WKTWorkerLoader = {
14151
+ name: "WKT (Well-Known Text)",
14152
+ id: "wkt",
14153
+ module: "wkt",
14154
+ version: VERSION3,
14155
+ worker: true,
14156
+ extensions: ["wkt"],
14157
+ mimeTypes: ["text/plain"],
14158
+ category: "geometry",
14159
+ text: true,
14160
+ tests: WKT_MAGIC_STRINGS,
14161
+ testText: isWKT,
14162
+ options: {
14163
+ wkt: {
14164
+ shape: "geojson-geometry",
14165
+ crs: true
14166
+ }
14167
+ }
14168
+ };
14169
+ var WKTLoader = {
14170
+ ...WKTWorkerLoader,
14171
+ parse: async (arrayBuffer, options) => parseWKT(new TextDecoder().decode(arrayBuffer), options),
14172
+ parseTextSync: parseWKT
14173
+ };
14174
+
14175
+ // ../wkt/src/lib/parse-wkb-header.ts
14176
+ var EWKB_FLAG_Z = 2147483648;
14177
+ var EWKB_FLAG_M = 1073741824;
14178
+ var EWKB_FLAG_SRID = 536870912;
14179
+ var MAX_SRID = 1e4;
14180
+ var WKBGeometryType = function(WKBGeometryType2) {
14181
+ WKBGeometryType2[WKBGeometryType2["Point"] = 1] = "Point";
14182
+ WKBGeometryType2[WKBGeometryType2["LineString"] = 2] = "LineString";
14183
+ WKBGeometryType2[WKBGeometryType2["Polygon"] = 3] = "Polygon";
14184
+ WKBGeometryType2[WKBGeometryType2["MultiPoint"] = 4] = "MultiPoint";
14185
+ WKBGeometryType2[WKBGeometryType2["MultiLineString"] = 5] = "MultiLineString";
14186
+ WKBGeometryType2[WKBGeometryType2["MultiPolygon"] = 6] = "MultiPolygon";
14187
+ WKBGeometryType2[WKBGeometryType2["GeometryCollection"] = 7] = "GeometryCollection";
14188
+ return WKBGeometryType2;
14189
+ }({});
14190
+ function isWKB(arrayBuffer) {
14191
+ const dataView = new DataView(arrayBuffer);
14192
+ let byteOffset = 0;
14193
+ const endianness = dataView.getUint8(byteOffset);
14194
+ byteOffset += 1;
14195
+ if (endianness > 1) {
14196
+ return false;
14197
+ }
14198
+ const littleEndian = endianness === 1;
14199
+ const geometry = dataView.getUint32(byteOffset, littleEndian);
14200
+ byteOffset += 4;
14201
+ const geometryType = geometry & 7;
14202
+ if (geometryType === 0 || geometryType > 7) {
14203
+ return false;
14204
+ }
14205
+ const geometryFlags = geometry - geometryType;
14206
+ if (geometryFlags === 0 || geometryFlags === 1e3 || geometryFlags === 2e3 || geometryFlags === 3e3) {
14207
+ return true;
14208
+ }
14209
+ if ((geometryFlags & ~(EWKB_FLAG_Z | EWKB_FLAG_M | EWKB_FLAG_SRID)) !== 0) {
14210
+ return false;
14211
+ }
14212
+ if (geometryFlags & EWKB_FLAG_SRID) {
14213
+ const srid = dataView.getUint32(byteOffset, littleEndian);
14214
+ byteOffset += 4;
14215
+ if (srid > MAX_SRID) {
14216
+ return false;
14217
+ }
14218
+ }
14219
+ return true;
14220
+ }
14221
+ function parseWKBHeader(dataView, target) {
14222
+ const wkbHeader = Object.assign(target || {}, {
14223
+ type: "wkb",
14224
+ geometryType: 1,
14225
+ dimensions: 2,
14226
+ coordinates: "xy",
14227
+ littleEndian: true,
14228
+ byteOffset: 0
14229
+ });
14230
+ wkbHeader.littleEndian = dataView.getUint8(wkbHeader.byteOffset) === 1;
14231
+ wkbHeader.byteOffset++;
14232
+ const geometryCode = dataView.getUint32(wkbHeader.byteOffset, wkbHeader.littleEndian);
14233
+ wkbHeader.byteOffset += 4;
14234
+ wkbHeader.geometryType = geometryCode & 7;
14235
+ const isoType = (geometryCode - wkbHeader.geometryType) / 1e3;
14236
+ switch (isoType) {
14237
+ case 0:
14238
+ break;
14239
+ case 1:
14240
+ wkbHeader.type = "iso-wkb";
14241
+ wkbHeader.dimensions = 3;
14242
+ wkbHeader.coordinates = "xyz";
14243
+ break;
14244
+ case 2:
14245
+ wkbHeader.type = "iso-wkb";
14246
+ wkbHeader.dimensions = 3;
14247
+ wkbHeader.coordinates = "xym";
14248
+ break;
14249
+ case 3:
14250
+ wkbHeader.type = "iso-wkb";
14251
+ wkbHeader.dimensions = 4;
14252
+ wkbHeader.coordinates = "xyzm";
14253
+ break;
14254
+ default:
14255
+ throw new Error(`WKB: Unsupported iso-wkb type: ${isoType}`);
14256
+ }
14257
+ const ewkbZ = geometryCode & EWKB_FLAG_Z;
14258
+ const ewkbM = geometryCode & EWKB_FLAG_M;
14259
+ const ewkbSRID = geometryCode & EWKB_FLAG_SRID;
14260
+ if (ewkbZ && ewkbM) {
14261
+ wkbHeader.type = "ewkb";
14262
+ wkbHeader.dimensions = 4;
14263
+ wkbHeader.coordinates = "xyzm";
14264
+ } else if (ewkbZ) {
14265
+ wkbHeader.type = "ewkb";
14266
+ wkbHeader.dimensions = 3;
14267
+ wkbHeader.coordinates = "xyz";
14268
+ } else if (ewkbM) {
14269
+ wkbHeader.type = "ewkb";
14270
+ wkbHeader.dimensions = 3;
14271
+ wkbHeader.coordinates = "xym";
14272
+ }
14273
+ if (ewkbSRID) {
14274
+ wkbHeader.type = "ewkb";
14275
+ wkbHeader.srid = dataView.getUint32(wkbHeader.byteOffset, wkbHeader.littleEndian);
14276
+ wkbHeader.byteOffset += 4;
14277
+ }
14278
+ return wkbHeader;
14279
+ }
14280
+
14281
+ // ../wkt/src/lib/parse-wkb.ts
14282
+ function parseWKB(arrayBuffer, options) {
14283
+ const binaryGeometry = parseWKBToBinary(arrayBuffer, options);
14284
+ const shape = options?.wkb?.shape || "binary-geometry";
14285
+ switch (shape) {
14286
+ case "binary-geometry":
14287
+ return binaryGeometry;
14288
+ case "geojson-geometry":
14289
+ return binaryToGeometry(binaryGeometry);
14290
+ case "geometry":
14291
+ console.error('WKBLoader: "geometry" shape is deprecated, use "binary-geometry" instead');
14292
+ return binaryToGeometry(binaryGeometry);
14293
+ default:
14294
+ throw new Error(shape);
14295
+ }
14296
+ }
14297
+ function parseWKBToBinary(arrayBuffer, options) {
14298
+ const dataView = new DataView(arrayBuffer);
14299
+ const wkbHeader = parseWKBHeader(dataView);
14300
+ const {
14301
+ geometryType,
14302
+ dimensions,
14303
+ littleEndian
14304
+ } = wkbHeader;
14305
+ const offset = wkbHeader.byteOffset;
14306
+ switch (geometryType) {
14307
+ case WKBGeometryType.Point:
14308
+ const point = parsePoint2(dataView, offset, dimensions, littleEndian);
14309
+ return point.geometry;
14310
+ case WKBGeometryType.LineString:
14311
+ const line = parseLineString2(dataView, offset, dimensions, littleEndian);
14312
+ return line.geometry;
14313
+ case WKBGeometryType.Polygon:
14314
+ const polygon = parsePolygon2(dataView, offset, dimensions, littleEndian);
14315
+ return polygon.geometry;
14316
+ case WKBGeometryType.MultiPoint:
14317
+ const multiPoint = parseMultiPoint2(dataView, offset, dimensions, littleEndian);
14318
+ multiPoint.type = "Point";
14319
+ return multiPoint;
14320
+ case WKBGeometryType.MultiLineString:
14321
+ const multiLine = parseMultiLineString2(dataView, offset, dimensions, littleEndian);
14322
+ multiLine.type = "LineString";
14323
+ return multiLine;
14324
+ case WKBGeometryType.MultiPolygon:
14325
+ const multiPolygon = parseMultiPolygon2(dataView, offset, dimensions, littleEndian);
14326
+ multiPolygon.type = "Polygon";
14327
+ return multiPolygon;
14328
+ default:
14329
+ throw new Error(`WKB: Unsupported geometry type: ${geometryType}`);
14330
+ }
14331
+ }
14332
+ function parsePoint2(dataView, offset, dimension, littleEndian) {
14333
+ const positions = new Float64Array(dimension);
14334
+ for (let i = 0; i < dimension; i++) {
14335
+ positions[i] = dataView.getFloat64(offset, littleEndian);
14336
+ offset += 8;
14337
+ }
14338
+ return {
14339
+ geometry: {
14340
+ type: "Point",
14341
+ positions: {
14342
+ value: positions,
14343
+ size: dimension
14344
+ }
14345
+ },
14346
+ offset
14347
+ };
14348
+ }
14349
+ function parseLineString2(dataView, offset, dimension, littleEndian) {
14350
+ const nPoints = dataView.getUint32(offset, littleEndian);
14351
+ offset += 4;
14352
+ const positions = new Float64Array(nPoints * dimension);
14353
+ for (let i = 0; i < nPoints * dimension; i++) {
14354
+ positions[i] = dataView.getFloat64(offset, littleEndian);
14355
+ offset += 8;
14356
+ }
14357
+ const pathIndices = [0];
14358
+ if (nPoints > 0) {
14359
+ pathIndices.push(nPoints);
14360
+ }
14361
+ return {
14362
+ geometry: {
14363
+ type: "LineString",
14364
+ positions: {
14365
+ value: positions,
14366
+ size: dimension
14367
+ },
14368
+ pathIndices: {
14369
+ value: new Uint16Array(pathIndices),
14370
+ size: 1
14371
+ }
14372
+ },
14373
+ offset
14374
+ };
14375
+ }
14376
+ var cumulativeSum = (sum2) => (value) => sum2 += value;
14377
+ function parsePolygon2(dataView, offset, dimension, littleEndian) {
14378
+ const nRings = dataView.getUint32(offset, littleEndian);
14379
+ offset += 4;
14380
+ const rings = [];
14381
+ for (let i = 0; i < nRings; i++) {
14382
+ const parsed = parseLineString2(dataView, offset, dimension, littleEndian);
14383
+ const {
14384
+ positions
14385
+ } = parsed.geometry;
14386
+ offset = parsed.offset;
14387
+ rings.push(positions.value);
14388
+ }
14389
+ const concatenatedPositions = new Float64Array(concatTypedArrays(rings).buffer);
14390
+ const polygonIndices = [0];
14391
+ if (concatenatedPositions.length > 0) {
14392
+ polygonIndices.push(concatenatedPositions.length / dimension);
14393
+ }
14394
+ const primitivePolygonIndices = rings.map((l) => l.length / dimension).map(cumulativeSum(0));
14395
+ primitivePolygonIndices.unshift(0);
14396
+ return {
14397
+ geometry: {
14398
+ type: "Polygon",
14399
+ positions: {
14400
+ value: concatenatedPositions,
14401
+ size: dimension
14402
+ },
14403
+ polygonIndices: {
14404
+ value: new Uint16Array(polygonIndices),
14405
+ size: 1
14406
+ },
14407
+ primitivePolygonIndices: {
14408
+ value: new Uint16Array(primitivePolygonIndices),
14409
+ size: 1
14410
+ }
14411
+ },
14412
+ offset
14413
+ };
14414
+ }
14415
+ function parseMultiPoint2(dataView, offset, dimension, littleEndian) {
14416
+ const nPoints = dataView.getUint32(offset, littleEndian);
14417
+ offset += 4;
14418
+ const binaryPointGeometries = [];
14419
+ for (let i = 0; i < nPoints; i++) {
14420
+ const littleEndianPoint = dataView.getUint8(offset) === 1;
14421
+ offset++;
14422
+ if (dataView.getUint32(offset, littleEndianPoint) % 1e3 !== 1) {
14423
+ throw new Error("WKB: Inner geometries of MultiPoint not of type Point");
14424
+ }
14425
+ offset += 4;
14426
+ const parsed = parsePoint2(dataView, offset, dimension, littleEndianPoint);
14427
+ offset = parsed.offset;
14428
+ binaryPointGeometries.push(parsed.geometry);
14429
+ }
14430
+ return concatenateBinaryPointGeometries(binaryPointGeometries, dimension);
14431
+ }
14432
+ function parseMultiLineString2(dataView, offset, dimension, littleEndian) {
14433
+ const nLines = dataView.getUint32(offset, littleEndian);
14434
+ offset += 4;
14435
+ const binaryLineGeometries = [];
14436
+ for (let i = 0; i < nLines; i++) {
14437
+ const littleEndianLine = dataView.getUint8(offset) === 1;
14438
+ offset++;
14439
+ if (dataView.getUint32(offset, littleEndianLine) % 1e3 !== 2) {
14440
+ throw new Error("WKB: Inner geometries of MultiLineString not of type LineString");
14441
+ }
14442
+ offset += 4;
14443
+ const parsed = parseLineString2(dataView, offset, dimension, littleEndianLine);
14444
+ offset = parsed.offset;
14445
+ binaryLineGeometries.push(parsed.geometry);
14446
+ }
14447
+ return concatenateBinaryLineGeometries(binaryLineGeometries, dimension);
14448
+ }
14449
+ function parseMultiPolygon2(dataView, offset, dimension, littleEndian) {
14450
+ const nPolygons = dataView.getUint32(offset, littleEndian);
14451
+ offset += 4;
14452
+ const binaryPolygonGeometries = [];
14453
+ for (let i = 0; i < nPolygons; i++) {
14454
+ const littleEndianPolygon = dataView.getUint8(offset) === 1;
14455
+ offset++;
14456
+ if (dataView.getUint32(offset, littleEndianPolygon) % 1e3 !== 3) {
14457
+ throw new Error("WKB: Inner geometries of MultiPolygon not of type Polygon");
14458
+ }
14459
+ offset += 4;
14460
+ const parsed = parsePolygon2(dataView, offset, dimension, littleEndianPolygon);
14461
+ offset = parsed.offset;
14462
+ binaryPolygonGeometries.push(parsed.geometry);
14463
+ }
14464
+ return concatenateBinaryPolygonGeometries(binaryPolygonGeometries, dimension);
14465
+ }
14466
+ function concatenateBinaryPointGeometries(binaryPointGeometries, dimension) {
14467
+ const positions = binaryPointGeometries.map((geometry) => geometry.positions.value);
14468
+ const concatenatedPositions = new Float64Array(concatTypedArrays(positions).buffer);
14469
+ return {
14470
+ type: "Point",
14471
+ positions: {
14472
+ value: concatenatedPositions,
14473
+ size: dimension
14474
+ }
14475
+ };
14476
+ }
14477
+ function concatenateBinaryLineGeometries(binaryLineGeometries, dimension) {
14478
+ const lines = binaryLineGeometries.map((geometry) => geometry.positions.value);
14479
+ const concatenatedPositions = new Float64Array(concatTypedArrays(lines).buffer);
14480
+ const pathIndices = lines.map((line) => line.length / dimension).map(cumulativeSum(0));
14481
+ pathIndices.unshift(0);
14482
+ return {
14483
+ type: "LineString",
14484
+ positions: {
14485
+ value: concatenatedPositions,
14486
+ size: dimension
14487
+ },
14488
+ pathIndices: {
14489
+ value: new Uint16Array(pathIndices),
14490
+ size: 1
14491
+ }
14492
+ };
14493
+ }
14494
+ function concatenateBinaryPolygonGeometries(binaryPolygonGeometries, dimension) {
14495
+ const polygons = [];
14496
+ const primitivePolygons = [];
14497
+ for (const binaryPolygon of binaryPolygonGeometries) {
14498
+ const {
14499
+ positions,
14500
+ primitivePolygonIndices: primitivePolygonIndices2
14501
+ } = binaryPolygon;
14502
+ polygons.push(positions.value);
14503
+ primitivePolygons.push(primitivePolygonIndices2.value);
14504
+ }
14505
+ const concatenatedPositions = new Float64Array(concatTypedArrays(polygons).buffer);
14506
+ const polygonIndices = polygons.map((p) => p.length / dimension).map(cumulativeSum(0));
14507
+ polygonIndices.unshift(0);
14508
+ const primitivePolygonIndices = [0];
14509
+ for (const primitivePolygon of primitivePolygons) {
14510
+ primitivePolygonIndices.push(...primitivePolygon.filter((x) => x > 0).map((x) => x + primitivePolygonIndices[primitivePolygonIndices.length - 1]));
14511
+ }
14512
+ return {
14513
+ type: "Polygon",
14514
+ positions: {
14515
+ value: concatenatedPositions,
14516
+ size: dimension
14517
+ },
14518
+ polygonIndices: {
14519
+ value: new Uint16Array(polygonIndices),
14520
+ size: 1
14521
+ },
14522
+ primitivePolygonIndices: {
14523
+ value: new Uint16Array(primitivePolygonIndices),
14524
+ size: 1
14525
+ }
14526
+ };
14527
+ }
14528
+ function concatTypedArrays(arrays) {
14529
+ let byteLength = 0;
14530
+ for (let i = 0; i < arrays.length; ++i) {
14531
+ byteLength += arrays[i].byteLength;
14532
+ }
14533
+ const buffer = new Uint8Array(byteLength);
14534
+ let byteOffset = 0;
14535
+ for (let i = 0; i < arrays.length; ++i) {
14536
+ const data = new Uint8Array(arrays[i].buffer);
14537
+ byteLength = data.length;
14538
+ for (let j = 0; j < byteLength; ++j) {
14539
+ buffer[byteOffset++] = data[j];
14540
+ }
14541
+ }
14542
+ return buffer;
14543
+ }
14544
+
14545
+ // ../wkt/src/wkb-loader.ts
14546
+ var WKBWorkerLoader = {
14547
+ name: "WKB",
14548
+ id: "wkb",
14549
+ module: "wkt",
14550
+ version: VERSION3,
14551
+ worker: true,
14552
+ category: "geometry",
14553
+ extensions: ["wkb"],
14554
+ mimeTypes: [],
14555
+ tests: [isWKB],
14556
+ options: {
14557
+ wkb: {
14558
+ shape: "binary-geometry"
14559
+ }
14560
+ }
14561
+ };
14562
+ var WKBLoader = {
14563
+ ...WKBWorkerLoader,
14564
+ parse: async (arrayBuffer) => parseWKB(arrayBuffer),
14565
+ parseSync: parseWKB
14566
+ };
14567
+
14568
+ // src/geoarrow/convert-geoarrow-to-geojson-geometry.ts
14569
+ function parseGeometryFromArrow(arrowCellValue, encoding) {
14570
+ encoding = encoding?.toLowerCase();
14571
+ if (!encoding || !arrowCellValue) {
13788
14572
  return null;
13789
14573
  }
13790
14574
  let geometry;
13791
14575
  switch (encoding) {
13792
14576
  case "geoarrow.multipolygon":
13793
- geometry = arrowMultiPolygonToFeature(data);
14577
+ geometry = arrowMultiPolygonToFeature(arrowCellValue);
13794
14578
  break;
13795
14579
  case "geoarrow.polygon":
13796
- geometry = arrowPolygonToFeature(data);
14580
+ geometry = arrowPolygonToFeature(arrowCellValue);
13797
14581
  break;
13798
14582
  case "geoarrow.multipoint":
13799
- geometry = arrowMultiPointToFeature(data);
14583
+ geometry = arrowMultiPointToFeature(arrowCellValue);
13800
14584
  break;
13801
14585
  case "geoarrow.point":
13802
- geometry = arrowPointToFeature(data);
14586
+ geometry = arrowPointToFeature(arrowCellValue);
13803
14587
  break;
13804
14588
  case "geoarrow.multilinestring":
13805
- geometry = arrowMultiLineStringToFeature(data);
14589
+ geometry = arrowMultiLineStringToFeature(arrowCellValue);
13806
14590
  break;
13807
14591
  case "geoarrow.linestring":
13808
- geometry = arrowLineStringToFeature(data);
14592
+ geometry = arrowLineStringToFeature(arrowCellValue);
13809
14593
  break;
13810
14594
  case "geoarrow.wkb":
13811
- throw Error(`GeoArrow encoding not supported ${encoding}`);
14595
+ geometry = arrowWKBToFeature(arrowCellValue);
14596
+ break;
13812
14597
  case "geoarrow.wkt":
13813
- throw Error(`GeoArrow encoding not supported ${encoding}`);
14598
+ geometry = arrowWKTToFeature(arrowCellValue);
14599
+ break;
13814
14600
  default: {
13815
14601
  throw Error(`GeoArrow encoding not supported ${encoding}`);
13816
14602
  }
13817
14603
  }
13818
- return {
13819
- type: "Feature",
13820
- geometry,
13821
- properties: {}
13822
- };
14604
+ return geometry;
14605
+ }
14606
+ function arrowWKBToFeature(arrowCellValue) {
14607
+ const arrayBuffer = arrowCellValue.buffer.slice(arrowCellValue.byteOffset, arrowCellValue.byteOffset + arrowCellValue.byteLength);
14608
+ const binaryGeometry = WKBLoader.parseSync?.(arrayBuffer);
14609
+ const geometry = binaryToGeometry(binaryGeometry);
14610
+ return geometry;
14611
+ }
14612
+ function arrowWKTToFeature(arrowCellValue) {
14613
+ const string = arrowCellValue;
14614
+ return WKTLoader.parseTextSync?.(string);
13823
14615
  }
13824
14616
  function arrowMultiPolygonToFeature(arrowMultiPolygon) {
13825
14617
  const multiPolygon = [];
@@ -13851,8 +14643,8 @@ return true;`);
13851
14643
  const ring = [];
13852
14644
  for (let j = 0; arrowRing && j < arrowRing.length; j++) {
13853
14645
  const arrowCoord = arrowRing.get(j);
13854
- const coords = Array.from(arrowCoord);
13855
- ring.push(coords);
14646
+ const coords2 = Array.from(arrowCoord);
14647
+ ring.push(coords2);
13856
14648
  }
13857
14649
  polygon.push(ring);
13858
14650
  }
@@ -13871,19 +14663,17 @@ return true;`);
13871
14663
  multiPoint.push(coord);
13872
14664
  }
13873
14665
  }
13874
- const geometry = {
14666
+ return {
13875
14667
  type: "MultiPoint",
13876
14668
  coordinates: multiPoint
13877
14669
  };
13878
- return geometry;
13879
14670
  }
13880
14671
  function arrowPointToFeature(arrowPoint) {
13881
14672
  const point = Array.from(arrowPoint);
13882
- const geometry = {
14673
+ return {
13883
14674
  type: "Point",
13884
14675
  coordinates: point
13885
14676
  };
13886
- return geometry;
13887
14677
  }
13888
14678
  function arrowMultiLineStringToFeature(arrowMultiLineString) {
13889
14679
  const multiLineString = [];
@@ -13893,32 +14683,30 @@ return true;`);
13893
14683
  for (let j = 0; arrowLineString && j < arrowLineString.length; j++) {
13894
14684
  const arrowCoord = arrowLineString.get(j);
13895
14685
  if (arrowCoord) {
13896
- const coords = Array.from(arrowCoord);
13897
- lineString.push(coords);
14686
+ const coords2 = Array.from(arrowCoord);
14687
+ lineString.push(coords2);
13898
14688
  }
13899
14689
  }
13900
14690
  multiLineString.push(lineString);
13901
14691
  }
13902
- const geometry = {
14692
+ return {
13903
14693
  type: "MultiLineString",
13904
14694
  coordinates: multiLineString
13905
14695
  };
13906
- return geometry;
13907
14696
  }
13908
14697
  function arrowLineStringToFeature(arrowLineString) {
13909
14698
  const lineString = [];
13910
14699
  for (let i = 0; arrowLineString && i < arrowLineString.length; i++) {
13911
14700
  const arrowCoord = arrowLineString.get(i);
13912
14701
  if (arrowCoord) {
13913
- const coords = Array.from(arrowCoord);
13914
- lineString.push(coords);
14702
+ const coords2 = Array.from(arrowCoord);
14703
+ lineString.push(coords2);
13915
14704
  }
13916
14705
  }
13917
- const geometry = {
14706
+ return {
13918
14707
  type: "LineString",
13919
14708
  coordinates: lineString
13920
14709
  };
13921
- return geometry;
13922
14710
  }
13923
14711
 
13924
14712
  // ../worker-utils/src/lib/env-utils/version.ts
@@ -13935,7 +14723,7 @@ return true;`);
13935
14723
  }
13936
14724
  return globalThis._loadersgl_.version;
13937
14725
  }
13938
- var VERSION3 = getVersion();
14726
+ var VERSION4 = getVersion();
13939
14727
 
13940
14728
  // ../worker-utils/src/lib/env-utils/assert.ts
13941
14729
  function assert(condition, message) {
@@ -14377,7 +15165,7 @@ return true;`);
14377
15165
 
14378
15166
  // ../worker-utils/src/lib/worker-api/get-worker-url.ts
14379
15167
  function getWorkerName(worker) {
14380
- const warning = worker.version !== VERSION3 ? ` (worker-utils@${VERSION3})` : "";
15168
+ const warning = worker.version !== VERSION4 ? ` (worker-utils@${VERSION4})` : "";
14381
15169
  return `${worker.name}@${worker.version}${warning}`;
14382
15170
  }
14383
15171
  function getWorkerURL(worker, options = {}) {
@@ -14472,12 +15260,12 @@ return true;`);
14472
15260
  }
14473
15261
 
14474
15262
  // src/triangulate-on-worker.ts
14475
- var VERSION4 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
15263
+ var VERSION5 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
14476
15264
  var TriangulationWorker = {
14477
15265
  id: "triangulation",
14478
15266
  name: "Triangulate",
14479
15267
  module: "arrow",
14480
- version: VERSION4,
15268
+ version: VERSION5,
14481
15269
  options: {}
14482
15270
  };
14483
15271
  function triangulateOnWorker(data, options = {}) {