@loaders.gl/kml 3.1.0-beta.3 → 3.1.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.
package/dist/bundle.js CHANGED
@@ -29,105 +29,577 @@
29
29
  return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", module && module.__esModule && "default" in module ? { get: () => module.default, enumerable: true } : { value: module, enumerable: true })), module);
30
30
  };
31
31
 
32
- // ../gis/src/lib/geojson-to-binary.ts
33
- function geojsonToBinary(features, options = {}) {
34
- const firstPassData = firstPass(features);
35
- return secondPass(features, firstPassData, {
36
- coordLength: options.coordLength || firstPassData.coordLength,
37
- numericPropKeys: options.numericPropKeys || firstPassData.numericPropKeys,
38
- PositionDataType: options.PositionDataType || Float32Array
39
- });
32
+ // ../../node_modules/@math.gl/polygon/dist/esm/polygon-utils.js
33
+ function getPolygonSignedArea(points, options = {}) {
34
+ const {
35
+ start = 0,
36
+ end = points.length
37
+ } = options;
38
+ const dim = options.size || 2;
39
+ let area2 = 0;
40
+ for (let i = start, j = end - dim; i < end; i += dim) {
41
+ area2 += (points[i] - points[j]) * (points[i + 1] + points[j + 1]);
42
+ j = i;
43
+ }
44
+ return area2 / 2;
40
45
  }
41
- function firstPass(features) {
42
- let pointPositionsCount = 0;
43
- let pointFeaturesCount = 0;
44
- let linePositionsCount = 0;
45
- let linePathsCount = 0;
46
- let lineFeaturesCount = 0;
47
- let polygonPositionsCount = 0;
48
- let polygonObjectsCount = 0;
49
- let polygonRingsCount = 0;
50
- let polygonFeaturesCount = 0;
51
- const coordLengths = new Set();
52
- const numericPropKeys = {};
53
- for (const feature of features) {
54
- const geometry = feature.geometry;
55
- switch (geometry.type) {
56
- case "Point":
57
- pointFeaturesCount++;
58
- pointPositionsCount++;
59
- coordLengths.add(geometry.coordinates.length);
60
- break;
61
- case "MultiPoint":
62
- pointFeaturesCount++;
63
- pointPositionsCount += geometry.coordinates.length;
64
- for (const point of geometry.coordinates) {
65
- coordLengths.add(point.length);
66
- }
67
- break;
68
- case "LineString":
69
- lineFeaturesCount++;
70
- linePositionsCount += geometry.coordinates.length;
71
- linePathsCount++;
72
- for (const coord of geometry.coordinates) {
73
- coordLengths.add(coord.length);
74
- }
75
- break;
76
- case "MultiLineString":
77
- lineFeaturesCount++;
78
- for (const line of geometry.coordinates) {
79
- linePositionsCount += line.length;
80
- linePathsCount++;
81
- for (const coord of line) {
82
- coordLengths.add(coord.length);
83
- }
84
- }
46
+ var init_polygon_utils = __esm({
47
+ "../../node_modules/@math.gl/polygon/dist/esm/polygon-utils.js"() {
48
+ }
49
+ });
50
+
51
+ // ../../node_modules/@math.gl/polygon/dist/esm/polygon.js
52
+ var init_polygon = __esm({
53
+ "../../node_modules/@math.gl/polygon/dist/esm/polygon.js"() {
54
+ init_polygon_utils();
55
+ }
56
+ });
57
+
58
+ // ../../node_modules/@math.gl/polygon/dist/esm/earcut.js
59
+ function earcut(data, holeIndices, dim, areas) {
60
+ dim = dim || 2;
61
+ const hasHoles = holeIndices && holeIndices.length;
62
+ const outerLen = hasHoles ? holeIndices[0] * dim : data.length;
63
+ let outerNode = linkedList(data, 0, outerLen, dim, true, areas && areas[0]);
64
+ const triangles = [];
65
+ if (!outerNode || outerNode.next === outerNode.prev)
66
+ return triangles;
67
+ let invSize;
68
+ let maxX;
69
+ let maxY;
70
+ let minX;
71
+ let minY;
72
+ let x;
73
+ let y;
74
+ if (hasHoles)
75
+ outerNode = eliminateHoles(data, holeIndices, outerNode, dim, areas);
76
+ if (data.length > 80 * dim) {
77
+ minX = maxX = data[0];
78
+ minY = maxY = data[1];
79
+ for (let i = dim; i < outerLen; i += dim) {
80
+ x = data[i];
81
+ y = data[i + 1];
82
+ if (x < minX)
83
+ minX = x;
84
+ if (y < minY)
85
+ minY = y;
86
+ if (x > maxX)
87
+ maxX = x;
88
+ if (y > maxY)
89
+ maxY = y;
90
+ }
91
+ invSize = Math.max(maxX - minX, maxY - minY);
92
+ invSize = invSize !== 0 ? 1 / invSize : 0;
93
+ }
94
+ earcutLinked(outerNode, triangles, dim, minX, minY, invSize);
95
+ return triangles;
96
+ }
97
+ function linkedList(data, start, end, dim, clockwise, area2) {
98
+ let i;
99
+ let last;
100
+ if (area2 === void 0) {
101
+ area2 = getPolygonSignedArea(data, {
102
+ start,
103
+ end,
104
+ size: dim
105
+ });
106
+ }
107
+ if (clockwise === area2 < 0) {
108
+ for (i = start; i < end; i += dim)
109
+ last = insertNode(i, data[i], data[i + 1], last);
110
+ } else {
111
+ for (i = end - dim; i >= start; i -= dim)
112
+ last = insertNode(i, data[i], data[i + 1], last);
113
+ }
114
+ if (last && equals(last, last.next)) {
115
+ removeNode(last);
116
+ last = last.next;
117
+ }
118
+ return last;
119
+ }
120
+ function filterPoints(start, end) {
121
+ if (!start)
122
+ return start;
123
+ if (!end)
124
+ end = start;
125
+ let p = start;
126
+ let again;
127
+ do {
128
+ again = false;
129
+ if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {
130
+ removeNode(p);
131
+ p = end = p.prev;
132
+ if (p === p.next)
85
133
  break;
86
- case "Polygon":
87
- polygonFeaturesCount++;
88
- polygonObjectsCount++;
89
- polygonRingsCount += geometry.coordinates.length;
90
- polygonPositionsCount += flatten(geometry.coordinates).length;
91
- for (const coord of flatten(geometry.coordinates)) {
92
- coordLengths.add(coord.length);
134
+ again = true;
135
+ } else {
136
+ p = p.next;
137
+ }
138
+ } while (again || p !== end);
139
+ return end;
140
+ }
141
+ function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {
142
+ if (!ear)
143
+ return;
144
+ if (!pass && invSize)
145
+ indexCurve(ear, minX, minY, invSize);
146
+ let stop = ear;
147
+ let prev;
148
+ let next;
149
+ while (ear.prev !== ear.next) {
150
+ prev = ear.prev;
151
+ next = ear.next;
152
+ if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {
153
+ triangles.push(prev.i / dim);
154
+ triangles.push(ear.i / dim);
155
+ triangles.push(next.i / dim);
156
+ removeNode(ear);
157
+ ear = next.next;
158
+ stop = next.next;
159
+ continue;
160
+ }
161
+ ear = next;
162
+ if (ear === stop) {
163
+ if (!pass) {
164
+ earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);
165
+ } else if (pass === 1) {
166
+ ear = cureLocalIntersections(filterPoints(ear), triangles, dim);
167
+ earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);
168
+ } else if (pass === 2) {
169
+ splitEarcut(ear, triangles, dim, minX, minY, invSize);
170
+ }
171
+ break;
172
+ }
173
+ }
174
+ }
175
+ function isEar(ear) {
176
+ const a = ear.prev;
177
+ const b = ear;
178
+ const c = ear.next;
179
+ if (area(a, b, c) >= 0)
180
+ return false;
181
+ let p = ear.next.next;
182
+ while (p !== ear.prev) {
183
+ if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0)
184
+ return false;
185
+ p = p.next;
186
+ }
187
+ return true;
188
+ }
189
+ function isEarHashed(ear, minX, minY, invSize) {
190
+ const a = ear.prev;
191
+ const b = ear;
192
+ const c = ear.next;
193
+ if (area(a, b, c) >= 0)
194
+ return false;
195
+ const minTX = a.x < b.x ? a.x < c.x ? a.x : c.x : b.x < c.x ? b.x : c.x;
196
+ const minTY = a.y < b.y ? a.y < c.y ? a.y : c.y : b.y < c.y ? b.y : c.y;
197
+ const maxTX = a.x > b.x ? a.x > c.x ? a.x : c.x : b.x > c.x ? b.x : c.x;
198
+ const maxTY = a.y > b.y ? a.y > c.y ? a.y : c.y : b.y > c.y ? b.y : c.y;
199
+ const minZ = zOrder(minTX, minTY, minX, minY, invSize);
200
+ const maxZ = zOrder(maxTX, maxTY, minX, minY, invSize);
201
+ let p = ear.prevZ;
202
+ let n = ear.nextZ;
203
+ while (p && p.z >= minZ && n && n.z <= maxZ) {
204
+ if (p !== ear.prev && p !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0)
205
+ return false;
206
+ p = p.prevZ;
207
+ if (n !== ear.prev && n !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && area(n.prev, n, n.next) >= 0)
208
+ return false;
209
+ n = n.nextZ;
210
+ }
211
+ while (p && p.z >= minZ) {
212
+ if (p !== ear.prev && p !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0)
213
+ return false;
214
+ p = p.prevZ;
215
+ }
216
+ while (n && n.z <= maxZ) {
217
+ if (n !== ear.prev && n !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && area(n.prev, n, n.next) >= 0)
218
+ return false;
219
+ n = n.nextZ;
220
+ }
221
+ return true;
222
+ }
223
+ function cureLocalIntersections(start, triangles, dim) {
224
+ let p = start;
225
+ do {
226
+ const a = p.prev;
227
+ const b = p.next.next;
228
+ if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {
229
+ triangles.push(a.i / dim);
230
+ triangles.push(p.i / dim);
231
+ triangles.push(b.i / dim);
232
+ removeNode(p);
233
+ removeNode(p.next);
234
+ p = start = b;
235
+ }
236
+ p = p.next;
237
+ } while (p !== start);
238
+ return filterPoints(p);
239
+ }
240
+ function splitEarcut(start, triangles, dim, minX, minY, invSize) {
241
+ let a = start;
242
+ do {
243
+ let b = a.next.next;
244
+ while (b !== a.prev) {
245
+ if (a.i !== b.i && isValidDiagonal(a, b)) {
246
+ let c = splitPolygon(a, b);
247
+ a = filterPoints(a, a.next);
248
+ c = filterPoints(c, c.next);
249
+ earcutLinked(a, triangles, dim, minX, minY, invSize);
250
+ earcutLinked(c, triangles, dim, minX, minY, invSize);
251
+ return;
252
+ }
253
+ b = b.next;
254
+ }
255
+ a = a.next;
256
+ } while (a !== start);
257
+ }
258
+ function eliminateHoles(data, holeIndices, outerNode, dim, areas) {
259
+ const queue = [];
260
+ let i;
261
+ let len;
262
+ let start;
263
+ let end;
264
+ let list;
265
+ for (i = 0, len = holeIndices.length; i < len; i++) {
266
+ start = holeIndices[i] * dim;
267
+ end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;
268
+ list = linkedList(data, start, end, dim, false, areas && areas[i + 1]);
269
+ if (list === list.next)
270
+ list.steiner = true;
271
+ queue.push(getLeftmost(list));
272
+ }
273
+ queue.sort(compareX);
274
+ for (i = 0; i < queue.length; i++) {
275
+ eliminateHole(queue[i], outerNode);
276
+ outerNode = filterPoints(outerNode, outerNode.next);
277
+ }
278
+ return outerNode;
279
+ }
280
+ function compareX(a, b) {
281
+ return a.x - b.x;
282
+ }
283
+ function eliminateHole(hole, outerNode) {
284
+ outerNode = findHoleBridge(hole, outerNode);
285
+ if (outerNode) {
286
+ const b = splitPolygon(outerNode, hole);
287
+ filterPoints(outerNode, outerNode.next);
288
+ filterPoints(b, b.next);
289
+ }
290
+ }
291
+ function findHoleBridge(hole, outerNode) {
292
+ let p = outerNode;
293
+ const hx = hole.x;
294
+ const hy = hole.y;
295
+ let qx = -Infinity;
296
+ let m;
297
+ do {
298
+ if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {
299
+ const x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);
300
+ if (x <= hx && x > qx) {
301
+ qx = x;
302
+ if (x === hx) {
303
+ if (hy === p.y)
304
+ return p;
305
+ if (hy === p.next.y)
306
+ return p.next;
93
307
  }
94
- break;
95
- case "MultiPolygon":
96
- polygonFeaturesCount++;
97
- for (const polygon of geometry.coordinates) {
98
- polygonObjectsCount++;
99
- polygonRingsCount += polygon.length;
100
- polygonPositionsCount += flatten(polygon).length;
101
- for (const coord of flatten(polygon)) {
102
- coordLengths.add(coord.length);
103
- }
308
+ m = p.x < p.next.x ? p : p.next;
309
+ }
310
+ }
311
+ p = p.next;
312
+ } while (p !== outerNode);
313
+ if (!m)
314
+ return null;
315
+ if (hx === qx)
316
+ return m;
317
+ const stop = m;
318
+ const mx = m.x;
319
+ const my = m.y;
320
+ let tanMin = Infinity;
321
+ let tan;
322
+ p = m;
323
+ do {
324
+ if (hx >= p.x && p.x >= mx && hx !== p.x && pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {
325
+ tan = Math.abs(hy - p.y) / (hx - p.x);
326
+ if (locallyInside(p, hole) && (tan < tanMin || tan === tanMin && (p.x > m.x || p.x === m.x && sectorContainsSector(m, p)))) {
327
+ m = p;
328
+ tanMin = tan;
329
+ }
330
+ }
331
+ p = p.next;
332
+ } while (p !== stop);
333
+ return m;
334
+ }
335
+ function sectorContainsSector(m, p) {
336
+ return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;
337
+ }
338
+ function indexCurve(start, minX, minY, invSize) {
339
+ let p = start;
340
+ do {
341
+ if (p.z === null)
342
+ p.z = zOrder(p.x, p.y, minX, minY, invSize);
343
+ p.prevZ = p.prev;
344
+ p.nextZ = p.next;
345
+ p = p.next;
346
+ } while (p !== start);
347
+ p.prevZ.nextZ = null;
348
+ p.prevZ = null;
349
+ sortLinked(p);
350
+ }
351
+ function sortLinked(list) {
352
+ let e;
353
+ let i;
354
+ let inSize = 1;
355
+ let numMerges;
356
+ let p;
357
+ let pSize;
358
+ let q;
359
+ let qSize;
360
+ let tail;
361
+ do {
362
+ p = list;
363
+ list = null;
364
+ tail = null;
365
+ numMerges = 0;
366
+ while (p) {
367
+ numMerges++;
368
+ q = p;
369
+ pSize = 0;
370
+ for (i = 0; i < inSize; i++) {
371
+ pSize++;
372
+ q = q.nextZ;
373
+ if (!q)
374
+ break;
375
+ }
376
+ qSize = inSize;
377
+ while (pSize > 0 || qSize > 0 && q) {
378
+ if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {
379
+ e = p;
380
+ p = p.nextZ;
381
+ pSize--;
382
+ } else {
383
+ e = q;
384
+ q = q.nextZ;
385
+ qSize--;
104
386
  }
105
- break;
106
- default:
107
- throw new Error(`Unsupported geometry type: ${geometry.type}`);
387
+ if (tail)
388
+ tail.nextZ = e;
389
+ else
390
+ list = e;
391
+ e.prevZ = tail;
392
+ tail = e;
393
+ }
394
+ p = q;
108
395
  }
396
+ tail.nextZ = null;
397
+ inSize *= 2;
398
+ } while (numMerges > 1);
399
+ return list;
400
+ }
401
+ function zOrder(x, y, minX, minY, invSize) {
402
+ x = 32767 * (x - minX) * invSize;
403
+ y = 32767 * (y - minY) * invSize;
404
+ x = (x | x << 8) & 16711935;
405
+ x = (x | x << 4) & 252645135;
406
+ x = (x | x << 2) & 858993459;
407
+ x = (x | x << 1) & 1431655765;
408
+ y = (y | y << 8) & 16711935;
409
+ y = (y | y << 4) & 252645135;
410
+ y = (y | y << 2) & 858993459;
411
+ y = (y | y << 1) & 1431655765;
412
+ return x | y << 1;
413
+ }
414
+ function getLeftmost(start) {
415
+ let p = start;
416
+ let leftmost = start;
417
+ do {
418
+ if (p.x < leftmost.x || p.x === leftmost.x && p.y < leftmost.y)
419
+ leftmost = p;
420
+ p = p.next;
421
+ } while (p !== start);
422
+ return leftmost;
423
+ }
424
+ function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {
425
+ return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 && (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 && (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;
426
+ }
427
+ function isValidDiagonal(a, b) {
428
+ return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && (area(a.prev, a, b.prev) || area(a, b.prev, b)) || equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0);
429
+ }
430
+ function area(p, q, r) {
431
+ return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
432
+ }
433
+ function equals(p1, p2) {
434
+ return p1.x === p2.x && p1.y === p2.y;
435
+ }
436
+ function intersects(p1, q1, p2, q2) {
437
+ const o1 = sign(area(p1, q1, p2));
438
+ const o2 = sign(area(p1, q1, q2));
439
+ const o3 = sign(area(p2, q2, p1));
440
+ const o4 = sign(area(p2, q2, q1));
441
+ if (o1 !== o2 && o3 !== o4)
442
+ return true;
443
+ if (o1 === 0 && onSegment(p1, p2, q1))
444
+ return true;
445
+ if (o2 === 0 && onSegment(p1, q2, q1))
446
+ return true;
447
+ if (o3 === 0 && onSegment(p2, p1, q2))
448
+ return true;
449
+ if (o4 === 0 && onSegment(p2, q1, q2))
450
+ return true;
451
+ return false;
452
+ }
453
+ function onSegment(p, q, r) {
454
+ return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);
455
+ }
456
+ function sign(num) {
457
+ return num > 0 ? 1 : num < 0 ? -1 : 0;
458
+ }
459
+ function intersectsPolygon(a, b) {
460
+ let p = a;
461
+ do {
462
+ if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && intersects(p, p.next, a, b))
463
+ return true;
464
+ p = p.next;
465
+ } while (p !== a);
466
+ return false;
467
+ }
468
+ function locallyInside(a, b) {
469
+ return area(a.prev, a, a.next) < 0 ? area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;
470
+ }
471
+ function middleInside(a, b) {
472
+ let p = a;
473
+ let inside = false;
474
+ const px = (a.x + b.x) / 2;
475
+ const py = (a.y + b.y) / 2;
476
+ do {
477
+ if (p.y > py !== p.next.y > py && p.next.y !== p.y && px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x)
478
+ inside = !inside;
479
+ p = p.next;
480
+ } while (p !== a);
481
+ return inside;
482
+ }
483
+ function splitPolygon(a, b) {
484
+ const a2 = new Node(a.i, a.x, a.y);
485
+ const b2 = new Node(b.i, b.x, b.y);
486
+ const an = a.next;
487
+ const bp = b.prev;
488
+ a.next = b;
489
+ b.prev = a;
490
+ a2.next = an;
491
+ an.prev = a2;
492
+ b2.next = a2;
493
+ a2.prev = b2;
494
+ bp.next = b2;
495
+ b2.prev = bp;
496
+ return b2;
497
+ }
498
+ function insertNode(i, x, y, last) {
499
+ const p = new Node(i, x, y);
500
+ if (!last) {
501
+ p.prev = p;
502
+ p.next = p;
503
+ } else {
504
+ p.next = last.next;
505
+ p.prev = last;
506
+ last.next.prev = p;
507
+ last.next = p;
508
+ }
509
+ return p;
510
+ }
511
+ function removeNode(p) {
512
+ p.next.prev = p.prev;
513
+ p.prev.next = p.next;
514
+ if (p.prevZ)
515
+ p.prevZ.nextZ = p.nextZ;
516
+ if (p.nextZ)
517
+ p.nextZ.prevZ = p.prevZ;
518
+ }
519
+ function Node(i, x, y) {
520
+ this.i = i;
521
+ this.x = x;
522
+ this.y = y;
523
+ this.prev = null;
524
+ this.next = null;
525
+ this.z = null;
526
+ this.prevZ = null;
527
+ this.nextZ = null;
528
+ this.steiner = false;
529
+ }
530
+ var init_earcut = __esm({
531
+ "../../node_modules/@math.gl/polygon/dist/esm/earcut.js"() {
532
+ init_polygon_utils();
533
+ }
534
+ });
535
+
536
+ // ../../node_modules/@math.gl/polygon/dist/esm/utils.js
537
+ var init_utils = __esm({
538
+ "../../node_modules/@math.gl/polygon/dist/esm/utils.js"() {
539
+ }
540
+ });
541
+
542
+ // ../../node_modules/@math.gl/polygon/dist/esm/lineclip.js
543
+ var init_lineclip = __esm({
544
+ "../../node_modules/@math.gl/polygon/dist/esm/lineclip.js"() {
545
+ init_utils();
546
+ }
547
+ });
548
+
549
+ // ../../node_modules/@math.gl/polygon/dist/esm/cut-by-grid.js
550
+ var init_cut_by_grid = __esm({
551
+ "../../node_modules/@math.gl/polygon/dist/esm/cut-by-grid.js"() {
552
+ init_lineclip();
553
+ init_utils();
554
+ }
555
+ });
556
+
557
+ // ../../node_modules/@math.gl/polygon/dist/esm/cut-by-mercator-bounds.js
558
+ var init_cut_by_mercator_bounds = __esm({
559
+ "../../node_modules/@math.gl/polygon/dist/esm/cut-by-mercator-bounds.js"() {
560
+ init_cut_by_grid();
561
+ init_utils();
562
+ }
563
+ });
564
+
565
+ // ../../node_modules/@math.gl/polygon/dist/esm/index.js
566
+ var init_esm = __esm({
567
+ "../../node_modules/@math.gl/polygon/dist/esm/index.js"() {
568
+ init_polygon();
569
+ init_polygon_utils();
570
+ init_earcut();
571
+ init_lineclip();
572
+ init_cut_by_grid();
573
+ init_cut_by_mercator_bounds();
574
+ init_polygon();
575
+ }
576
+ });
577
+
578
+ // ../gis/src/lib/flat-geojson-to-binary.ts
579
+ function flatGeojsonToBinary(features, geometryInfo, options) {
580
+ const propArrayTypes = extractNumericPropTypes(features);
581
+ const numericPropKeys = Object.keys(propArrayTypes).filter((k) => propArrayTypes[k] !== Array);
582
+ return fillArrays(features, {
583
+ propArrayTypes,
584
+ ...geometryInfo
585
+ }, {
586
+ numericPropKeys: options && options.numericPropKeys || numericPropKeys,
587
+ PositionDataType: options ? options.PositionDataType : Float32Array
588
+ });
589
+ }
590
+ function extractNumericPropTypes(features) {
591
+ const propArrayTypes = {};
592
+ for (const feature of features) {
109
593
  if (feature.properties) {
110
594
  for (const key in feature.properties) {
111
595
  const val = feature.properties[key];
112
- numericPropKeys[key] = numericPropKeys[key] || numericPropKeys[key] === void 0 ? isNumeric(val) : numericPropKeys[key];
596
+ propArrayTypes[key] = deduceArrayType(val, propArrayTypes[key]);
113
597
  }
114
598
  }
115
599
  }
116
- return {
117
- coordLength: coordLengths.size > 0 ? Math.max(...coordLengths) : 2,
118
- pointPositionsCount,
119
- pointFeaturesCount,
120
- linePositionsCount,
121
- linePathsCount,
122
- lineFeaturesCount,
123
- polygonPositionsCount,
124
- polygonObjectsCount,
125
- polygonRingsCount,
126
- polygonFeaturesCount,
127
- numericPropKeys: Object.keys(numericPropKeys).filter((k) => numericPropKeys[k])
128
- };
600
+ return propArrayTypes;
129
601
  }
130
- function secondPass(features, firstPassData, options) {
602
+ function fillArrays(features, geometryInfo, options) {
131
603
  const {
132
604
  pointPositionsCount,
133
605
  pointFeaturesCount,
@@ -137,40 +609,48 @@
137
609
  polygonPositionsCount,
138
610
  polygonObjectsCount,
139
611
  polygonRingsCount,
140
- polygonFeaturesCount
141
- } = firstPassData;
142
- const { coordLength, numericPropKeys, PositionDataType = Float32Array } = options;
612
+ polygonFeaturesCount,
613
+ propArrayTypes,
614
+ coordLength
615
+ } = geometryInfo;
616
+ const { numericPropKeys = [], PositionDataType = Float32Array } = options;
617
+ const hasGlobalId = features[0] && "id" in features[0];
143
618
  const GlobalFeatureIdsDataType = features.length > 65535 ? Uint32Array : Uint16Array;
144
619
  const points = {
620
+ type: "Point",
145
621
  positions: new PositionDataType(pointPositionsCount * coordLength),
146
622
  globalFeatureIds: new GlobalFeatureIdsDataType(pointPositionsCount),
147
623
  featureIds: pointFeaturesCount > 65535 ? new Uint32Array(pointPositionsCount) : new Uint16Array(pointPositionsCount),
148
624
  numericProps: {},
149
- properties: Array(),
150
- fields: Array()
625
+ properties: [],
626
+ fields: []
151
627
  };
152
628
  const lines = {
153
- positions: new PositionDataType(linePositionsCount * coordLength),
629
+ type: "LineString",
154
630
  pathIndices: linePositionsCount > 65535 ? new Uint32Array(linePathsCount + 1) : new Uint16Array(linePathsCount + 1),
631
+ positions: new PositionDataType(linePositionsCount * coordLength),
155
632
  globalFeatureIds: new GlobalFeatureIdsDataType(linePositionsCount),
156
633
  featureIds: lineFeaturesCount > 65535 ? new Uint32Array(linePositionsCount) : new Uint16Array(linePositionsCount),
157
634
  numericProps: {},
158
- properties: Array(),
159
- fields: Array()
635
+ properties: [],
636
+ fields: []
160
637
  };
161
638
  const polygons = {
162
- positions: new PositionDataType(polygonPositionsCount * coordLength),
639
+ type: "Polygon",
163
640
  polygonIndices: polygonPositionsCount > 65535 ? new Uint32Array(polygonObjectsCount + 1) : new Uint16Array(polygonObjectsCount + 1),
164
641
  primitivePolygonIndices: polygonPositionsCount > 65535 ? new Uint32Array(polygonRingsCount + 1) : new Uint16Array(polygonRingsCount + 1),
642
+ positions: new PositionDataType(polygonPositionsCount * coordLength),
643
+ triangles: [],
165
644
  globalFeatureIds: new GlobalFeatureIdsDataType(polygonPositionsCount),
166
645
  featureIds: polygonFeaturesCount > 65535 ? new Uint32Array(polygonPositionsCount) : new Uint16Array(polygonPositionsCount),
167
646
  numericProps: {},
168
- properties: Array(),
169
- fields: Array()
647
+ properties: [],
648
+ fields: []
170
649
  };
171
650
  for (const object of [points, lines, polygons]) {
172
- for (const propName of numericPropKeys || []) {
173
- object.numericProps[propName] = new Float32Array(object.positions.length / coordLength);
651
+ for (const propName of numericPropKeys) {
652
+ const T = propArrayTypes[propName];
653
+ object.numericProps[propName] = new T(object.positions.length / coordLength);
174
654
  }
175
655
  }
176
656
  lines.pathIndices[linePathsCount] = linePositionsCount;
@@ -193,33 +673,27 @@
193
673
  const properties = feature.properties || {};
194
674
  switch (geometry.type) {
195
675
  case "Point":
196
- handlePoint(geometry.coordinates, points, indexMap, coordLength, properties);
197
- points.properties.push(keepStringProperties(properties, numericPropKeys));
198
- indexMap.pointFeature++;
199
- break;
200
- case "MultiPoint":
201
- handleMultiPoint(geometry.coordinates, points, indexMap, coordLength, properties);
676
+ handlePoint(geometry, points, indexMap, coordLength, properties);
202
677
  points.properties.push(keepStringProperties(properties, numericPropKeys));
678
+ if (hasGlobalId) {
679
+ points.fields.push({ id: feature.id });
680
+ }
203
681
  indexMap.pointFeature++;
204
682
  break;
205
683
  case "LineString":
206
- handleLineString(geometry.coordinates, lines, indexMap, coordLength, properties);
207
- lines.properties.push(keepStringProperties(properties, numericPropKeys));
208
- indexMap.lineFeature++;
209
- break;
210
- case "MultiLineString":
211
- handleMultiLineString(geometry.coordinates, lines, indexMap, coordLength, properties);
684
+ handleLineString(geometry, lines, indexMap, coordLength, properties);
212
685
  lines.properties.push(keepStringProperties(properties, numericPropKeys));
686
+ if (hasGlobalId) {
687
+ lines.fields.push({ id: feature.id });
688
+ }
213
689
  indexMap.lineFeature++;
214
690
  break;
215
691
  case "Polygon":
216
- handlePolygon(geometry.coordinates, polygons, indexMap, coordLength, properties);
217
- polygons.properties.push(keepStringProperties(properties, numericPropKeys));
218
- indexMap.polygonFeature++;
219
- break;
220
- case "MultiPolygon":
221
- handleMultiPolygon(geometry.coordinates, polygons, indexMap, coordLength, properties);
692
+ handlePolygon(geometry, polygons, indexMap, coordLength, properties);
222
693
  polygons.properties.push(keepStringProperties(properties, numericPropKeys));
694
+ if (hasGlobalId) {
695
+ polygons.fields.push({ id: feature.id });
696
+ }
223
697
  indexMap.polygonFeature++;
224
698
  break;
225
699
  default:
@@ -229,93 +703,105 @@
229
703
  }
230
704
  return makeAccessorObjects(points, lines, polygons, coordLength);
231
705
  }
232
- function handlePoint(coords, points, indexMap, coordLength, properties) {
233
- points.positions.set(coords, indexMap.pointPosition * coordLength);
234
- points.globalFeatureIds[indexMap.pointPosition] = indexMap.feature;
235
- points.featureIds[indexMap.pointPosition] = indexMap.pointFeature;
236
- fillNumericProperties(points, properties, indexMap.pointPosition, 1);
237
- indexMap.pointPosition++;
238
- }
239
- function handleMultiPoint(coords, points, indexMap, coordLength, properties) {
240
- for (const point of coords) {
241
- handlePoint(point, points, indexMap, coordLength, properties);
242
- }
706
+ function handlePoint(geometry, points, indexMap, coordLength, properties) {
707
+ points.positions.set(geometry.data, indexMap.pointPosition * coordLength);
708
+ const nPositions = geometry.data.length / coordLength;
709
+ fillNumericProperties(points, properties, indexMap.pointPosition, nPositions);
710
+ points.globalFeatureIds.fill(indexMap.feature, indexMap.pointPosition, indexMap.pointPosition + nPositions);
711
+ points.featureIds.fill(indexMap.pointFeature, indexMap.pointPosition, indexMap.pointPosition + nPositions);
712
+ indexMap.pointPosition += nPositions;
243
713
  }
244
- function handleLineString(coords, lines, indexMap, coordLength, properties) {
245
- lines.pathIndices[indexMap.linePath] = indexMap.linePosition;
246
- indexMap.linePath++;
247
- fillCoords(lines.positions, coords, indexMap.linePosition, coordLength);
248
- const nPositions = coords.length;
714
+ function handleLineString(geometry, lines, indexMap, coordLength, properties) {
715
+ lines.positions.set(geometry.data, indexMap.linePosition * coordLength);
716
+ const nPositions = geometry.data.length / coordLength;
249
717
  fillNumericProperties(lines, properties, indexMap.linePosition, nPositions);
250
- lines.globalFeatureIds.set(new Uint32Array(nPositions).fill(indexMap.feature), indexMap.linePosition);
251
- lines.featureIds.set(new Uint32Array(nPositions).fill(indexMap.lineFeature), indexMap.linePosition);
252
- indexMap.linePosition += nPositions;
718
+ lines.globalFeatureIds.fill(indexMap.feature, indexMap.linePosition, indexMap.linePosition + nPositions);
719
+ lines.featureIds.fill(indexMap.lineFeature, indexMap.linePosition, indexMap.linePosition + nPositions);
720
+ for (let i = 0, il = geometry.indices.length; i < il; ++i) {
721
+ const start = geometry.indices[i];
722
+ const end = i === il - 1 ? geometry.data.length : geometry.indices[i + 1];
723
+ lines.pathIndices[indexMap.linePath++] = indexMap.linePosition;
724
+ indexMap.linePosition += (end - start) / coordLength;
725
+ }
253
726
  }
254
- function handleMultiLineString(coords, lines, indexMap, coordLength, properties) {
255
- for (const line of coords) {
256
- handleLineString(line, lines, indexMap, coordLength, properties);
727
+ function handlePolygon(geometry, polygons, indexMap, coordLength, properties) {
728
+ polygons.positions.set(geometry.data, indexMap.polygonPosition * coordLength);
729
+ const nPositions = geometry.data.length / coordLength;
730
+ fillNumericProperties(polygons, properties, indexMap.polygonPosition, nPositions);
731
+ polygons.globalFeatureIds.fill(indexMap.feature, indexMap.polygonPosition, indexMap.polygonPosition + nPositions);
732
+ polygons.featureIds.fill(indexMap.polygonFeature, indexMap.polygonPosition, indexMap.polygonPosition + nPositions);
733
+ for (let l = 0, ll = geometry.indices.length; l < ll; ++l) {
734
+ const startPosition = indexMap.polygonPosition;
735
+ polygons.polygonIndices[indexMap.polygonObject++] = startPosition;
736
+ const areas = geometry.areas[l];
737
+ const indices = geometry.indices[l];
738
+ const nextIndices = geometry.indices[l + 1];
739
+ for (let i = 0, il = indices.length; i < il; ++i) {
740
+ const start = indices[i];
741
+ const end = i === il - 1 ? nextIndices === void 0 ? geometry.data.length : nextIndices[0] : indices[i + 1];
742
+ polygons.primitivePolygonIndices[indexMap.polygonRing++] = indexMap.polygonPosition;
743
+ indexMap.polygonPosition += (end - start) / coordLength;
744
+ }
745
+ const endPosition = indexMap.polygonPosition;
746
+ triangulatePolygon(polygons, areas, indices, { startPosition, endPosition, coordLength });
257
747
  }
258
748
  }
259
- function handlePolygon(coords, polygons, indexMap, coordLength, properties) {
260
- polygons.polygonIndices[indexMap.polygonObject] = indexMap.polygonPosition;
261
- indexMap.polygonObject++;
262
- for (const ring of coords) {
263
- polygons.primitivePolygonIndices[indexMap.polygonRing] = indexMap.polygonPosition;
264
- indexMap.polygonRing++;
265
- fillCoords(polygons.positions, ring, indexMap.polygonPosition, coordLength);
266
- const nPositions = ring.length;
267
- fillNumericProperties(polygons, properties, indexMap.polygonPosition, nPositions);
268
- polygons.globalFeatureIds.set(new Uint32Array(nPositions).fill(indexMap.feature), indexMap.polygonPosition);
269
- polygons.featureIds.set(new Uint32Array(nPositions).fill(indexMap.polygonFeature), indexMap.polygonPosition);
270
- indexMap.polygonPosition += nPositions;
749
+ function triangulatePolygon(polygons, areas, indices, {
750
+ startPosition,
751
+ endPosition,
752
+ coordLength
753
+ }) {
754
+ const start = startPosition * coordLength;
755
+ const end = endPosition * coordLength;
756
+ const polygonPositions = polygons.positions.subarray(start, end);
757
+ const offset = indices[0];
758
+ const holes = indices.slice(1).map((n) => (n - offset) / coordLength);
759
+ const triangles = earcut(polygonPositions, holes, coordLength, areas);
760
+ for (let t = 0, tl = triangles.length; t < tl; ++t) {
761
+ polygons.triangles.push(startPosition + triangles[t]);
271
762
  }
272
763
  }
273
- function handleMultiPolygon(coords, polygons, indexMap, coordLength, properties) {
274
- for (const polygon of coords) {
275
- handlePolygon(polygon, polygons, indexMap, coordLength, properties);
764
+ function wrapProps(obj, size) {
765
+ const returnObj = {};
766
+ for (const key in obj) {
767
+ returnObj[key] = { value: obj[key], size };
276
768
  }
769
+ return returnObj;
277
770
  }
278
771
  function makeAccessorObjects(points, lines, polygons, coordLength) {
279
- const returnObj = {
772
+ return {
280
773
  points: {
281
774
  ...points,
282
775
  positions: { value: points.positions, size: coordLength },
283
776
  globalFeatureIds: { value: points.globalFeatureIds, size: 1 },
284
777
  featureIds: { value: points.featureIds, size: 1 },
285
- type: "Point"
778
+ numericProps: wrapProps(points.numericProps, 1)
286
779
  },
287
780
  lines: {
288
781
  ...lines,
289
- pathIndices: { value: lines.pathIndices, size: 1 },
290
782
  positions: { value: lines.positions, size: coordLength },
783
+ pathIndices: { value: lines.pathIndices, size: 1 },
291
784
  globalFeatureIds: { value: lines.globalFeatureIds, size: 1 },
292
785
  featureIds: { value: lines.featureIds, size: 1 },
293
- type: "LineString"
786
+ numericProps: wrapProps(lines.numericProps, 1)
294
787
  },
295
788
  polygons: {
296
789
  ...polygons,
790
+ positions: { value: polygons.positions, size: coordLength },
297
791
  polygonIndices: { value: polygons.polygonIndices, size: 1 },
298
792
  primitivePolygonIndices: { value: polygons.primitivePolygonIndices, size: 1 },
299
- positions: { value: polygons.positions, size: coordLength },
793
+ triangles: { value: new Uint32Array(polygons.triangles), size: 1 },
300
794
  globalFeatureIds: { value: polygons.globalFeatureIds, size: 1 },
301
795
  featureIds: { value: polygons.featureIds, size: 1 },
302
- type: "Polygon"
796
+ numericProps: wrapProps(polygons.numericProps, 1)
303
797
  }
304
798
  };
305
- for (const geomType in returnObj) {
306
- for (const numericProp in returnObj[geomType].numericProps) {
307
- returnObj[geomType].numericProps[numericProp] = {
308
- value: returnObj[geomType].numericProps[numericProp],
309
- size: 1
310
- };
311
- }
312
- }
313
- return returnObj;
314
799
  }
315
800
  function fillNumericProperties(object, properties, index, length) {
316
801
  for (const numericPropName in object.numericProps) {
317
802
  if (numericPropName in properties) {
318
- object.numericProps[numericPropName].set(new Array(length).fill(properties[numericPropName]), index);
803
+ const value = properties[numericPropName];
804
+ object.numericProps[numericPropName].fill(value, index, index + length);
319
805
  }
320
806
  }
321
807
  }
@@ -328,21 +814,211 @@
328
814
  }
329
815
  return props;
330
816
  }
331
- function fillCoords(array, coords, startVertex, coordLength) {
332
- let index = startVertex * coordLength;
333
- for (const coord of coords) {
334
- array.set(coord, index);
335
- index += coordLength;
817
+ function deduceArrayType(x, constructor) {
818
+ if (constructor === Array || !Number.isFinite(x)) {
819
+ return Array;
820
+ }
821
+ return constructor === Float64Array || Math.fround(x) !== x ? Float64Array : Float32Array;
822
+ }
823
+ var init_flat_geojson_to_binary = __esm({
824
+ "../gis/src/lib/flat-geojson-to-binary.ts"() {
825
+ init_esm();
826
+ }
827
+ });
828
+
829
+ // ../gis/src/lib/extract-geometry-info.ts
830
+ function extractGeometryInfo(features) {
831
+ let pointPositionsCount = 0;
832
+ let pointFeaturesCount = 0;
833
+ let linePositionsCount = 0;
834
+ let linePathsCount = 0;
835
+ let lineFeaturesCount = 0;
836
+ let polygonPositionsCount = 0;
837
+ let polygonObjectsCount = 0;
838
+ let polygonRingsCount = 0;
839
+ let polygonFeaturesCount = 0;
840
+ const coordLengths = new Set();
841
+ for (const feature of features) {
842
+ const geometry = feature.geometry;
843
+ switch (geometry.type) {
844
+ case "Point":
845
+ pointFeaturesCount++;
846
+ pointPositionsCount++;
847
+ coordLengths.add(geometry.coordinates.length);
848
+ break;
849
+ case "MultiPoint":
850
+ pointFeaturesCount++;
851
+ pointPositionsCount += geometry.coordinates.length;
852
+ for (const point of geometry.coordinates) {
853
+ coordLengths.add(point.length);
854
+ }
855
+ break;
856
+ case "LineString":
857
+ lineFeaturesCount++;
858
+ linePositionsCount += geometry.coordinates.length;
859
+ linePathsCount++;
860
+ for (const coord of geometry.coordinates) {
861
+ coordLengths.add(coord.length);
862
+ }
863
+ break;
864
+ case "MultiLineString":
865
+ lineFeaturesCount++;
866
+ for (const line of geometry.coordinates) {
867
+ linePositionsCount += line.length;
868
+ linePathsCount++;
869
+ for (const coord of line) {
870
+ coordLengths.add(coord.length);
871
+ }
872
+ }
873
+ break;
874
+ case "Polygon":
875
+ polygonFeaturesCount++;
876
+ polygonObjectsCount++;
877
+ polygonRingsCount += geometry.coordinates.length;
878
+ const flattened = geometry.coordinates.flat();
879
+ polygonPositionsCount += flattened.length;
880
+ for (const coord of flattened) {
881
+ coordLengths.add(coord.length);
882
+ }
883
+ break;
884
+ case "MultiPolygon":
885
+ polygonFeaturesCount++;
886
+ for (const polygon of geometry.coordinates) {
887
+ polygonObjectsCount++;
888
+ polygonRingsCount += polygon.length;
889
+ const flattened2 = polygon.flat();
890
+ polygonPositionsCount += flattened2.length;
891
+ for (const coord of flattened2) {
892
+ coordLengths.add(coord.length);
893
+ }
894
+ }
895
+ break;
896
+ default:
897
+ throw new Error(`Unsupported geometry type: ${geometry.type}`);
898
+ }
899
+ }
900
+ return {
901
+ coordLength: coordLengths.size > 0 ? Math.max(...coordLengths) : 2,
902
+ pointPositionsCount,
903
+ pointFeaturesCount,
904
+ linePositionsCount,
905
+ linePathsCount,
906
+ lineFeaturesCount,
907
+ polygonPositionsCount,
908
+ polygonObjectsCount,
909
+ polygonRingsCount,
910
+ polygonFeaturesCount
911
+ };
912
+ }
913
+ var init_extract_geometry_info = __esm({
914
+ "../gis/src/lib/extract-geometry-info.ts"() {
336
915
  }
916
+ });
917
+
918
+ // ../gis/src/lib/geojson-to-flat-geojson.ts
919
+ function geojsonToFlatGeojson(features, options = { coordLength: 2, fixRingWinding: true }) {
920
+ return features.map((feature) => flattenFeature(feature, options));
337
921
  }
338
- function flatten(arrays) {
339
- return [].concat(...arrays);
922
+ function flattenPoint(coordinates, data, indices, options) {
923
+ indices.push(data.length);
924
+ data.push(...coordinates);
925
+ for (let i = coordinates.length; i < options.coordLength; i++) {
926
+ data.push(0);
927
+ }
928
+ }
929
+ function flattenLineString(coordinates, data, indices, options) {
930
+ indices.push(data.length);
931
+ for (const c of coordinates) {
932
+ data.push(...c);
933
+ for (let i = c.length; i < options.coordLength; i++) {
934
+ data.push(0);
935
+ }
936
+ }
937
+ }
938
+ function flattenPolygon(coordinates, data, indices, areas, options) {
939
+ let count = 0;
940
+ const ringAreas = [];
941
+ const polygons = [];
942
+ for (const lineString of coordinates) {
943
+ const lineString2d = lineString.map((p) => p.slice(0, 2));
944
+ let area2 = getPolygonSignedArea(lineString2d.flat());
945
+ const ccw = area2 < 0;
946
+ if (options.fixRingWinding && (count === 0 && !ccw || count > 0 && ccw)) {
947
+ lineString.reverse();
948
+ area2 = -area2;
949
+ }
950
+ ringAreas.push(area2);
951
+ flattenLineString(lineString, data, polygons, options);
952
+ count++;
953
+ }
954
+ if (count > 0) {
955
+ areas.push(ringAreas);
956
+ indices.push(polygons);
957
+ }
958
+ }
959
+ function flattenFeature(feature, options) {
960
+ const { geometry } = feature;
961
+ if (geometry.type === "GeometryCollection") {
962
+ throw new Error("GeometryCollection type not supported");
963
+ }
964
+ const data = [];
965
+ const indices = [];
966
+ let areas;
967
+ let type;
968
+ switch (geometry.type) {
969
+ case "Point":
970
+ type = "Point";
971
+ flattenPoint(geometry.coordinates, data, indices, options);
972
+ break;
973
+ case "MultiPoint":
974
+ type = "Point";
975
+ geometry.coordinates.map((c) => flattenPoint(c, data, indices, options));
976
+ break;
977
+ case "LineString":
978
+ type = "LineString";
979
+ flattenLineString(geometry.coordinates, data, indices, options);
980
+ break;
981
+ case "MultiLineString":
982
+ type = "LineString";
983
+ geometry.coordinates.map((c) => flattenLineString(c, data, indices, options));
984
+ break;
985
+ case "Polygon":
986
+ type = "Polygon";
987
+ areas = [];
988
+ flattenPolygon(geometry.coordinates, data, indices, areas, options);
989
+ break;
990
+ case "MultiPolygon":
991
+ type = "Polygon";
992
+ areas = [];
993
+ geometry.coordinates.map((c) => flattenPolygon(c, data, indices, areas, options));
994
+ break;
995
+ default:
996
+ throw new Error(`Unknown type: ${type}`);
997
+ }
998
+ return { ...feature, geometry: { type, indices, data, areas } };
340
999
  }
341
- function isNumeric(x) {
342
- return Number.isFinite(x);
1000
+ var init_geojson_to_flat_geojson = __esm({
1001
+ "../gis/src/lib/geojson-to-flat-geojson.ts"() {
1002
+ init_esm();
1003
+ }
1004
+ });
1005
+
1006
+ // ../gis/src/lib/geojson-to-binary.ts
1007
+ function geojsonToBinary(features, options = { fixRingWinding: true }) {
1008
+ const geometryInfo = extractGeometryInfo(features);
1009
+ const coordLength = geometryInfo.coordLength;
1010
+ const { fixRingWinding } = options;
1011
+ const flatFeatures = geojsonToFlatGeojson(features, { coordLength, fixRingWinding });
1012
+ return flatGeojsonToBinary(flatFeatures, geometryInfo, {
1013
+ numericPropKeys: options.numericPropKeys,
1014
+ PositionDataType: options.PositionDataType || Float32Array
1015
+ });
343
1016
  }
344
1017
  var init_geojson_to_binary = __esm({
345
1018
  "../gis/src/lib/geojson-to-binary.ts"() {
1019
+ init_extract_geometry_info();
1020
+ init_geojson_to_flat_geojson();
1021
+ init_flat_geojson_to_binary();
346
1022
  }
347
1023
  });
348
1024