@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/index.cjs CHANGED
@@ -50,7 +50,7 @@ __export(src_exports, {
50
50
  parseGeometryFromArrow: () => parseGeometryFromArrow2,
51
51
  serializeArrowField: () => serializeArrowField,
52
52
  serializeArrowMetadata: () => serializeArrowMetadata,
53
- serializeArrowSchema: () => serializeArrowSchema2,
53
+ serializeArrowSchema: () => serializeArrowSchema,
54
54
  serializeArrowType: () => serializeArrowType,
55
55
  triangulateOnWorker: () => triangulateOnWorker,
56
56
  updateBoundsFromGeoArrowSamples: () => updateBoundsFromGeoArrowSamples
@@ -152,7 +152,7 @@ var VECTOR_TYPES = /* @__PURE__ */ ((VECTOR_TYPES2) => {
152
152
 
153
153
  // src/parsers/parse-arrow-sync.ts
154
154
  var import_schema2 = require("@loaders.gl/schema");
155
- var arrow3 = __toESM(require("apache-arrow"), 1);
155
+ var arrow4 = __toESM(require("apache-arrow"), 1);
156
156
 
157
157
  // src/tables/convert-arrow-to-columnar-table.ts
158
158
  function convertArrowToColumnarTable(table) {
@@ -165,199 +165,21 @@ function convertArrowToColumnarTable(table) {
165
165
  }
166
166
  return {
167
167
  shape: "columnar-table",
168
+ schema: table.schema,
168
169
  data: columnarTable
169
170
  };
170
171
  }
171
172
 
172
- // src/parsers/parse-arrow-sync.ts
173
- function parseArrowSync(arrayBuffer, options) {
174
- const apacheArrowTable = arrow3.tableFromIPC([new Uint8Array(arrayBuffer)]);
175
- const arrowTable = { shape: "arrow-table", data: apacheArrowTable };
176
- const shape = (options == null ? void 0 : options.shape) || "arrow-table";
177
- switch (shape) {
178
- case "arrow-table":
179
- return arrowTable;
180
- case "columnar-table":
181
- return convertArrowToColumnarTable(arrowTable);
182
- case "object-row-table":
183
- let columnarTable = convertArrowToColumnarTable(arrowTable);
184
- return (0, import_schema2.convertTable)(columnarTable, "object-row-table");
185
- case "array-row-table":
186
- columnarTable = convertArrowToColumnarTable(arrowTable);
187
- return (0, import_schema2.convertTable)(columnarTable, "array-row-table");
188
- default:
189
- throw new Error(shape);
190
- }
191
- }
192
-
193
- // src/parsers/parse-arrow-in-batches.ts
194
- var arrow4 = __toESM(require("apache-arrow"), 1);
195
- function parseArrowInBatches(asyncIterator) {
196
- async function* makeArrowAsyncIterator() {
197
- const readers = arrow4.RecordBatchReader.readAll(asyncIterator);
198
- for await (const reader of readers) {
199
- for await (const recordBatch of reader) {
200
- const arrowTabledBatch = {
201
- shape: "arrow-table",
202
- batchType: "data",
203
- data: new arrow4.Table([recordBatch]),
204
- length: recordBatch.data.length
205
- };
206
- yield arrowTabledBatch;
207
- }
208
- break;
209
- }
210
- }
211
- return makeArrowAsyncIterator();
212
- }
213
-
214
- // src/arrow-loader.ts
215
- var VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
216
- var ArrowWorkerLoader = {
217
- name: "Apache Arrow",
218
- id: "arrow",
219
- module: "arrow",
220
- version: VERSION,
221
- // worker: true,
222
- category: "table",
223
- extensions: ["arrow", "feather"],
224
- mimeTypes: [
225
- "application/vnd.apache.arrow.file",
226
- "application/vnd.apache.arrow.stream",
227
- "application/octet-stream"
228
- ],
229
- binary: true,
230
- tests: ["ARROW"],
231
- options: {
232
- arrow: {
233
- shape: "columnar-table"
234
- }
235
- }
236
- };
237
- var ArrowLoader = {
238
- ...ArrowWorkerLoader,
239
- parse: async (arraybuffer, options) => parseArrowSync(arraybuffer, options == null ? void 0 : options.arrow),
240
- parseSync: (arraybuffer, options) => parseArrowSync(arraybuffer, options == null ? void 0 : options.arrow),
241
- parseInBatches: parseArrowInBatches
242
- };
243
-
244
- // src/lib/encode-arrow.ts
245
- var arrow5 = __toESM(require("apache-arrow"), 1);
246
- function encodeArrowSync(data) {
247
- const vectors = {};
248
- for (const arrayData of data) {
249
- const arrayVector = createVector(arrayData.array, arrayData.type);
250
- vectors[arrayData.name] = arrayVector;
251
- }
252
- const table = new arrow5.Table(vectors);
253
- const arrowBuffer = arrow5.tableToIPC(table);
254
- return arrowBuffer;
255
- }
256
- function createVector(array, type) {
257
- switch (type) {
258
- case 1 /* DATE */:
259
- return arrow5.vectorFromArray(array);
260
- case 0 /* FLOAT */:
261
- default:
262
- return arrow5.vectorFromArray(array);
263
- }
264
- }
265
-
266
- // src/arrow-writer.ts
267
- var VERSION2 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
268
- var ArrowWriter = {
269
- name: "Apache Arrow",
270
- id: "arrow",
271
- module: "arrow",
272
- version: VERSION2,
273
- extensions: ["arrow", "feather"],
274
- mimeTypes: [
275
- "application/vnd.apache.arrow.file",
276
- "application/vnd.apache.arrow.stream",
277
- "application/octet-stream"
278
- ],
279
- binary: true,
280
- options: {},
281
- encode: async function encodeArrow(data, options) {
282
- return encodeArrowSync(data);
283
- },
284
- encodeSync(data, options) {
285
- return encodeArrowSync(data);
286
- }
287
- };
288
-
289
- // src/tables/convert-arrow-to-geojson-table.ts
290
- var import_arrow = require("@loaders.gl/arrow");
291
- var import_gis = require("@loaders.gl/gis");
292
- function convertArrowToGeoJSONTable(table) {
293
- var _a;
294
- const arrowTable = table.data;
295
- const schema = (0, import_arrow.serializeArrowSchema)(arrowTable.schema);
296
- const geometryColumns = (0, import_gis.getGeometryColumnsFromSchema)(schema);
297
- const encoding = geometryColumns.geometry.encoding;
298
- const features = [];
299
- for (let row = 0; row < arrowTable.numRows; row++) {
300
- const arrowGeometry = (_a = arrowTable.getChild("geometry")) == null ? void 0 : _a.get(row);
301
- const arrowGeometryObject = { encoding, data: arrowGeometry };
302
- const feature = (0, import_arrow.parseGeometryFromArrow)(arrowGeometryObject);
303
- if (feature) {
304
- features.push(feature);
305
- }
306
- }
307
- return {
308
- shape: "geojson-table",
309
- type: "FeatureCollection",
310
- features
311
- };
312
- }
313
-
314
- // src/parsers/parse-geoarrow-sync.ts
315
- function parseGeoArrowSync(arrayBuffer, options) {
316
- const table = parseArrowSync(arrayBuffer, { shape: "arrow-table" });
317
- switch (options == null ? void 0 : options.shape) {
318
- case "geojson-table":
319
- return convertArrowToGeoJSONTable(table);
320
- default:
321
- return table;
322
- }
323
- }
324
-
325
- // src/parsers/parse-geoarrow-in-batches.ts
326
- function parseGeoArrowInBatches(asyncIterator) {
327
- return parseArrowInBatches(asyncIterator);
328
- }
329
-
330
- // src/geoarrow-loader.ts
331
- var GeoArrowWorkerLoader = {
332
- ...ArrowWorkerLoader,
333
- options: {
334
- arrow: {
335
- shape: "arrow-table"
336
- }
337
- }
338
- };
339
- var GeoArrowLoader = {
340
- ...ArrowWorkerLoader,
341
- options: {
342
- arrow: {
343
- shape: "arrow-table"
344
- }
345
- },
346
- parse: async (arraybuffer, options) => parseGeoArrowSync(arraybuffer, options == null ? void 0 : options.arrow),
347
- parseSync: (arraybuffer, options) => parseGeoArrowSync(arraybuffer, options == null ? void 0 : options.arrow),
348
- parseInBatches: parseGeoArrowInBatches
349
- };
350
-
351
173
  // src/schema/convert-arrow-schema.ts
352
- var arrow6 = __toESM(require("apache-arrow"), 1);
353
- function serializeArrowSchema2(arrowSchema) {
174
+ var arrow3 = __toESM(require("apache-arrow"), 1);
175
+ function serializeArrowSchema(arrowSchema) {
354
176
  return {
355
177
  fields: arrowSchema.fields.map((arrowField) => serializeArrowField(arrowField)),
356
178
  metadata: serializeArrowMetadata(arrowSchema.metadata)
357
179
  };
358
180
  }
359
181
  function deserializeArrowSchema(schema) {
360
- return new arrow6.Schema(
182
+ return new arrow3.Schema(
361
183
  schema.fields.map((field) => deserializeArrowField(field)),
362
184
  deserializeArrowMetadata(schema.metadata)
363
185
  );
@@ -377,7 +199,7 @@ function serializeArrowField(field) {
377
199
  };
378
200
  }
379
201
  function deserializeArrowField(field) {
380
- return new arrow6.Field(
202
+ return new arrow3.Field(
381
203
  field.name,
382
204
  deserializeArrowType(field.type),
383
205
  field.nullable,
@@ -386,52 +208,52 @@ function deserializeArrowField(field) {
386
208
  }
387
209
  function serializeArrowType(arrowType) {
388
210
  switch (arrowType.constructor) {
389
- case arrow6.Null:
211
+ case arrow3.Null:
390
212
  return "null";
391
- case arrow6.Binary:
213
+ case arrow3.Binary:
392
214
  return "binary";
393
- case arrow6.Bool:
215
+ case arrow3.Bool:
394
216
  return "bool";
395
- case arrow6.Int:
217
+ case arrow3.Int:
396
218
  const intType = arrowType;
397
219
  return `${intType.isSigned ? "u" : ""}int${intType.bitWidth}`;
398
- case arrow6.Int8:
220
+ case arrow3.Int8:
399
221
  return "int8";
400
- case arrow6.Int16:
222
+ case arrow3.Int16:
401
223
  return "int16";
402
- case arrow6.Int32:
224
+ case arrow3.Int32:
403
225
  return "int32";
404
- case arrow6.Int64:
226
+ case arrow3.Int64:
405
227
  return "int64";
406
- case arrow6.Uint8:
228
+ case arrow3.Uint8:
407
229
  return "uint8";
408
- case arrow6.Uint16:
230
+ case arrow3.Uint16:
409
231
  return "uint16";
410
- case arrow6.Uint32:
232
+ case arrow3.Uint32:
411
233
  return "uint32";
412
- case arrow6.Uint64:
234
+ case arrow3.Uint64:
413
235
  return "uint64";
414
- case arrow6.Float:
236
+ case arrow3.Float:
415
237
  const precision = arrowType.precision;
416
238
  switch (precision) {
417
- case arrow6.Precision.HALF:
239
+ case arrow3.Precision.HALF:
418
240
  return "float16";
419
- case arrow6.Precision.SINGLE:
241
+ case arrow3.Precision.SINGLE:
420
242
  return "float32";
421
- case arrow6.Precision.DOUBLE:
243
+ case arrow3.Precision.DOUBLE:
422
244
  return "float64";
423
245
  default:
424
246
  return "float16";
425
247
  }
426
- case arrow6.Float16:
248
+ case arrow3.Float16:
427
249
  return "float16";
428
- case arrow6.Float32:
250
+ case arrow3.Float32:
429
251
  return "float32";
430
- case arrow6.Float64:
252
+ case arrow3.Float64:
431
253
  return "float64";
432
- case arrow6.Utf8:
254
+ case arrow3.Utf8:
433
255
  return "utf8";
434
- case arrow6.Decimal:
256
+ case arrow3.Decimal:
435
257
  const decimal = arrowType;
436
258
  return {
437
259
  type: "decimal",
@@ -439,93 +261,93 @@ function serializeArrowType(arrowType) {
439
261
  precision: decimal.precision,
440
262
  scale: decimal.scale
441
263
  };
442
- case arrow6.Date_:
264
+ case arrow3.Date_:
443
265
  const dateUnit = arrowType.unit;
444
- return dateUnit === arrow6.DateUnit.DAY ? "date-day" : "date-millisecond";
445
- case arrow6.DateDay:
266
+ return dateUnit === arrow3.DateUnit.DAY ? "date-day" : "date-millisecond";
267
+ case arrow3.DateDay:
446
268
  return "date-day";
447
- case arrow6.DateMillisecond:
269
+ case arrow3.DateMillisecond:
448
270
  return "date-millisecond";
449
- case arrow6.Time:
271
+ case arrow3.Time:
450
272
  const timeUnit = arrowType.unit;
451
273
  switch (timeUnit) {
452
- case arrow6.TimeUnit.SECOND:
274
+ case arrow3.TimeUnit.SECOND:
453
275
  return "time-second";
454
- case arrow6.TimeUnit.MILLISECOND:
276
+ case arrow3.TimeUnit.MILLISECOND:
455
277
  return "time-millisecond";
456
- case arrow6.TimeUnit.MICROSECOND:
278
+ case arrow3.TimeUnit.MICROSECOND:
457
279
  return "time-microsecond";
458
- case arrow6.TimeUnit.NANOSECOND:
280
+ case arrow3.TimeUnit.NANOSECOND:
459
281
  return "time-nanosecond";
460
282
  default:
461
283
  return "time-second";
462
284
  }
463
- case arrow6.TimeMillisecond:
285
+ case arrow3.TimeMillisecond:
464
286
  return "time-millisecond";
465
- case arrow6.TimeSecond:
287
+ case arrow3.TimeSecond:
466
288
  return "time-second";
467
- case arrow6.TimeMicrosecond:
289
+ case arrow3.TimeMicrosecond:
468
290
  return "time-microsecond";
469
- case arrow6.TimeNanosecond:
291
+ case arrow3.TimeNanosecond:
470
292
  return "time-nanosecond";
471
- case arrow6.Timestamp:
293
+ case arrow3.Timestamp:
472
294
  const timeStampUnit = arrowType.unit;
473
295
  switch (timeStampUnit) {
474
- case arrow6.TimeUnit.SECOND:
296
+ case arrow3.TimeUnit.SECOND:
475
297
  return "timestamp-second";
476
- case arrow6.TimeUnit.MILLISECOND:
298
+ case arrow3.TimeUnit.MILLISECOND:
477
299
  return "timestamp-millisecond";
478
- case arrow6.TimeUnit.MICROSECOND:
300
+ case arrow3.TimeUnit.MICROSECOND:
479
301
  return "timestamp-microsecond";
480
- case arrow6.TimeUnit.NANOSECOND:
302
+ case arrow3.TimeUnit.NANOSECOND:
481
303
  return "timestamp-nanosecond";
482
304
  default:
483
305
  return "timestamp-second";
484
306
  }
485
- case arrow6.TimestampSecond:
307
+ case arrow3.TimestampSecond:
486
308
  return "timestamp-second";
487
- case arrow6.TimestampMillisecond:
309
+ case arrow3.TimestampMillisecond:
488
310
  return "timestamp-millisecond";
489
- case arrow6.TimestampMicrosecond:
311
+ case arrow3.TimestampMicrosecond:
490
312
  return "timestamp-microsecond";
491
- case arrow6.TimestampNanosecond:
313
+ case arrow3.TimestampNanosecond:
492
314
  return "timestamp-nanosecond";
493
- case arrow6.Interval:
315
+ case arrow3.Interval:
494
316
  const intervalUnit = arrowType.unit;
495
317
  switch (intervalUnit) {
496
- case arrow6.IntervalUnit.DAY_TIME:
318
+ case arrow3.IntervalUnit.DAY_TIME:
497
319
  return "interval-daytime";
498
- case arrow6.IntervalUnit.YEAR_MONTH:
320
+ case arrow3.IntervalUnit.YEAR_MONTH:
499
321
  return "interval-yearmonth";
500
322
  default:
501
323
  return "interval-daytime";
502
324
  }
503
- case arrow6.IntervalDayTime:
325
+ case arrow3.IntervalDayTime:
504
326
  return "interval-daytime";
505
- case arrow6.IntervalYearMonth:
327
+ case arrow3.IntervalYearMonth:
506
328
  return "interval-yearmonth";
507
- case arrow6.Map_:
329
+ case arrow3.Map_:
508
330
  const mapType = arrowType;
509
331
  return {
510
332
  type: "map",
511
333
  keysSorted: mapType.keysSorted,
512
334
  children: mapType.children.map((arrowField) => serializeArrowField(arrowField))
513
335
  };
514
- case arrow6.List:
336
+ case arrow3.List:
515
337
  const listType = arrowType;
516
338
  const listField = listType.valueField;
517
339
  return {
518
340
  type: "list",
519
341
  children: [serializeArrowField(listField)]
520
342
  };
521
- case arrow6.FixedSizeList:
343
+ case arrow3.FixedSizeList:
522
344
  const fixedSizeList = arrowType;
523
345
  return {
524
346
  type: "fixed-size-list",
525
347
  listSize: fixedSizeList.listSize,
526
348
  children: [serializeArrowField(fixedSizeList.children[0])]
527
349
  };
528
- case arrow6.Struct:
350
+ case arrow3.Struct:
529
351
  const structType = arrowType;
530
352
  return {
531
353
  type: "struct",
@@ -539,83 +361,270 @@ function deserializeArrowType(dataType) {
539
361
  if (typeof dataType === "object") {
540
362
  switch (dataType.type) {
541
363
  case "decimal":
542
- return new arrow6.Decimal(dataType.precision, dataType.scale, dataType.bitWidth);
364
+ return new arrow3.Decimal(dataType.precision, dataType.scale, dataType.bitWidth);
543
365
  case "map":
544
366
  let children = dataType.children.map((arrowField) => deserializeArrowField(arrowField));
545
- return new arrow6.Map_(children, dataType.keysSorted);
367
+ return new arrow3.Map_(children, dataType.keysSorted);
546
368
  case "list":
547
369
  const field = deserializeArrowField(dataType.children[0]);
548
- return new arrow6.List(field);
370
+ return new arrow3.List(field);
549
371
  case "fixed-size-list":
550
372
  const child = deserializeArrowField(dataType.children[0]);
551
- return new arrow6.FixedSizeList(dataType.listSize, child);
373
+ return new arrow3.FixedSizeList(dataType.listSize, child);
552
374
  case "struct":
553
375
  children = dataType.children.map((arrowField) => deserializeArrowField(arrowField));
554
- return new arrow6.Struct(children);
376
+ return new arrow3.Struct(children);
555
377
  default:
556
378
  throw new Error("array type not supported");
557
379
  }
558
380
  }
559
381
  switch (dataType) {
560
382
  case "null":
561
- return new arrow6.Null();
383
+ return new arrow3.Null();
562
384
  case "binary":
563
- return new arrow6.Binary();
385
+ return new arrow3.Binary();
564
386
  case "bool":
565
- return new arrow6.Bool();
387
+ return new arrow3.Bool();
566
388
  case "int8":
567
- return new arrow6.Int8();
389
+ return new arrow3.Int8();
568
390
  case "int16":
569
- return new arrow6.Int16();
391
+ return new arrow3.Int16();
570
392
  case "int32":
571
- return new arrow6.Int32();
393
+ return new arrow3.Int32();
572
394
  case "int64":
573
- return new arrow6.Int64();
395
+ return new arrow3.Int64();
574
396
  case "uint8":
575
- return new arrow6.Uint8();
397
+ return new arrow3.Uint8();
576
398
  case "uint16":
577
- return new arrow6.Uint16();
399
+ return new arrow3.Uint16();
578
400
  case "uint32":
579
- return new arrow6.Uint32();
401
+ return new arrow3.Uint32();
580
402
  case "uint64":
581
- return new arrow6.Uint64();
403
+ return new arrow3.Uint64();
582
404
  case "float16":
583
- return new arrow6.Float16();
405
+ return new arrow3.Float16();
584
406
  case "float32":
585
- return new arrow6.Float32();
407
+ return new arrow3.Float32();
586
408
  case "float64":
587
- return new arrow6.Float64();
409
+ return new arrow3.Float64();
588
410
  case "utf8":
589
- return new arrow6.Utf8();
411
+ return new arrow3.Utf8();
590
412
  case "date-day":
591
- return new arrow6.DateDay();
413
+ return new arrow3.DateDay();
592
414
  case "date-millisecond":
593
- return new arrow6.DateMillisecond();
415
+ return new arrow3.DateMillisecond();
594
416
  case "time-second":
595
- return new arrow6.TimeSecond();
417
+ return new arrow3.TimeSecond();
596
418
  case "time-millisecond":
597
- return new arrow6.TimeMillisecond();
419
+ return new arrow3.TimeMillisecond();
598
420
  case "time-microsecond":
599
- return new arrow6.TimeMicrosecond();
421
+ return new arrow3.TimeMicrosecond();
600
422
  case "time-nanosecond":
601
- return new arrow6.TimeNanosecond();
423
+ return new arrow3.TimeNanosecond();
602
424
  case "timestamp-second":
603
- return new arrow6.TimestampSecond();
425
+ return new arrow3.TimestampSecond();
604
426
  case "timestamp-millisecond":
605
- return new arrow6.TimestampMillisecond();
427
+ return new arrow3.TimestampMillisecond();
606
428
  case "timestamp-microsecond":
607
- return new arrow6.TimestampMicrosecond();
429
+ return new arrow3.TimestampMicrosecond();
608
430
  case "timestamp-nanosecond":
609
- return new arrow6.TimestampNanosecond();
431
+ return new arrow3.TimestampNanosecond();
610
432
  case "interval-daytime":
611
- return new arrow6.IntervalDayTime();
433
+ return new arrow3.IntervalDayTime();
612
434
  case "interval-yearmonth":
613
- return new arrow6.IntervalYearMonth();
435
+ return new arrow3.IntervalYearMonth();
614
436
  default:
615
437
  throw new Error("array type not supported");
616
438
  }
617
439
  }
618
440
 
441
+ // src/parsers/parse-arrow-sync.ts
442
+ function parseArrowSync(arrayBuffer, options) {
443
+ const apacheArrowTable = arrow4.tableFromIPC([new Uint8Array(arrayBuffer)]);
444
+ const arrowTable = {
445
+ shape: "arrow-table",
446
+ schema: serializeArrowSchema(apacheArrowTable.schema),
447
+ data: apacheArrowTable
448
+ };
449
+ const shape = (options == null ? void 0 : options.shape) || "arrow-table";
450
+ switch (shape) {
451
+ case "arrow-table":
452
+ return arrowTable;
453
+ case "columnar-table":
454
+ return convertArrowToColumnarTable(arrowTable);
455
+ case "object-row-table":
456
+ let columnarTable = convertArrowToColumnarTable(arrowTable);
457
+ return (0, import_schema2.convertTable)(columnarTable, "object-row-table");
458
+ case "array-row-table":
459
+ columnarTable = convertArrowToColumnarTable(arrowTable);
460
+ return (0, import_schema2.convertTable)(columnarTable, "array-row-table");
461
+ default:
462
+ throw new Error(shape);
463
+ }
464
+ }
465
+
466
+ // src/parsers/parse-arrow-in-batches.ts
467
+ var arrow5 = __toESM(require("apache-arrow"), 1);
468
+ function parseArrowInBatches(asyncIterator) {
469
+ async function* makeArrowAsyncIterator() {
470
+ const readers = arrow5.RecordBatchReader.readAll(asyncIterator);
471
+ for await (const reader of readers) {
472
+ for await (const recordBatch of reader) {
473
+ const arrowTabledBatch = {
474
+ shape: "arrow-table",
475
+ batchType: "data",
476
+ data: new arrow5.Table([recordBatch]),
477
+ length: recordBatch.data.length
478
+ };
479
+ yield arrowTabledBatch;
480
+ }
481
+ break;
482
+ }
483
+ }
484
+ return makeArrowAsyncIterator();
485
+ }
486
+
487
+ // src/arrow-loader.ts
488
+ var VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
489
+ var ArrowWorkerLoader = {
490
+ name: "Apache Arrow",
491
+ id: "arrow",
492
+ module: "arrow",
493
+ version: VERSION,
494
+ // worker: true,
495
+ category: "table",
496
+ extensions: ["arrow", "feather"],
497
+ mimeTypes: [
498
+ "application/vnd.apache.arrow.file",
499
+ "application/vnd.apache.arrow.stream",
500
+ "application/octet-stream"
501
+ ],
502
+ binary: true,
503
+ tests: ["ARROW"],
504
+ options: {
505
+ arrow: {
506
+ shape: "columnar-table"
507
+ }
508
+ }
509
+ };
510
+ var ArrowLoader = {
511
+ ...ArrowWorkerLoader,
512
+ parse: async (arraybuffer, options) => parseArrowSync(arraybuffer, options == null ? void 0 : options.arrow),
513
+ parseSync: (arraybuffer, options) => parseArrowSync(arraybuffer, options == null ? void 0 : options.arrow),
514
+ parseInBatches: parseArrowInBatches
515
+ };
516
+
517
+ // src/lib/encode-arrow.ts
518
+ var arrow6 = __toESM(require("apache-arrow"), 1);
519
+ function encodeArrowSync(data) {
520
+ const vectors = {};
521
+ for (const arrayData of data) {
522
+ const arrayVector = createVector(arrayData.array, arrayData.type);
523
+ vectors[arrayData.name] = arrayVector;
524
+ }
525
+ const table = new arrow6.Table(vectors);
526
+ const arrowBuffer = arrow6.tableToIPC(table);
527
+ return arrowBuffer;
528
+ }
529
+ function createVector(array, type) {
530
+ switch (type) {
531
+ case 1 /* DATE */:
532
+ return arrow6.vectorFromArray(array);
533
+ case 0 /* FLOAT */:
534
+ default:
535
+ return arrow6.vectorFromArray(array);
536
+ }
537
+ }
538
+
539
+ // src/arrow-writer.ts
540
+ var VERSION2 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
541
+ var ArrowWriter = {
542
+ name: "Apache Arrow",
543
+ id: "arrow",
544
+ module: "arrow",
545
+ version: VERSION2,
546
+ extensions: ["arrow", "feather"],
547
+ mimeTypes: [
548
+ "application/vnd.apache.arrow.file",
549
+ "application/vnd.apache.arrow.stream",
550
+ "application/octet-stream"
551
+ ],
552
+ binary: true,
553
+ options: {},
554
+ encode: async function encodeArrow(data, options) {
555
+ return encodeArrowSync(data);
556
+ },
557
+ encodeSync(data, options) {
558
+ return encodeArrowSync(data);
559
+ }
560
+ };
561
+
562
+ // src/tables/convert-arrow-to-geojson-table.ts
563
+ var import_arrow = require("@loaders.gl/arrow");
564
+ var import_gis = require("@loaders.gl/gis");
565
+ function convertArrowToGeoJSONTable(table) {
566
+ var _a;
567
+ const arrowTable = table.data;
568
+ const schema = (0, import_arrow.serializeArrowSchema)(arrowTable.schema);
569
+ const geometryColumns = (0, import_gis.getGeometryColumnsFromSchema)(schema);
570
+ const encoding = geometryColumns.geometry.encoding;
571
+ const features = [];
572
+ const propertyColumnNames = arrowTable.schema.fields.map((field) => field.name).filter((name) => !(name in geometryColumns));
573
+ const propertiesTable = arrowTable.select(propertyColumnNames);
574
+ const arrowGeometryColumn = arrowTable.getChild("geometry");
575
+ for (let row = 0; row < arrowTable.numRows; row++) {
576
+ const arrowGeometry = arrowGeometryColumn == null ? void 0 : arrowGeometryColumn.get(row);
577
+ const feature = (0, import_arrow.parseGeometryFromArrow)(arrowGeometry, encoding);
578
+ if (feature) {
579
+ const properties = ((_a = propertiesTable.get(row)) == null ? void 0 : _a.toJSON()) || {};
580
+ features.push({ type: "Feature", geometry: feature, properties });
581
+ }
582
+ }
583
+ return {
584
+ shape: "geojson-table",
585
+ type: "FeatureCollection",
586
+ schema: table.schema,
587
+ features
588
+ };
589
+ }
590
+
591
+ // src/parsers/parse-geoarrow-sync.ts
592
+ function parseGeoArrowSync(arrayBuffer, options) {
593
+ const table = parseArrowSync(arrayBuffer, { shape: "arrow-table" });
594
+ switch (options == null ? void 0 : options.shape) {
595
+ case "geojson-table":
596
+ return convertArrowToGeoJSONTable(table);
597
+ default:
598
+ return table;
599
+ }
600
+ }
601
+
602
+ // src/parsers/parse-geoarrow-in-batches.ts
603
+ function parseGeoArrowInBatches(asyncIterator) {
604
+ return parseArrowInBatches(asyncIterator);
605
+ }
606
+
607
+ // src/geoarrow-loader.ts
608
+ var GeoArrowWorkerLoader = {
609
+ ...ArrowWorkerLoader,
610
+ options: {
611
+ arrow: {
612
+ shape: "arrow-table"
613
+ }
614
+ }
615
+ };
616
+ var GeoArrowLoader = {
617
+ ...ArrowWorkerLoader,
618
+ options: {
619
+ arrow: {
620
+ shape: "arrow-table"
621
+ }
622
+ },
623
+ parse: async (arraybuffer, options) => parseGeoArrowSync(arraybuffer, options == null ? void 0 : options.arrow),
624
+ parseSync: (arraybuffer, options) => parseGeoArrowSync(arraybuffer, options == null ? void 0 : options.arrow),
625
+ parseInBatches: parseGeoArrowInBatches
626
+ };
627
+
619
628
  // src/geoarrow/convert-geoarrow-to-binary-geometry.ts
620
629
  var import_polygon = require("@math.gl/polygon");
621
630
 
@@ -662,7 +671,7 @@ function getBinaryGeometriesFromArrow(geoColumn, geoEncoding, options) {
662
671
  let globalFeatureIdOffset = 0;
663
672
  const binaryGeometries = [];
664
673
  chunks.forEach((chunk) => {
665
- const { featureIds, flatCoordinateArray, nDim, geomOffset, triangles } = getBinaryGeometriesFromChunk(chunk, geoEncoding);
674
+ const { featureIds, flatCoordinateArray, nDim, geomOffset, triangles } = getBinaryGeometriesFromChunk(chunk, geoEncoding, options);
666
675
  const globalFeatureIds = new Uint32Array(featureIds.length);
667
676
  for (let i = 0; i < featureIds.length; i++) {
668
677
  globalFeatureIds[i] = featureIds[i] + globalFeatureIdOffset;
@@ -714,7 +723,7 @@ function getBinaryGeometriesFromArrow(geoColumn, geoEncoding, options) {
714
723
  binaryGeometries,
715
724
  bounds,
716
725
  featureTypes,
717
- ...(options == null ? void 0 : options.meanCenter) ? { meanCenters: getMeanCentersFromBinaryGeometries(binaryGeometries) } : {}
726
+ ...(options == null ? void 0 : options.calculateMeanCenters) ? { meanCenters: getMeanCentersFromBinaryGeometries(binaryGeometries) } : {}
718
727
  };
719
728
  }
720
729
  function getMeanCentersFromBinaryGeometries(binaryGeometries) {
@@ -723,18 +732,18 @@ function getMeanCentersFromBinaryGeometries(binaryGeometries) {
723
732
  var _a;
724
733
  let binaryGeometryType = null;
725
734
  if (binaryGeometry.points && binaryGeometry.points.positions.value.length > 0) {
726
- binaryGeometryType = "points";
735
+ binaryGeometryType = "points" /* points */;
727
736
  } else if (binaryGeometry.lines && binaryGeometry.lines.positions.value.length > 0) {
728
- binaryGeometryType = "lines";
737
+ binaryGeometryType = "lines" /* lines */;
729
738
  } else if (binaryGeometry.polygons && binaryGeometry.polygons.positions.value.length > 0) {
730
- binaryGeometryType = "polygons";
739
+ binaryGeometryType = "polygons" /* polygons */;
731
740
  }
732
741
  const binaryContent = binaryGeometryType ? binaryGeometry[binaryGeometryType] : null;
733
742
  if (binaryContent && binaryGeometryType !== null) {
734
743
  const featureIds = binaryContent.featureIds.value;
735
744
  const flatCoordinateArray = binaryContent.positions.value;
736
745
  const nDim = binaryContent.positions.size;
737
- const primitivePolygonIndices = (_a = binaryContent.primitivePolygonIndices) == null ? void 0 : _a.value;
746
+ const primitivePolygonIndices = binaryContent.type === "Polygon" ? (_a = binaryContent.primitivePolygonIndices) == null ? void 0 : _a.value : void 0;
738
747
  const meanCenters = getMeanCentersFromGeometry(
739
748
  featureIds,
740
749
  flatCoordinateArray,
@@ -753,19 +762,23 @@ function getMeanCentersFromGeometry(featureIds, flatCoordinateArray, nDim, geome
753
762
  const meanCenters = [];
754
763
  const vertexCount = flatCoordinateArray.length;
755
764
  let vertexIndex = 0;
765
+ let coordIdx = 0;
766
+ let primitiveIdx = 0;
756
767
  while (vertexIndex < vertexCount) {
757
768
  const featureId = featureIds[vertexIndex / nDim];
758
769
  const center = [0, 0];
759
770
  let vertexCountInFeature = 0;
760
- while (vertexIndex < vertexCount && featureIds[vertexIndex / nDim] === featureId) {
761
- if (geometryType === "polygons" && primitivePolygonIndices && primitivePolygonIndices.indexOf(vertexIndex / nDim) >= 0) {
771
+ while (vertexIndex < vertexCount && featureIds[coordIdx] === featureId) {
772
+ if (geometryType === "polygons" /* polygons */ && (primitivePolygonIndices == null ? void 0 : primitivePolygonIndices[primitiveIdx]) === coordIdx) {
762
773
  vertexIndex += nDim;
774
+ primitiveIdx++;
763
775
  } else {
764
776
  center[0] += flatCoordinateArray[vertexIndex];
765
777
  center[1] += flatCoordinateArray[vertexIndex + 1];
766
778
  vertexIndex += nDim;
767
779
  vertexCountInFeature++;
768
780
  }
781
+ coordIdx += 1;
769
782
  }
770
783
  center[0] /= vertexCountInFeature;
771
784
  center[1] /= vertexCountInFeature;
@@ -773,7 +786,7 @@ function getMeanCentersFromGeometry(featureIds, flatCoordinateArray, nDim, geome
773
786
  }
774
787
  return meanCenters;
775
788
  }
776
- function getBinaryGeometriesFromChunk(chunk, geoEncoding) {
789
+ function getBinaryGeometriesFromChunk(chunk, geoEncoding, options) {
777
790
  switch (geoEncoding) {
778
791
  case "geoarrow.point":
779
792
  case "geoarrow.multipoint":
@@ -783,41 +796,48 @@ function getBinaryGeometriesFromChunk(chunk, geoEncoding) {
783
796
  return getBinaryLinesFromChunk(chunk, geoEncoding);
784
797
  case "geoarrow.polygon":
785
798
  case "geoarrow.multipolygon":
786
- return getBinaryPolygonsFromChunk(chunk, geoEncoding);
799
+ return getBinaryPolygonsFromChunk(chunk, geoEncoding, options);
787
800
  default:
788
801
  throw Error("invalid geoarrow encoding");
789
802
  }
790
803
  }
791
804
  function getTriangleIndices(polygonIndices, primitivePolygonIndices, flatCoordinateArray, nDim) {
792
- let primitiveIndex = 0;
793
- const triangles = [];
794
- for (let i = 0; i < polygonIndices.length - 1; i++) {
795
- const startIdx = polygonIndices[i];
796
- const endIdx = polygonIndices[i + 1];
797
- const slicedFlatCoords = flatCoordinateArray.subarray(startIdx * nDim, endIdx * nDim);
798
- const holeIndices = [];
799
- while (primitivePolygonIndices[primitiveIndex] < endIdx) {
800
- if (primitivePolygonIndices[primitiveIndex] > startIdx) {
801
- holeIndices.push(primitivePolygonIndices[primitiveIndex] - startIdx);
805
+ try {
806
+ let primitiveIndex = 0;
807
+ const triangles = [];
808
+ for (let i = 0; i < polygonIndices.length - 1; i++) {
809
+ const startIdx = polygonIndices[i];
810
+ const endIdx = polygonIndices[i + 1];
811
+ const slicedFlatCoords = flatCoordinateArray.subarray(startIdx * nDim, endIdx * nDim);
812
+ const holeIndices = [];
813
+ while (primitivePolygonIndices[primitiveIndex] < endIdx) {
814
+ if (primitivePolygonIndices[primitiveIndex] > startIdx) {
815
+ holeIndices.push(primitivePolygonIndices[primitiveIndex] - startIdx);
816
+ }
817
+ primitiveIndex++;
818
+ }
819
+ const triangleIndices = (0, import_polygon.earcut)(
820
+ slicedFlatCoords,
821
+ holeIndices.length > 0 ? holeIndices : void 0,
822
+ nDim
823
+ );
824
+ if (triangleIndices.length === 0) {
825
+ throw Error("can not tesselate invalid polygon");
826
+ }
827
+ for (let j = 0; j < triangleIndices.length; j++) {
828
+ triangles.push(triangleIndices[j] + startIdx);
802
829
  }
803
- primitiveIndex++;
804
830
  }
805
- const triangleIndices = (0, import_polygon.earcut)(
806
- slicedFlatCoords,
807
- holeIndices.length > 0 ? holeIndices : void 0,
808
- nDim
809
- );
810
- for (let j = 0; j < triangleIndices.length; j++) {
811
- triangles.push(triangleIndices[j] + startIdx);
831
+ const trianglesUint32 = new Uint32Array(triangles.length);
832
+ for (let i = 0; i < triangles.length; i++) {
833
+ trianglesUint32[i] = triangles[i];
812
834
  }
835
+ return trianglesUint32;
836
+ } catch (error) {
837
+ return null;
813
838
  }
814
- const trianglesUint32 = new Uint32Array(triangles.length);
815
- for (let i = 0; i < triangles.length; i++) {
816
- trianglesUint32[i] = triangles[i];
817
- }
818
- return trianglesUint32;
819
839
  }
820
- function getBinaryPolygonsFromChunk(chunk, geoEncoding) {
840
+ function getBinaryPolygonsFromChunk(chunk, geoEncoding, options) {
821
841
  const isMultiPolygon = geoEncoding === "geoarrow.multipolygon";
822
842
  const polygonData = isMultiPolygon ? chunk.children[0] : chunk;
823
843
  const polygonOffset = polygonData.valueOffsets;
@@ -841,14 +861,14 @@ function getBinaryPolygonsFromChunk(chunk, geoEncoding) {
841
861
  featureIds[j] = i;
842
862
  }
843
863
  }
844
- const triangles = getTriangleIndices(geometryIndicies, geomOffset, flatCoordinateArray, nDim);
864
+ const triangles = (options == null ? void 0 : options.triangulate) ? getTriangleIndices(geometryIndicies, geomOffset, flatCoordinateArray, nDim) : null;
845
865
  return {
846
866
  featureIds,
847
867
  flatCoordinateArray,
848
868
  nDim,
849
869
  geomOffset,
850
870
  geometryIndicies,
851
- triangles
871
+ ...(options == null ? void 0 : options.triangulate) && triangles ? { triangles } : {}
852
872
  };
853
873
  }
854
874
  function getBinaryLinesFromChunk(chunk, geoEncoding) {
@@ -921,47 +941,60 @@ function getBinaryPointsFromChunk(chunk, geoEncoding) {
921
941
  };
922
942
  }
923
943
 
924
- // src/geoarrow/convert-geoarrow-to-geojson.ts
925
- function parseGeometryFromArrow2(rawData) {
926
- var _a;
927
- const encoding = (_a = rawData.encoding) == null ? void 0 : _a.toLowerCase();
928
- const data = rawData.data;
929
- if (!encoding || !data) {
944
+ // src/geoarrow/convert-geoarrow-to-geojson-geometry.ts
945
+ var import_gis2 = require("@loaders.gl/gis");
946
+ var import_wkt = require("@loaders.gl/wkt");
947
+ function parseGeometryFromArrow2(arrowCellValue, encoding) {
948
+ encoding = encoding == null ? void 0 : encoding.toLowerCase();
949
+ if (!encoding || !arrowCellValue) {
930
950
  return null;
931
951
  }
932
952
  let geometry;
933
953
  switch (encoding) {
934
954
  case "geoarrow.multipolygon":
935
- geometry = arrowMultiPolygonToFeature(data);
955
+ geometry = arrowMultiPolygonToFeature(arrowCellValue);
936
956
  break;
937
957
  case "geoarrow.polygon":
938
- geometry = arrowPolygonToFeature(data);
958
+ geometry = arrowPolygonToFeature(arrowCellValue);
939
959
  break;
940
960
  case "geoarrow.multipoint":
941
- geometry = arrowMultiPointToFeature(data);
961
+ geometry = arrowMultiPointToFeature(arrowCellValue);
942
962
  break;
943
963
  case "geoarrow.point":
944
- geometry = arrowPointToFeature(data);
964
+ geometry = arrowPointToFeature(arrowCellValue);
945
965
  break;
946
966
  case "geoarrow.multilinestring":
947
- geometry = arrowMultiLineStringToFeature(data);
967
+ geometry = arrowMultiLineStringToFeature(arrowCellValue);
948
968
  break;
949
969
  case "geoarrow.linestring":
950
- geometry = arrowLineStringToFeature(data);
970
+ geometry = arrowLineStringToFeature(arrowCellValue);
951
971
  break;
952
972
  case "geoarrow.wkb":
953
- throw Error(`GeoArrow encoding not supported ${encoding}`);
973
+ geometry = arrowWKBToFeature(arrowCellValue);
974
+ break;
954
975
  case "geoarrow.wkt":
955
- throw Error(`GeoArrow encoding not supported ${encoding}`);
976
+ geometry = arrowWKTToFeature(arrowCellValue);
977
+ break;
956
978
  default: {
957
979
  throw Error(`GeoArrow encoding not supported ${encoding}`);
958
980
  }
959
981
  }
960
- return {
961
- type: "Feature",
962
- geometry,
963
- properties: {}
964
- };
982
+ return geometry;
983
+ }
984
+ function arrowWKBToFeature(arrowCellValue) {
985
+ var _a, _b;
986
+ const arrayBuffer = arrowCellValue.buffer.slice(
987
+ arrowCellValue.byteOffset,
988
+ arrowCellValue.byteOffset + arrowCellValue.byteLength
989
+ );
990
+ const binaryGeometry = (_b = (_a = import_wkt.WKBLoader).parseSync) == null ? void 0 : _b.call(_a, arrayBuffer);
991
+ const geometry = (0, import_gis2.binaryToGeometry)(binaryGeometry);
992
+ return geometry;
993
+ }
994
+ function arrowWKTToFeature(arrowCellValue) {
995
+ var _a, _b;
996
+ const string = arrowCellValue;
997
+ return (_b = (_a = import_wkt.WKTLoader).parseTextSync) == null ? void 0 : _b.call(_a, string);
965
998
  }
966
999
  function arrowMultiPolygonToFeature(arrowMultiPolygon) {
967
1000
  const multiPolygon = [];
@@ -1013,19 +1046,17 @@ function arrowMultiPointToFeature(arrowMultiPoint) {
1013
1046
  multiPoint.push(coord);
1014
1047
  }
1015
1048
  }
1016
- const geometry = {
1049
+ return {
1017
1050
  type: "MultiPoint",
1018
1051
  coordinates: multiPoint
1019
1052
  };
1020
- return geometry;
1021
1053
  }
1022
1054
  function arrowPointToFeature(arrowPoint) {
1023
1055
  const point = Array.from(arrowPoint);
1024
- const geometry = {
1056
+ return {
1025
1057
  type: "Point",
1026
1058
  coordinates: point
1027
1059
  };
1028
- return geometry;
1029
1060
  }
1030
1061
  function arrowMultiLineStringToFeature(arrowMultiLineString) {
1031
1062
  const multiLineString = [];
@@ -1041,11 +1072,10 @@ function arrowMultiLineStringToFeature(arrowMultiLineString) {
1041
1072
  }
1042
1073
  multiLineString.push(lineString);
1043
1074
  }
1044
- const geometry = {
1075
+ return {
1045
1076
  type: "MultiLineString",
1046
1077
  coordinates: multiLineString
1047
1078
  };
1048
- return geometry;
1049
1079
  }
1050
1080
  function arrowLineStringToFeature(arrowLineString) {
1051
1081
  const lineString = [];
@@ -1056,11 +1086,10 @@ function arrowLineStringToFeature(arrowLineString) {
1056
1086
  lineString.push(coords);
1057
1087
  }
1058
1088
  }
1059
- const geometry = {
1089
+ return {
1060
1090
  type: "LineString",
1061
1091
  coordinates: lineString
1062
1092
  };
1063
- return geometry;
1064
1093
  }
1065
1094
 
1066
1095
  // src/triangulate-on-worker.ts