@loaders.gl/geospatial 5.0.0-beta.2 → 5.0.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/WKT-README.md +1 -1
- package/dist/dbf-loader-types.cjs +1 -1
- package/dist/dbf-worker.js +776 -153
- package/dist/flatgeobuf/flatgeobuf-loader-types.cjs +1 -1
- package/dist/flatgeobuf/flatgeobuf-loader-types.js +1 -1
- package/dist/flatgeobuf/flatgeobuf-source-loader.cjs +1 -1
- package/dist/flatgeobuf/flatgeobuf-source-loader.js +1 -1
- package/dist/flatgeobuf-loader-types.cjs +1 -1
- package/dist/flatgeobuf-source-loader.cjs +1 -1
- package/dist/flatgeobuf-worker.js +1238 -584
- package/dist/geopackage/geopackage-source-loader.cjs +1 -1
- package/dist/geopackage/geopackage-source-loader.js +1 -1
- package/dist/geopackage-source-loader.cjs +1 -1
- package/dist/gpx-loader-types.cjs +1 -1
- package/dist/kml/gpx-loader-types.cjs +1 -1
- package/dist/kml/gpx-loader-types.js +1 -1
- package/dist/kml/kml-loader-types.cjs +1 -1
- package/dist/kml/kml-loader-types.js +1 -1
- package/dist/kml/kml-writer.cjs +1 -1
- package/dist/kml/kml-writer.js +1 -1
- package/dist/kml/kmz-loader-types.cjs +1 -1
- package/dist/kml/kmz-loader-types.js +1 -1
- package/dist/kml/kmz-source.cjs +1 -1
- package/dist/kml/kmz-source.js +1 -1
- package/dist/kml/tcx-loader-types.cjs +1 -1
- package/dist/kml/tcx-loader-types.js +1 -1
- package/dist/kml-loader-types.cjs +1 -1
- package/dist/kml-writer.cjs +1 -1
- package/dist/kmz-loader-types.cjs +1 -1
- package/dist/kmz-source.cjs +1 -1
- package/dist/shapefile/dbf-loader-types.cjs +1 -1
- package/dist/shapefile/dbf-loader-types.js +1 -1
- package/dist/shapefile/dbf-loader.d.ts +1 -1
- package/dist/shapefile/lib/shapefile-worker-transport.cjs +3 -3
- package/dist/shapefile/lib/shapefile-worker-transport.cjs.map +2 -2
- package/dist/shapefile/lib/shapefile-worker-transport.js +1 -1
- package/dist/shapefile/lib/shapefile-worker-transport.js.map +1 -1
- package/dist/shapefile/shapefile-loader-types.cjs +1 -1
- package/dist/shapefile/shapefile-loader-types.js +1 -1
- package/dist/shapefile/shp-loader-types.cjs +1 -1
- package/dist/shapefile/shp-loader-types.js +1 -1
- package/dist/shapefile/shp-loader.d.ts +1 -1
- package/dist/shapefile-loader-types.cjs +1 -1
- package/dist/shapefile-worker.js +3099 -2400
- package/dist/shp-loader-types.cjs +1 -1
- package/dist/shp-worker.js +2811 -2216
- package/dist/tcx-loader-types.cjs +1 -1
- package/dist/wkt/lib/version.cjs +1 -1
- package/dist/wkt/lib/version.js +1 -1
- package/dist/wkt/wkt-format.cjs +2 -2
- package/dist/wkt/wkt-format.cjs.map +2 -2
- package/dist/wkt/wkt-format.js +1 -1
- package/dist/wkt/wkt-format.js.map +1 -1
- package/dist/wkt-worker.js +582 -75
- package/package.json +6 -5
- package/src/shapefile/lib/shapefile-worker-transport.ts +1 -1
- package/src/wkt/wkt-format.ts +1 -1
|
@@ -15,15 +15,15 @@
|
|
|
15
15
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
// ../../node_modules/@math.gl/
|
|
18
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/node/worker_threads-browser.js
|
|
19
19
|
var parentPort;
|
|
20
20
|
var init_worker_threads_browser = __esm({
|
|
21
|
-
"../../node_modules/@math.gl/
|
|
22
|
-
parentPort = null;
|
|
21
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/node/worker_threads-browser.js"() {
|
|
22
|
+
parentPort = globalThis.process?.getBuiltinModule?.("node:worker_threads")?.parentPort ?? null;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
// ../../node_modules/@math.gl/
|
|
26
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-utils/get-transfer-list.js
|
|
27
27
|
function getTransferList(object2, recursive = true, transfers) {
|
|
28
28
|
const transfersSet = transfers || /* @__PURE__ */ new Set();
|
|
29
29
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -36,6 +36,9 @@
|
|
|
36
36
|
else if (ArrayBuffer.isView(value2)) {
|
|
37
37
|
if (isTransferable(value2.buffer))
|
|
38
38
|
transfersSet.add(value2.buffer);
|
|
39
|
+
} else if (recursive && typeof MessageChannel !== "undefined" && value2 instanceof MessageChannel) {
|
|
40
|
+
visit(value2.port1);
|
|
41
|
+
visit(value2.port2);
|
|
39
42
|
} else if (recursive && value2 instanceof Map) {
|
|
40
43
|
for (const [key2, item] of value2) {
|
|
41
44
|
visit(key2);
|
|
@@ -71,11 +74,11 @@
|
|
|
71
74
|
return false;
|
|
72
75
|
}
|
|
73
76
|
var init_get_transfer_list = __esm({
|
|
74
|
-
"../../node_modules/@math.gl/
|
|
77
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-utils/get-transfer-list.js"() {
|
|
75
78
|
}
|
|
76
79
|
});
|
|
77
80
|
|
|
78
|
-
// ../../node_modules/@math.gl/
|
|
81
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-farm/worker-body.js
|
|
79
82
|
async function getParentPort() {
|
|
80
83
|
return parentPort;
|
|
81
84
|
}
|
|
@@ -88,7 +91,7 @@
|
|
|
88
91
|
}
|
|
89
92
|
var onMessageWrapperMap, WorkerBody;
|
|
90
93
|
var init_worker_body = __esm({
|
|
91
|
-
"../../node_modules/@math.gl/
|
|
94
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-farm/worker-body.js"() {
|
|
92
95
|
init_get_transfer_list();
|
|
93
96
|
init_worker_threads_browser();
|
|
94
97
|
onMessageWrapperMap = /* @__PURE__ */ new Map();
|
|
@@ -103,16 +106,16 @@
|
|
|
103
106
|
*/
|
|
104
107
|
static set onmessage(onMessage) {
|
|
105
108
|
async function handleMessage(message) {
|
|
106
|
-
const
|
|
107
|
-
const { type, payload } =
|
|
109
|
+
const parentPort3 = await getParentPort();
|
|
110
|
+
const { type, payload } = parentPort3 ? message : message.data;
|
|
108
111
|
onMessage(type, payload);
|
|
109
112
|
}
|
|
110
|
-
getParentPort().then((
|
|
111
|
-
if (
|
|
112
|
-
|
|
113
|
+
getParentPort().then((parentPort3) => {
|
|
114
|
+
if (parentPort3) {
|
|
115
|
+
parentPort3.on("message", (message) => {
|
|
113
116
|
handleMessage(message);
|
|
114
117
|
});
|
|
115
|
-
|
|
118
|
+
parentPort3.on("exit", () => console.debug("Node worker closing"));
|
|
116
119
|
} else {
|
|
117
120
|
globalThis.onmessage = handleMessage;
|
|
118
121
|
}
|
|
@@ -130,9 +133,9 @@
|
|
|
130
133
|
};
|
|
131
134
|
onMessageWrapperMap.set(onMessage, onMessageWrapper);
|
|
132
135
|
}
|
|
133
|
-
const
|
|
134
|
-
if (
|
|
135
|
-
|
|
136
|
+
const parentPort3 = await getParentPort();
|
|
137
|
+
if (parentPort3) {
|
|
138
|
+
parentPort3.on("message", onMessageWrapper);
|
|
136
139
|
} else {
|
|
137
140
|
globalThis.addEventListener("message", onMessageWrapper);
|
|
138
141
|
}
|
|
@@ -143,9 +146,9 @@
|
|
|
143
146
|
if (!onMessageWrapper) {
|
|
144
147
|
return;
|
|
145
148
|
}
|
|
146
|
-
const
|
|
147
|
-
if (
|
|
148
|
-
|
|
149
|
+
const parentPort3 = await getParentPort();
|
|
150
|
+
if (parentPort3) {
|
|
151
|
+
parentPort3.off("message", onMessageWrapper);
|
|
149
152
|
} else {
|
|
150
153
|
globalThis.removeEventListener("message", onMessageWrapper);
|
|
151
154
|
}
|
|
@@ -155,12 +158,12 @@
|
|
|
155
158
|
* @param type
|
|
156
159
|
* @param payload
|
|
157
160
|
*/
|
|
158
|
-
static async postMessage(type, payload) {
|
|
161
|
+
static async postMessage(type, payload, copy = false) {
|
|
159
162
|
const data = { source: "loaders.gl", type, payload };
|
|
160
|
-
const transferList = getTransferList(payload);
|
|
161
|
-
const
|
|
162
|
-
if (
|
|
163
|
-
|
|
163
|
+
const transferList = copy ? [] : getTransferList(payload);
|
|
164
|
+
const parentPort3 = await getParentPort();
|
|
165
|
+
if (parentPort3) {
|
|
166
|
+
parentPort3.postMessage(data, transferList);
|
|
164
167
|
} else {
|
|
165
168
|
globalThis.postMessage(data, transferList);
|
|
166
169
|
}
|
|
@@ -169,10 +172,10 @@
|
|
|
169
172
|
}
|
|
170
173
|
});
|
|
171
174
|
|
|
172
|
-
// ../../node_modules/@math.gl/
|
|
175
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/async-queue/async-queue.js
|
|
173
176
|
var AsyncQueue;
|
|
174
177
|
var init_async_queue = __esm({
|
|
175
|
-
"../../node_modules/@math.gl/
|
|
178
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/async-queue/async-queue.js"() {
|
|
176
179
|
AsyncQueue = class {
|
|
177
180
|
constructor() {
|
|
178
181
|
this._values = [];
|
|
@@ -241,10 +244,10 @@
|
|
|
241
244
|
}
|
|
242
245
|
});
|
|
243
246
|
|
|
244
|
-
// ../../node_modules/@math.gl/
|
|
247
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/shared-state.js
|
|
245
248
|
var SharedWorkerState;
|
|
246
249
|
var init_shared_state = __esm({
|
|
247
|
-
"../../node_modules/@math.gl/
|
|
250
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/shared-state.js"() {
|
|
248
251
|
SharedWorkerState = class {
|
|
249
252
|
constructor(buffer) {
|
|
250
253
|
if (typeof SharedArrayBuffer === "undefined" || !(buffer instanceof SharedArrayBuffer) || buffer.byteLength !== 16)
|
|
@@ -285,8 +288,19 @@
|
|
|
285
288
|
}
|
|
286
289
|
});
|
|
287
290
|
|
|
288
|
-
// ../../node_modules/@math.gl/
|
|
289
|
-
|
|
291
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/validate-output-ownership.js
|
|
292
|
+
function validateOutputOwnership(ownership) {
|
|
293
|
+
if (ownership !== void 0 && ownership !== "copy" && ownership !== "transfer") {
|
|
294
|
+
throw new Error("Invalid worker output ownership");
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
var init_validate_output_ownership = __esm({
|
|
298
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/validate-output-ownership.js"() {
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/create-worker.js
|
|
303
|
+
async function createWorker(process2, processInBatches, preload2) {
|
|
290
304
|
if (!await WorkerBody.inWorkerThread()) {
|
|
291
305
|
return;
|
|
292
306
|
}
|
|
@@ -327,23 +341,26 @@
|
|
|
327
341
|
}
|
|
328
342
|
switch (type) {
|
|
329
343
|
case "preload":
|
|
344
|
+
await preload2?.();
|
|
330
345
|
WorkerBody.postMessage("done", {});
|
|
331
346
|
break;
|
|
332
347
|
case "process":
|
|
333
348
|
throwIfAborted();
|
|
334
|
-
|
|
349
|
+
validateOutputOwnership(payload.options?.["outputOwnership"]);
|
|
350
|
+
if (!process2) {
|
|
335
351
|
throw new Error("Worker does not support atomic processing");
|
|
336
352
|
}
|
|
337
|
-
const result = await
|
|
353
|
+
const result = await process2(payload.input, payload.options || {}, jobContext, payload.context || {});
|
|
338
354
|
throwIfAborted();
|
|
339
355
|
reporter?.finish();
|
|
340
356
|
await WorkerBody.postMessage("done", {
|
|
341
357
|
result,
|
|
342
358
|
executionMs: performance.now() - startedAt
|
|
343
|
-
});
|
|
359
|
+
}, payload.options?.["outputOwnership"] === "copy");
|
|
344
360
|
break;
|
|
345
361
|
case "process-in-batches":
|
|
346
362
|
throwIfAborted();
|
|
363
|
+
validateOutputOwnership(payload.options?.["outputOwnership"]);
|
|
347
364
|
if (!processInBatches) {
|
|
348
365
|
throw new Error("Worker does not support batched processing");
|
|
349
366
|
}
|
|
@@ -355,7 +372,7 @@
|
|
|
355
372
|
const resultIterator = processInBatches(createDemandDrivenIterator(inputBatches), payload.options || {}, jobContext, payload.context || {});
|
|
356
373
|
for await (const batch of resultIterator) {
|
|
357
374
|
throwIfAborted();
|
|
358
|
-
await WorkerBody.postMessage("output-batch", { result: batch });
|
|
375
|
+
await WorkerBody.postMessage("output-batch", { result: batch }, payload.options?.["outputOwnership"] === "copy");
|
|
359
376
|
await outputAcknowledgements.next();
|
|
360
377
|
}
|
|
361
378
|
throwIfAborted();
|
|
@@ -453,14 +470,14 @@
|
|
|
453
470
|
});
|
|
454
471
|
}
|
|
455
472
|
function createProgressReporter() {
|
|
456
|
-
let
|
|
473
|
+
let pending2;
|
|
457
474
|
let finished = false;
|
|
458
475
|
let scheduled = false;
|
|
459
476
|
const flush = () => {
|
|
460
477
|
scheduled = false;
|
|
461
|
-
if (
|
|
462
|
-
WorkerBody.postMessage("progress", { progress:
|
|
463
|
-
|
|
478
|
+
if (pending2) {
|
|
479
|
+
WorkerBody.postMessage("progress", { progress: pending2 });
|
|
480
|
+
pending2 = void 0;
|
|
464
481
|
}
|
|
465
482
|
};
|
|
466
483
|
return {
|
|
@@ -468,9 +485,9 @@
|
|
|
468
485
|
report(progress) {
|
|
469
486
|
if (finished)
|
|
470
487
|
return;
|
|
471
|
-
if (
|
|
488
|
+
if (pending2 && pending2.phase !== progress.phase)
|
|
472
489
|
flush();
|
|
473
|
-
|
|
490
|
+
pending2 = { ...progress };
|
|
474
491
|
if (!scheduled) {
|
|
475
492
|
scheduled = true;
|
|
476
493
|
setTimeout(flush, 0);
|
|
@@ -479,7 +496,7 @@
|
|
|
479
496
|
/** Flushes final progress and suppresses reports from stale callbacks. */
|
|
480
497
|
finish(discard = false) {
|
|
481
498
|
if (discard)
|
|
482
|
-
|
|
499
|
+
pending2 = void 0;
|
|
483
500
|
flush();
|
|
484
501
|
finished = true;
|
|
485
502
|
}
|
|
@@ -487,10 +504,11 @@
|
|
|
487
504
|
}
|
|
488
505
|
var requestId, activeController, activeInputBatches, activeOutputAcknowledgements;
|
|
489
506
|
var init_create_worker = __esm({
|
|
490
|
-
"../../node_modules/@math.gl/
|
|
507
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/create-worker.js"() {
|
|
491
508
|
init_shared_state();
|
|
492
509
|
init_async_queue();
|
|
493
510
|
init_worker_body();
|
|
511
|
+
init_validate_output_ownership();
|
|
494
512
|
requestId = 0;
|
|
495
513
|
activeController = null;
|
|
496
514
|
activeInputBatches = null;
|
|
@@ -498,29 +516,589 @@
|
|
|
498
516
|
}
|
|
499
517
|
});
|
|
500
518
|
|
|
501
|
-
// ../../node_modules/@math.gl/
|
|
519
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/index.js
|
|
502
520
|
var import_meta, path, moduleUrl;
|
|
503
521
|
var init_worker_utils = __esm({
|
|
504
|
-
"../../node_modules/@math.gl/
|
|
522
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/index.js"() {
|
|
523
|
+
init_worker_body();
|
|
505
524
|
init_create_worker();
|
|
525
|
+
init_get_transfer_list();
|
|
506
526
|
import_meta = {};
|
|
507
527
|
path = typeof __filename === "string" ? __filename.replace(/\\/g, "/") : "";
|
|
508
528
|
moduleUrl = path ? `file://${path.startsWith("/") ? "" : "/"}${encodeURI(path).replace(/#/g, "%23").replace(/\?/g, "%3F")}` : import_meta.url;
|
|
509
529
|
}
|
|
510
530
|
});
|
|
511
531
|
|
|
512
|
-
// ../../node_modules/@math.gl/
|
|
513
|
-
|
|
514
|
-
|
|
532
|
+
// ../../node_modules/@math.gl/tasks/dist/tasks/task-preload.js
|
|
533
|
+
function preloadTaskCode(task, signal) {
|
|
534
|
+
if (!task.preload)
|
|
535
|
+
return Promise.resolve();
|
|
536
|
+
let promise = pending.get(task);
|
|
537
|
+
if (!promise) {
|
|
538
|
+
promise = Promise.resolve().then(() => task.preload()).then(() => {
|
|
539
|
+
loaded.add(task);
|
|
540
|
+
});
|
|
541
|
+
pending.set(task, promise);
|
|
542
|
+
void promise.catch(() => pending.delete(task));
|
|
543
|
+
}
|
|
544
|
+
return withSignal(promise, signal);
|
|
545
|
+
}
|
|
546
|
+
function withSignal(operation2, signal) {
|
|
547
|
+
if (!signal)
|
|
548
|
+
return operation2;
|
|
549
|
+
return new Promise((resolve, reject) => {
|
|
550
|
+
const abort = () => {
|
|
551
|
+
signal.removeEventListener("abort", abort);
|
|
552
|
+
reject(signal.reason);
|
|
553
|
+
};
|
|
554
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
555
|
+
if (signal.aborted)
|
|
556
|
+
abort();
|
|
557
|
+
operation2.then((value2) => {
|
|
558
|
+
signal.removeEventListener("abort", abort);
|
|
559
|
+
resolve(value2);
|
|
560
|
+
}, (error) => {
|
|
561
|
+
signal.removeEventListener("abort", abort);
|
|
562
|
+
reject(error);
|
|
563
|
+
});
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
var pending, loaded;
|
|
567
|
+
var init_task_preload = __esm({
|
|
568
|
+
"../../node_modules/@math.gl/tasks/dist/tasks/task-preload.js"() {
|
|
569
|
+
pending = /* @__PURE__ */ new WeakMap();
|
|
570
|
+
loaded = /* @__PURE__ */ new WeakSet();
|
|
571
|
+
}
|
|
572
|
+
});
|
|
573
|
+
|
|
574
|
+
// ../../node_modules/@math.gl/tasks/dist/tasks/task-channel.js
|
|
575
|
+
var TaskRequestError, TaskChannel;
|
|
576
|
+
var init_task_channel = __esm({
|
|
577
|
+
"../../node_modules/@math.gl/tasks/dist/tasks/task-channel.js"() {
|
|
578
|
+
TaskRequestError = class extends Error {
|
|
579
|
+
};
|
|
580
|
+
TaskChannel = class {
|
|
581
|
+
constructor(options) {
|
|
582
|
+
this.options = options;
|
|
583
|
+
this.nextId = 1;
|
|
584
|
+
this.pending = /* @__PURE__ */ new Map();
|
|
585
|
+
this.incoming = /* @__PURE__ */ new Map();
|
|
586
|
+
}
|
|
587
|
+
/** Send a request without serializing other in-flight requests. */
|
|
588
|
+
request(operation2, value2, signal, transfer = []) {
|
|
589
|
+
if (this.failure)
|
|
590
|
+
return Promise.reject(this.failure.reason);
|
|
591
|
+
if (signal?.aborted)
|
|
592
|
+
return Promise.reject(signal.reason);
|
|
593
|
+
const id = this.nextId++;
|
|
594
|
+
return new Promise((resolve, reject) => {
|
|
595
|
+
const abort = () => {
|
|
596
|
+
const pending2 = this.pending.get(id);
|
|
597
|
+
if (!pending2)
|
|
598
|
+
return;
|
|
599
|
+
this.pending.delete(id);
|
|
600
|
+
pending2.cleanup();
|
|
601
|
+
reject(signal?.reason);
|
|
602
|
+
this.send({ source: "math.gl/tasks", kind: "cancel", id });
|
|
603
|
+
};
|
|
604
|
+
this.pending.set(id, {
|
|
605
|
+
resolve,
|
|
606
|
+
reject,
|
|
607
|
+
cleanup: () => signal?.removeEventListener("abort", abort)
|
|
608
|
+
});
|
|
609
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
610
|
+
this.send({ source: "math.gl/tasks", kind: "request", id, operation: operation2, value: value2 }, transfer);
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
/** Send a one-way notification. */
|
|
614
|
+
emit(operation2, value2, transfer = []) {
|
|
615
|
+
if (this.failure)
|
|
616
|
+
throw this.failure.reason;
|
|
617
|
+
this.send({ source: "math.gl/tasks", kind: "event", id: 0, operation: operation2, value: value2 }, transfer);
|
|
618
|
+
}
|
|
619
|
+
/** Dispatch a transport message; unrelated protocols are ignored. */
|
|
620
|
+
receive(message) {
|
|
621
|
+
if (this.failure || message?.source !== "math.gl/tasks")
|
|
622
|
+
return;
|
|
623
|
+
if (message.kind === "failure") {
|
|
624
|
+
const reason = new Error(message.error?.message ?? "Task channel failed");
|
|
625
|
+
this.close(reason);
|
|
626
|
+
this.options.onFailure?.(reason);
|
|
627
|
+
} else if (message.kind === "result" || message.kind === "error") {
|
|
628
|
+
const pending2 = this.pending.get(message.id);
|
|
629
|
+
if (!pending2)
|
|
630
|
+
return;
|
|
631
|
+
this.pending.delete(message.id);
|
|
632
|
+
pending2.cleanup();
|
|
633
|
+
if (message.kind === "result")
|
|
634
|
+
pending2.resolve(message.value);
|
|
635
|
+
else {
|
|
636
|
+
const error = new TaskRequestError(message.error?.message ?? "Task request failed");
|
|
637
|
+
error.name = message.error?.name ?? "Error";
|
|
638
|
+
pending2.reject(error);
|
|
639
|
+
}
|
|
640
|
+
} else if (message.kind === "cancel") {
|
|
641
|
+
this.incoming.get(message.id)?.abort(new DOMException("Task request cancelled", "AbortError"));
|
|
642
|
+
} else if (message.kind === "event") {
|
|
643
|
+
try {
|
|
644
|
+
this.options.handleEvent?.(message.operation, message.value);
|
|
645
|
+
} catch (error) {
|
|
646
|
+
this.fail(error);
|
|
647
|
+
}
|
|
648
|
+
} else if (message.kind === "request") {
|
|
649
|
+
if (this.incoming.has(message.id)) {
|
|
650
|
+
this.fail(new Error("Duplicate task request identifier"));
|
|
651
|
+
return;
|
|
652
|
+
}
|
|
653
|
+
const controller = new AbortController();
|
|
654
|
+
this.incoming.set(message.id, controller);
|
|
655
|
+
void Promise.resolve().then(() => {
|
|
656
|
+
controller.signal.throwIfAborted();
|
|
657
|
+
return this.options.handleRequest(message.operation, message.value, controller.signal);
|
|
658
|
+
}).then((value2) => {
|
|
659
|
+
if (!controller.signal.aborted && !this.failure) {
|
|
660
|
+
this.send({ source: "math.gl/tasks", kind: "result", id: message.id, value: value2 }, this.options.getResultTransferList?.(value2, message.value));
|
|
661
|
+
}
|
|
662
|
+
}).catch((reason) => {
|
|
663
|
+
if (!controller.signal.aborted && !this.failure) {
|
|
664
|
+
this.send({
|
|
665
|
+
source: "math.gl/tasks",
|
|
666
|
+
kind: "error",
|
|
667
|
+
id: message.id,
|
|
668
|
+
error: {
|
|
669
|
+
name: reason instanceof Error ? reason.name : "Error",
|
|
670
|
+
message: reason instanceof Error ? reason.message : String(reason)
|
|
671
|
+
}
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
}).finally(() => this.incoming.delete(message.id));
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
/** Reject all outstanding calls with a common cause and abort incoming callbacks. */
|
|
678
|
+
close(reason = new Error("Task channel closed")) {
|
|
679
|
+
if (this.failure)
|
|
680
|
+
return;
|
|
681
|
+
this.failure = { reason };
|
|
682
|
+
for (const pending2 of this.pending.values()) {
|
|
683
|
+
pending2.cleanup();
|
|
684
|
+
pending2.reject(reason);
|
|
685
|
+
}
|
|
686
|
+
this.pending.clear();
|
|
687
|
+
for (const controller of this.incoming.values())
|
|
688
|
+
controller.abort(reason);
|
|
689
|
+
this.incoming.clear();
|
|
690
|
+
}
|
|
691
|
+
send(message, transfer = []) {
|
|
692
|
+
if (this.failure)
|
|
693
|
+
return;
|
|
694
|
+
try {
|
|
695
|
+
this.options.send(message, transfer);
|
|
696
|
+
} catch (error) {
|
|
697
|
+
this.fail(error);
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
/** Invalidate the channel and notify the peer when the transport still works. */
|
|
701
|
+
fail(reason) {
|
|
702
|
+
if (this.failure)
|
|
703
|
+
return;
|
|
704
|
+
this.close(reason);
|
|
705
|
+
try {
|
|
706
|
+
this.options.send({
|
|
707
|
+
source: "math.gl/tasks",
|
|
708
|
+
kind: "failure",
|
|
709
|
+
id: 0,
|
|
710
|
+
error: {
|
|
711
|
+
name: reason instanceof Error ? reason.name : "Error",
|
|
712
|
+
message: reason instanceof Error ? reason.message : String(reason)
|
|
713
|
+
}
|
|
714
|
+
}, []);
|
|
715
|
+
} catch {
|
|
716
|
+
}
|
|
717
|
+
this.options.onFailure?.(reason);
|
|
718
|
+
}
|
|
719
|
+
};
|
|
720
|
+
}
|
|
721
|
+
});
|
|
722
|
+
|
|
723
|
+
// ../../node_modules/@math.gl/tasks/dist/tasks/task-runtime.js
|
|
724
|
+
function assertPayload(value2) {
|
|
725
|
+
if (!value2 || typeof value2 !== "object" || Object.getPrototypeOf(value2) !== Object.prototype) {
|
|
726
|
+
throw new TypeError("Task payloads must be plain objects with named fields");
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
function clonePayload(value2, ownership = "copy") {
|
|
730
|
+
assertPayload(value2);
|
|
731
|
+
if (!["copy", "transfer", "share"].includes(ownership))
|
|
732
|
+
throw new TypeError("Invalid input ownership");
|
|
733
|
+
const transfer = getTransferList(value2);
|
|
734
|
+
if (ownership === "share" && transfer.length)
|
|
735
|
+
throw new TypeError("Share requires shared storage");
|
|
736
|
+
return structuredClone(value2, {
|
|
737
|
+
transfer: ownership === "transfer" ? transfer : []
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
function taskContext(state, context = {}) {
|
|
741
|
+
const signal = context.signal ?? new AbortController().signal;
|
|
742
|
+
return {
|
|
743
|
+
state,
|
|
744
|
+
signal,
|
|
745
|
+
requestHost: async (operation2, payload, controls) => {
|
|
746
|
+
signal.throwIfAborted();
|
|
747
|
+
if (!context.requestHost)
|
|
748
|
+
throw new Error("No host request handler configured");
|
|
749
|
+
return context.requestHost(operation2, payload, controls);
|
|
750
|
+
},
|
|
751
|
+
emitHost: (operation2, payload) => {
|
|
752
|
+
signal.throwIfAborted();
|
|
753
|
+
context.emitHost?.(operation2, payload);
|
|
754
|
+
},
|
|
755
|
+
throwIfAborted: () => {
|
|
756
|
+
signal.throwIfAborted();
|
|
757
|
+
context.throwIfAborted?.();
|
|
758
|
+
},
|
|
759
|
+
reportProgress: (progress) => context.reportProgress?.({
|
|
760
|
+
...progress,
|
|
761
|
+
phase: progress.phase ?? "process",
|
|
762
|
+
unit: progress.unit ?? "items"
|
|
763
|
+
})
|
|
764
|
+
};
|
|
765
|
+
}
|
|
766
|
+
async function initializeTaskWorker(task) {
|
|
767
|
+
if (!await WorkerBody.inWorkerThread())
|
|
768
|
+
throw new Error("initializeTaskWorker must run inside a worker");
|
|
769
|
+
if (installed)
|
|
770
|
+
throw new Error("A task is already installed in this worker");
|
|
771
|
+
installed = true;
|
|
772
|
+
const runtime = new TaskRuntime(task);
|
|
773
|
+
let channelStream;
|
|
774
|
+
const channel = new TaskChannel({
|
|
775
|
+
getResultTransferList: (value2, request) => request.outputOwnership === "transfer" ? getTransferList(value2) : [],
|
|
776
|
+
send: (message, transfer) => {
|
|
777
|
+
const snapshot = structuredClone(message, { transfer });
|
|
778
|
+
void WorkerBody.postMessage("task-channel", snapshot).catch((reason) => channel.fail(reason));
|
|
779
|
+
},
|
|
780
|
+
handleRequest: async (operation2, value2, signal) => {
|
|
781
|
+
const request = value2;
|
|
782
|
+
const context = {
|
|
783
|
+
signal,
|
|
784
|
+
reportProgress: (progress) => channel.emit("task:progress", { id: request.progressId, progress }),
|
|
785
|
+
requestHost: (operation3, payload, controls = {}) => {
|
|
786
|
+
const request2 = {
|
|
787
|
+
operation: operation3,
|
|
788
|
+
payload: clonePayload(payload, controls.inputOwnership),
|
|
789
|
+
outputOwnership: controls.outputOwnership ?? "copy"
|
|
790
|
+
};
|
|
791
|
+
return channel.request("task:host-request", request2, signal, getTransferList(request2));
|
|
792
|
+
},
|
|
793
|
+
emitHost: (operation3, payload) => channel.emit("task:host-event", { operation: operation3, payload, id: request.progressId })
|
|
794
|
+
};
|
|
795
|
+
switch (operation2) {
|
|
796
|
+
case "initialize":
|
|
797
|
+
return runtime.initialize(request.input, context);
|
|
798
|
+
case "process":
|
|
799
|
+
return runtime.process(request.input, request.options, context);
|
|
800
|
+
case "stream-open": {
|
|
801
|
+
if (channelStream)
|
|
802
|
+
throw new Error("A task stream is already open");
|
|
803
|
+
async function* inputs() {
|
|
804
|
+
while (true) {
|
|
805
|
+
const result = await channel.request("task:next-input", { outputOwnership: "transfer" }, signal);
|
|
806
|
+
if (result.done)
|
|
807
|
+
return;
|
|
808
|
+
yield result.value;
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
channelStream = runtime.stream(inputs(), request.options, context)[Symbol.asyncIterator]();
|
|
812
|
+
return {};
|
|
813
|
+
}
|
|
814
|
+
case "stream-next":
|
|
815
|
+
if (!channelStream)
|
|
816
|
+
throw new Error("No active task stream");
|
|
817
|
+
return channelStream.next();
|
|
818
|
+
case "stream-close":
|
|
819
|
+
try {
|
|
820
|
+
await channelStream?.return?.();
|
|
821
|
+
} finally {
|
|
822
|
+
channelStream = void 0;
|
|
823
|
+
}
|
|
824
|
+
return {};
|
|
825
|
+
case "destroy":
|
|
826
|
+
return runtime.destroy();
|
|
827
|
+
default:
|
|
828
|
+
throw new Error("Unknown task channel operation");
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
});
|
|
832
|
+
await WorkerBody.addEventListener((type, payload) => {
|
|
833
|
+
if (type === "task-channel")
|
|
834
|
+
channel.receive(payload);
|
|
835
|
+
});
|
|
836
|
+
let streamOptions = {};
|
|
837
|
+
return createWorker(async (request, _options, context) => {
|
|
838
|
+
switch (request.operation) {
|
|
839
|
+
case "initialize":
|
|
840
|
+
return runtime.initialize(request.input, context);
|
|
841
|
+
case "destroy":
|
|
842
|
+
return runtime.destroy();
|
|
843
|
+
case "stream-options":
|
|
844
|
+
streamOptions = request.options;
|
|
845
|
+
return {};
|
|
846
|
+
case "process":
|
|
847
|
+
return runtime.process(request.input, request.options, context);
|
|
848
|
+
default:
|
|
849
|
+
throw new Error("Unknown task operation");
|
|
850
|
+
}
|
|
851
|
+
}, async function* (inputs, _options, context) {
|
|
852
|
+
async function* batches() {
|
|
853
|
+
for await (const input of inputs) {
|
|
854
|
+
assertPayload(input);
|
|
855
|
+
yield input;
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
try {
|
|
859
|
+
yield* runtime.stream(batches(), streamOptions, context);
|
|
860
|
+
} finally {
|
|
861
|
+
streamOptions = {};
|
|
862
|
+
}
|
|
863
|
+
}, () => preloadTaskCode(task));
|
|
864
|
+
}
|
|
865
|
+
var TaskRuntime, installed;
|
|
866
|
+
var init_task_runtime = __esm({
|
|
867
|
+
"../../node_modules/@math.gl/tasks/dist/tasks/task-runtime.js"() {
|
|
515
868
|
init_worker_utils();
|
|
869
|
+
init_task_preload();
|
|
870
|
+
init_task_channel();
|
|
871
|
+
TaskRuntime = class {
|
|
872
|
+
constructor(task) {
|
|
873
|
+
this.task = task;
|
|
874
|
+
this.initialized = false;
|
|
875
|
+
}
|
|
876
|
+
async initialize(input, context = {}) {
|
|
877
|
+
if (this.initialized)
|
|
878
|
+
throw new Error("Task is already initialized");
|
|
879
|
+
assertPayload(input);
|
|
880
|
+
await preloadTaskCode(this.task, context.signal);
|
|
881
|
+
context.signal?.throwIfAborted();
|
|
882
|
+
this.state = await this.task.initialize?.(input, taskContext(void 0, context));
|
|
883
|
+
this.initialized = true;
|
|
884
|
+
return {};
|
|
885
|
+
}
|
|
886
|
+
async destroy() {
|
|
887
|
+
if (this.initialized) {
|
|
888
|
+
this.initialized = false;
|
|
889
|
+
const state = this.state;
|
|
890
|
+
this.state = void 0;
|
|
891
|
+
if (this.task.initialize)
|
|
892
|
+
await this.task.destroy?.(state);
|
|
893
|
+
}
|
|
894
|
+
return {};
|
|
895
|
+
}
|
|
896
|
+
async process(input, options, context = {}) {
|
|
897
|
+
if (!this.initialized)
|
|
898
|
+
throw new Error("Task is not initialized");
|
|
899
|
+
if (!this.task.process)
|
|
900
|
+
throw new Error("Task has no atomic processor");
|
|
901
|
+
assertPayload(input);
|
|
902
|
+
const result = await this.task.process(input, options, taskContext(this.state, context));
|
|
903
|
+
assertPayload(result);
|
|
904
|
+
return result;
|
|
905
|
+
}
|
|
906
|
+
async *stream(inputs, options, context = {}) {
|
|
907
|
+
if (!this.initialized)
|
|
908
|
+
throw new Error("Task is not initialized");
|
|
909
|
+
if (!this.task.processInBatches)
|
|
910
|
+
throw new Error("Task has no streaming processor");
|
|
911
|
+
for await (const output of this.task.processInBatches(inputs, options, taskContext(this.state, context))) {
|
|
912
|
+
assertPayload(output);
|
|
913
|
+
yield output;
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
};
|
|
917
|
+
installed = false;
|
|
918
|
+
}
|
|
919
|
+
});
|
|
920
|
+
|
|
921
|
+
// ../../node_modules/@math.gl/tasks/dist/tasks/index.js
|
|
922
|
+
var init_tasks = __esm({
|
|
923
|
+
"../../node_modules/@math.gl/tasks/dist/tasks/index.js"() {
|
|
924
|
+
init_task_runtime();
|
|
925
|
+
}
|
|
926
|
+
});
|
|
927
|
+
|
|
928
|
+
// ../../node_modules/@math.gl/tasks/dist/index.js
|
|
929
|
+
var init_dist = __esm({
|
|
930
|
+
"../../node_modules/@math.gl/tasks/dist/index.js"() {
|
|
931
|
+
init_tasks();
|
|
932
|
+
}
|
|
933
|
+
});
|
|
934
|
+
|
|
935
|
+
// ../core/src/worker-utils/lib/node/worker_threads-browser.ts
|
|
936
|
+
var worker_threads_browser_exports = {};
|
|
937
|
+
__export(worker_threads_browser_exports, {
|
|
938
|
+
NodeWorker: () => NodeWorker,
|
|
939
|
+
parentPort: () => parentPort2
|
|
940
|
+
});
|
|
941
|
+
var NodeWorker, parentPort2;
|
|
942
|
+
var init_worker_threads_browser2 = __esm({
|
|
943
|
+
"../core/src/worker-utils/lib/node/worker_threads-browser.ts"() {
|
|
944
|
+
"use strict";
|
|
945
|
+
NodeWorker = class {
|
|
946
|
+
/** Restores the native worker constructor when this browser shim is embedded in a Node bundle. */
|
|
947
|
+
constructor(...arguments_) {
|
|
948
|
+
const runtimeProcess = globalThis.process;
|
|
949
|
+
const WorkerConstructor = runtimeProcess?.getBuiltinModule?.("node:worker_threads").Worker;
|
|
950
|
+
if (WorkerConstructor) {
|
|
951
|
+
return new WorkerConstructor(...arguments_);
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
/** No-op browser fallback matching the native Worker API. */
|
|
955
|
+
terminate() {
|
|
956
|
+
}
|
|
957
|
+
};
|
|
958
|
+
parentPort2 = null;
|
|
959
|
+
}
|
|
960
|
+
});
|
|
961
|
+
|
|
962
|
+
// ../core/src/worker-utils/lib/worker-api/task-runtime.ts
|
|
963
|
+
function normalizeTaskProgress(progress) {
|
|
964
|
+
return { ...progress, phase: progress.phase ?? "process", unit: progress.unit ?? "items" };
|
|
965
|
+
}
|
|
966
|
+
async function isWorkerThread() {
|
|
967
|
+
if (typeof self !== "undefined" && typeof document === "undefined" && typeof self.postMessage === "function")
|
|
968
|
+
return true;
|
|
969
|
+
if (typeof process !== "undefined" && process.versions?.node) {
|
|
970
|
+
const { isMainThread } = await Promise.resolve().then(() => (init_worker_threads_browser2(), worker_threads_browser_exports));
|
|
971
|
+
return !isMainThread;
|
|
972
|
+
}
|
|
973
|
+
return false;
|
|
974
|
+
}
|
|
975
|
+
var initializeTaskWorker2;
|
|
976
|
+
var init_task_runtime2 = __esm({
|
|
977
|
+
"../core/src/worker-utils/lib/worker-api/task-runtime.ts"() {
|
|
978
|
+
"use strict";
|
|
979
|
+
init_dist();
|
|
980
|
+
initializeTaskWorker2 = initializeTaskWorker;
|
|
981
|
+
}
|
|
982
|
+
});
|
|
983
|
+
|
|
984
|
+
// ../core/src/worker-utils/lib/worker-utils/get-transfer-list.ts
|
|
985
|
+
function getTransferList2(object2, recursive = true, transfers) {
|
|
986
|
+
const transfersSet = transfers || /* @__PURE__ */ new Set();
|
|
987
|
+
if (!object2) {
|
|
988
|
+
} else if (isTransferable2(object2)) {
|
|
989
|
+
transfersSet.add(object2);
|
|
990
|
+
} else if (isTransferable2(object2.buffer)) {
|
|
991
|
+
transfersSet.add(object2.buffer);
|
|
992
|
+
} else if (ArrayBuffer.isView(object2)) {
|
|
993
|
+
} else if (recursive && typeof object2 === "object") {
|
|
994
|
+
for (const key2 in object2) {
|
|
995
|
+
getTransferList2(object2[key2], recursive, transfersSet);
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
return transfers === void 0 ? Array.from(transfersSet) : [];
|
|
999
|
+
}
|
|
1000
|
+
function isTransferable2(object2) {
|
|
1001
|
+
if (!object2) {
|
|
1002
|
+
return false;
|
|
1003
|
+
}
|
|
1004
|
+
if (object2 instanceof ArrayBuffer) {
|
|
1005
|
+
return true;
|
|
1006
|
+
}
|
|
1007
|
+
if (typeof MessagePort !== "undefined" && object2 instanceof MessagePort) {
|
|
1008
|
+
return true;
|
|
1009
|
+
}
|
|
1010
|
+
if (typeof ImageBitmap !== "undefined" && object2 instanceof ImageBitmap) {
|
|
1011
|
+
return true;
|
|
1012
|
+
}
|
|
1013
|
+
if (typeof OffscreenCanvas !== "undefined" && object2 instanceof OffscreenCanvas) {
|
|
1014
|
+
return true;
|
|
1015
|
+
}
|
|
1016
|
+
return false;
|
|
1017
|
+
}
|
|
1018
|
+
var init_get_transfer_list2 = __esm({
|
|
1019
|
+
"../core/src/worker-utils/lib/worker-utils/get-transfer-list.ts"() {
|
|
1020
|
+
"use strict";
|
|
516
1021
|
}
|
|
517
1022
|
});
|
|
518
1023
|
|
|
519
1024
|
// ../core/src/worker-utils/lib/worker-api/create-worker.ts
|
|
1025
|
+
async function createWorker2(process2, processInBatches) {
|
|
1026
|
+
if (!await isWorkerThread()) return;
|
|
1027
|
+
await initializeTaskWorker2(createWorkerTask(process2, processInBatches));
|
|
1028
|
+
}
|
|
1029
|
+
function createWorkerTask(process2, processInBatches) {
|
|
1030
|
+
return {
|
|
1031
|
+
id: "loaders.gl",
|
|
1032
|
+
initialize: (state) => state,
|
|
1033
|
+
destroy: (state) => state.port?.close(),
|
|
1034
|
+
process: async ({ value: value2 }, options, context) => {
|
|
1035
|
+
if (!process2) throw new Error("Worker does not support atomic processing");
|
|
1036
|
+
return { value: await process2(value2, options, createContext(context), context.state.context) };
|
|
1037
|
+
},
|
|
1038
|
+
...processInBatches ? {
|
|
1039
|
+
processInBatches: async function* (inputs, options, context) {
|
|
1040
|
+
async function* values() {
|
|
1041
|
+
for await (const input of inputs) yield input.value;
|
|
1042
|
+
}
|
|
1043
|
+
for await (const value2 of processInBatches(
|
|
1044
|
+
values(),
|
|
1045
|
+
options,
|
|
1046
|
+
createContext(context),
|
|
1047
|
+
context.state.context
|
|
1048
|
+
)) {
|
|
1049
|
+
yield { value: value2 };
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
} : {}
|
|
1053
|
+
};
|
|
1054
|
+
}
|
|
1055
|
+
function createContext(context) {
|
|
1056
|
+
let requestIdentifier = 0;
|
|
1057
|
+
const port = context.state.port;
|
|
1058
|
+
return {
|
|
1059
|
+
signal: context.signal,
|
|
1060
|
+
throwIfAborted: () => context.throwIfAborted(),
|
|
1061
|
+
reportProgress: (progress) => context.reportProgress(normalizeTaskProgress(progress)),
|
|
1062
|
+
process: port ? (input, options = {}, jobContext = {}) => {
|
|
1063
|
+
context.throwIfAborted();
|
|
1064
|
+
const identifier = ++requestIdentifier;
|
|
1065
|
+
return new Promise((resolve, reject) => {
|
|
1066
|
+
const onMessage = (event) => {
|
|
1067
|
+
if (event.data.identifier !== identifier) return;
|
|
1068
|
+
cleanup();
|
|
1069
|
+
if (event.data.error) {
|
|
1070
|
+
const error = new Error(event.data.error.message);
|
|
1071
|
+
error.name = event.data.error.name;
|
|
1072
|
+
reject(error);
|
|
1073
|
+
} else resolve(event.data.value);
|
|
1074
|
+
};
|
|
1075
|
+
const onAbort = () => {
|
|
1076
|
+
cleanup();
|
|
1077
|
+
reject(context.signal.reason);
|
|
1078
|
+
};
|
|
1079
|
+
const cleanup = () => {
|
|
1080
|
+
port.removeEventListener("message", onMessage);
|
|
1081
|
+
context.signal.removeEventListener("abort", onAbort);
|
|
1082
|
+
};
|
|
1083
|
+
port.addEventListener("message", onMessage);
|
|
1084
|
+
context.signal.addEventListener("abort", onAbort, { once: true });
|
|
1085
|
+
port.start();
|
|
1086
|
+
try {
|
|
1087
|
+
const request = { identifier, input, options, context: jobContext };
|
|
1088
|
+
port.postMessage(request, getTransferList2(request));
|
|
1089
|
+
} catch (error) {
|
|
1090
|
+
cleanup();
|
|
1091
|
+
reject(error);
|
|
1092
|
+
}
|
|
1093
|
+
});
|
|
1094
|
+
} : void 0
|
|
1095
|
+
};
|
|
1096
|
+
}
|
|
520
1097
|
var init_create_worker2 = __esm({
|
|
521
1098
|
"../core/src/worker-utils/lib/worker-api/create-worker.ts"() {
|
|
522
1099
|
"use strict";
|
|
523
|
-
|
|
1100
|
+
init_task_runtime2();
|
|
1101
|
+
init_get_transfer_list2();
|
|
524
1102
|
}
|
|
525
1103
|
});
|
|
526
1104
|
|
|
@@ -534,7 +1112,7 @@
|
|
|
534
1112
|
|
|
535
1113
|
// ../core/src/loader-utils/lib/worker-loader-utils/create-loader-worker.ts
|
|
536
1114
|
async function createLoaderWorker(loader, selectLoader = () => loader) {
|
|
537
|
-
await
|
|
1115
|
+
await createWorker2(
|
|
538
1116
|
(input, options, workerContext, loaderContext) => processLoaderWorkerData(
|
|
539
1117
|
selectLoader(options || {}),
|
|
540
1118
|
input,
|
|
@@ -1626,7 +2204,7 @@
|
|
|
1626
2204
|
});
|
|
1627
2205
|
|
|
1628
2206
|
// ../../node_modules/@math.gl/core/dist/index.js
|
|
1629
|
-
var
|
|
2207
|
+
var init_dist2 = __esm({
|
|
1630
2208
|
"../../node_modules/@math.gl/core/dist/index.js"() {
|
|
1631
2209
|
init_math_utils();
|
|
1632
2210
|
init_spheroid();
|
|
@@ -3041,12 +3619,6 @@
|
|
|
3041
3619
|
}
|
|
3042
3620
|
});
|
|
3043
3621
|
|
|
3044
|
-
// ../../node_modules/@math.gl/geospatial/dist/entries/ellipsoid.js
|
|
3045
|
-
var init_ellipsoid = __esm({
|
|
3046
|
-
"../../node_modules/@math.gl/geospatial/dist/entries/ellipsoid.js"() {
|
|
3047
|
-
}
|
|
3048
|
-
});
|
|
3049
|
-
|
|
3050
3622
|
// ../../node_modules/@math.gl/geometry/dist/polygon/polygon-utils.js
|
|
3051
3623
|
function getPolygonSignedArea(points, options = {}) {
|
|
3052
3624
|
const { start = 0, end = points.length, plane = "xy" } = options;
|
|
@@ -3633,487 +4205,12 @@
|
|
|
3633
4205
|
});
|
|
3634
4206
|
|
|
3635
4207
|
// ../../node_modules/@math.gl/geometry/dist/index.js
|
|
3636
|
-
var
|
|
4208
|
+
var init_dist3 = __esm({
|
|
3637
4209
|
"../../node_modules/@math.gl/geometry/dist/index.js"() {
|
|
3638
4210
|
init_polygon();
|
|
3639
4211
|
}
|
|
3640
4212
|
});
|
|
3641
4213
|
|
|
3642
|
-
// ../../node_modules/@math.gl/geospatial/dist/globe.js
|
|
3643
|
-
var init_globe = __esm({
|
|
3644
|
-
"../../node_modules/@math.gl/geospatial/dist/globe.js"() {
|
|
3645
|
-
}
|
|
3646
|
-
});
|
|
3647
|
-
|
|
3648
|
-
// ../../node_modules/@math.gl/geospatial/dist/tiles.js
|
|
3649
|
-
var init_tiles = __esm({
|
|
3650
|
-
"../../node_modules/@math.gl/geospatial/dist/tiles.js"() {
|
|
3651
|
-
}
|
|
3652
|
-
});
|
|
3653
|
-
|
|
3654
|
-
// ../../node_modules/@math.gl/geospatial/dist/wkb/types.js
|
|
3655
|
-
function getWellKnownDimensionSize(dimension) {
|
|
3656
|
-
switch (dimension) {
|
|
3657
|
-
case "xy":
|
|
3658
|
-
return 2;
|
|
3659
|
-
case "xyz":
|
|
3660
|
-
case "xym":
|
|
3661
|
-
return 3;
|
|
3662
|
-
case "xyzm":
|
|
3663
|
-
return 4;
|
|
3664
|
-
}
|
|
3665
|
-
}
|
|
3666
|
-
function inferWellKnownGeometryDimension(geometry) {
|
|
3667
|
-
const size = getGeometryDimensionSize(geometry);
|
|
3668
|
-
return size >= 4 ? "xyzm" : size === 3 ? "xyz" : "xy";
|
|
3669
|
-
}
|
|
3670
|
-
function getGeometryDimensionSize(geometry) {
|
|
3671
|
-
if (geometry.type === "GeometryCollection") {
|
|
3672
|
-
return Math.max(2, ...geometry.geometries.map(getGeometryDimensionSize));
|
|
3673
|
-
}
|
|
3674
|
-
return getCoordinateDimension(geometry.coordinates);
|
|
3675
|
-
}
|
|
3676
|
-
function getCoordinateDimension(value2) {
|
|
3677
|
-
if (value2.length === 0)
|
|
3678
|
-
return 2;
|
|
3679
|
-
if (typeof value2[0] === "number")
|
|
3680
|
-
return value2.length;
|
|
3681
|
-
return Math.max(2, ...value2.map((child2) => getCoordinateDimension(child2)));
|
|
3682
|
-
}
|
|
3683
|
-
var init_types = __esm({
|
|
3684
|
-
"../../node_modules/@math.gl/geospatial/dist/wkb/types.js"() {
|
|
3685
|
-
}
|
|
3686
|
-
});
|
|
3687
|
-
|
|
3688
|
-
// ../../node_modules/@math.gl/geospatial/dist/wkb/wkb.js
|
|
3689
|
-
function writeWKB(geometry, dimension = inferWellKnownGeometryDimension(geometry)) {
|
|
3690
|
-
const bytes = [];
|
|
3691
|
-
writeWKBGeometry(bytes, geometry, dimension);
|
|
3692
|
-
return Uint8Array.from(bytes);
|
|
3693
|
-
}
|
|
3694
|
-
function writeWKBGeometry(bytes, geometry, dimension) {
|
|
3695
|
-
bytes.push(1);
|
|
3696
|
-
const size = getWellKnownDimensionSize(dimension);
|
|
3697
|
-
const dimensionOffset = dimension === "xyz" ? 1e3 : dimension === "xym" ? 2e3 : dimension === "xyzm" ? 3e3 : 0;
|
|
3698
|
-
writeUint32(bytes, getWKBType(geometry.type) + dimensionOffset);
|
|
3699
|
-
const writeCoordinate = (coordinate) => {
|
|
3700
|
-
for (let index = 0; index < size; index++)
|
|
3701
|
-
writeFloat64(bytes, coordinate[index] ?? 0);
|
|
3702
|
-
};
|
|
3703
|
-
const writeCoordinates = (coordinates) => {
|
|
3704
|
-
writeUint32(bytes, coordinates.length);
|
|
3705
|
-
for (const coordinate of coordinates)
|
|
3706
|
-
writeCoordinate(coordinate);
|
|
3707
|
-
};
|
|
3708
|
-
switch (geometry.type) {
|
|
3709
|
-
case "Point":
|
|
3710
|
-
writeCoordinate(geometry.coordinates.length === 0 ? new Array(size).fill(Number.NaN) : geometry.coordinates);
|
|
3711
|
-
break;
|
|
3712
|
-
case "LineString":
|
|
3713
|
-
writeCoordinates(geometry.coordinates);
|
|
3714
|
-
break;
|
|
3715
|
-
case "Polygon":
|
|
3716
|
-
writeUint32(bytes, geometry.coordinates.length);
|
|
3717
|
-
for (const ring of geometry.coordinates)
|
|
3718
|
-
writeCoordinates(ring);
|
|
3719
|
-
break;
|
|
3720
|
-
case "MultiPoint":
|
|
3721
|
-
writeUint32(bytes, geometry.coordinates.length);
|
|
3722
|
-
for (const coordinate of geometry.coordinates) {
|
|
3723
|
-
writeWKBGeometry(bytes, { type: "Point", coordinates: coordinate }, dimension);
|
|
3724
|
-
}
|
|
3725
|
-
break;
|
|
3726
|
-
case "MultiLineString":
|
|
3727
|
-
writeUint32(bytes, geometry.coordinates.length);
|
|
3728
|
-
for (const coordinates of geometry.coordinates) {
|
|
3729
|
-
writeWKBGeometry(bytes, { type: "LineString", coordinates }, dimension);
|
|
3730
|
-
}
|
|
3731
|
-
break;
|
|
3732
|
-
case "MultiPolygon":
|
|
3733
|
-
writeUint32(bytes, geometry.coordinates.length);
|
|
3734
|
-
for (const coordinates of geometry.coordinates) {
|
|
3735
|
-
writeWKBGeometry(bytes, { type: "Polygon", coordinates }, dimension);
|
|
3736
|
-
}
|
|
3737
|
-
break;
|
|
3738
|
-
case "GeometryCollection":
|
|
3739
|
-
writeUint32(bytes, geometry.geometries.length);
|
|
3740
|
-
for (const child2 of geometry.geometries)
|
|
3741
|
-
writeWKBGeometry(bytes, child2, dimension);
|
|
3742
|
-
break;
|
|
3743
|
-
}
|
|
3744
|
-
}
|
|
3745
|
-
function getWKBType(type) {
|
|
3746
|
-
return [
|
|
3747
|
-
"Point",
|
|
3748
|
-
"LineString",
|
|
3749
|
-
"Polygon",
|
|
3750
|
-
"MultiPoint",
|
|
3751
|
-
"MultiLineString",
|
|
3752
|
-
"MultiPolygon",
|
|
3753
|
-
"GeometryCollection"
|
|
3754
|
-
].indexOf(type) + 1;
|
|
3755
|
-
}
|
|
3756
|
-
function writeUint32(bytes, value2) {
|
|
3757
|
-
bytes.push(value2 & 255, value2 >>> 8 & 255, value2 >>> 16 & 255, value2 >>> 24 & 255);
|
|
3758
|
-
}
|
|
3759
|
-
function writeFloat64(bytes, value2) {
|
|
3760
|
-
const buffer = new ArrayBuffer(8);
|
|
3761
|
-
new DataView(buffer).setFloat64(0, value2, true);
|
|
3762
|
-
bytes.push(...new Uint8Array(buffer));
|
|
3763
|
-
}
|
|
3764
|
-
var init_wkb = __esm({
|
|
3765
|
-
"../../node_modules/@math.gl/geospatial/dist/wkb/wkb.js"() {
|
|
3766
|
-
init_types();
|
|
3767
|
-
}
|
|
3768
|
-
});
|
|
3769
|
-
|
|
3770
|
-
// ../../node_modules/@math.gl/geospatial/dist/wkb/wkb-builder.js
|
|
3771
|
-
function measureGeometry(geometryWriter, options) {
|
|
3772
|
-
const builder = new WKBBuilder({ ...options, mode: "measure" });
|
|
3773
|
-
geometryWriter(builder);
|
|
3774
|
-
return builder.finishGeometry();
|
|
3775
|
-
}
|
|
3776
|
-
function getTargetDataView(target) {
|
|
3777
|
-
return ArrayBuffer.isView(target) ? new DataView(target.buffer, target.byteOffset, target.byteLength) : new DataView(target);
|
|
3778
|
-
}
|
|
3779
|
-
function getWKBTypeCode(geometryType, dimension, hasSrid) {
|
|
3780
|
-
const geometryCode = GEOMETRY_TYPE_CODES[geometryType];
|
|
3781
|
-
if (hasSrid) {
|
|
3782
|
-
const dimensionFlags = dimension === "xyz" ? 2147483648 : dimension === "xym" ? 1073741824 : dimension === "xyzm" ? 3221225472 : 0;
|
|
3783
|
-
return (geometryCode | dimensionFlags | 536870912) >>> 0;
|
|
3784
|
-
}
|
|
3785
|
-
const dimensionOffset = dimension === "xyz" ? 1e3 : dimension === "xym" ? 2e3 : dimension === "xyzm" ? 3e3 : 0;
|
|
3786
|
-
return geometryCode + dimensionOffset;
|
|
3787
|
-
}
|
|
3788
|
-
function makeCoordinate(dimension, x, y, z, m) {
|
|
3789
|
-
switch (dimension) {
|
|
3790
|
-
case "xy":
|
|
3791
|
-
return [x, y];
|
|
3792
|
-
case "xyz":
|
|
3793
|
-
return [x, y, z ?? Number.NaN];
|
|
3794
|
-
case "xym":
|
|
3795
|
-
return [x, y, m ?? Number.NaN];
|
|
3796
|
-
case "xyzm":
|
|
3797
|
-
return [x, y, z ?? Number.NaN, m ?? Number.NaN];
|
|
3798
|
-
}
|
|
3799
|
-
}
|
|
3800
|
-
function getDimensionSize(dimension) {
|
|
3801
|
-
return dimension === "xy" ? 2 : dimension === "xyzm" ? 4 : 3;
|
|
3802
|
-
}
|
|
3803
|
-
function validateSrid(srid) {
|
|
3804
|
-
if (srid !== void 0 && (!Number.isSafeInteger(srid) || srid < 0 || srid > 4294967295)) {
|
|
3805
|
-
throw new Error("WKBBuilder srid must be an unsigned 32-bit integer");
|
|
3806
|
-
}
|
|
3807
|
-
}
|
|
3808
|
-
function makeNullBitmap(geometryWriters) {
|
|
3809
|
-
const nullBitmap = new Uint8Array(Math.ceil(geometryWriters.length / 8));
|
|
3810
|
-
let nullCount = 0;
|
|
3811
|
-
for (let geometryIndex = 0; geometryIndex < geometryWriters.length; geometryIndex++) {
|
|
3812
|
-
if (geometryWriters[geometryIndex]) {
|
|
3813
|
-
nullBitmap[geometryIndex >> 3] |= 1 << (geometryIndex & 7);
|
|
3814
|
-
} else {
|
|
3815
|
-
nullCount++;
|
|
3816
|
-
}
|
|
3817
|
-
}
|
|
3818
|
-
return { nullBitmap, nullCount };
|
|
3819
|
-
}
|
|
3820
|
-
var GEOMETRY_TYPE_CODES, WKBBuilder;
|
|
3821
|
-
var init_wkb_builder = __esm({
|
|
3822
|
-
"../../node_modules/@math.gl/geospatial/dist/wkb/wkb-builder.js"() {
|
|
3823
|
-
GEOMETRY_TYPE_CODES = {
|
|
3824
|
-
Point: 1,
|
|
3825
|
-
LineString: 2,
|
|
3826
|
-
Polygon: 3,
|
|
3827
|
-
MultiPoint: 4,
|
|
3828
|
-
MultiLineString: 5,
|
|
3829
|
-
MultiPolygon: 6,
|
|
3830
|
-
GeometryCollection: 7
|
|
3831
|
-
};
|
|
3832
|
-
WKBBuilder = class _WKBBuilder {
|
|
3833
|
-
constructor(options) {
|
|
3834
|
-
this.mode = options.mode;
|
|
3835
|
-
this.dimension = options.dimension ?? "xy";
|
|
3836
|
-
this.littleEndian = options.byteOrder !== "big-endian";
|
|
3837
|
-
this.srid = options.srid;
|
|
3838
|
-
this.transform = options.transform;
|
|
3839
|
-
validateSrid(this.srid);
|
|
3840
|
-
if (options.mode === "write") {
|
|
3841
|
-
const dataView = getTargetDataView(options.target);
|
|
3842
|
-
const byteOffset = options.byteOffset ?? 0;
|
|
3843
|
-
if (!Number.isSafeInteger(byteOffset) || byteOffset < 0 || byteOffset > dataView.byteLength) {
|
|
3844
|
-
throw new Error("WKBBuilder byteOffset is outside the target");
|
|
3845
|
-
}
|
|
3846
|
-
this.dataView = dataView;
|
|
3847
|
-
this.startByteOffset = byteOffset;
|
|
3848
|
-
this.endByteOffset = dataView.byteLength;
|
|
3849
|
-
this.byteOffset = byteOffset;
|
|
3850
|
-
} else {
|
|
3851
|
-
this.dataView = null;
|
|
3852
|
-
this.startByteOffset = 0;
|
|
3853
|
-
this.endByteOffset = Number.POSITIVE_INFINITY;
|
|
3854
|
-
this.byteOffset = 0;
|
|
3855
|
-
}
|
|
3856
|
-
}
|
|
3857
|
-
/** Begins a geometry and writes its count field when required. */
|
|
3858
|
-
beginGeometry(type, count) {
|
|
3859
|
-
switch (type) {
|
|
3860
|
-
case "Point":
|
|
3861
|
-
this.beginPoint();
|
|
3862
|
-
break;
|
|
3863
|
-
case "LineString":
|
|
3864
|
-
this.beginLineString(count ?? 0);
|
|
3865
|
-
break;
|
|
3866
|
-
case "Polygon":
|
|
3867
|
-
this.beginPolygon(count ?? 0);
|
|
3868
|
-
break;
|
|
3869
|
-
case "MultiPoint":
|
|
3870
|
-
this.beginMultiPoint(count ?? 0);
|
|
3871
|
-
break;
|
|
3872
|
-
case "MultiLineString":
|
|
3873
|
-
this.beginMultiLineString(count ?? 0);
|
|
3874
|
-
break;
|
|
3875
|
-
case "MultiPolygon":
|
|
3876
|
-
this.beginMultiPolygon(count ?? 0);
|
|
3877
|
-
break;
|
|
3878
|
-
case "GeometryCollection":
|
|
3879
|
-
this.writeHeader("GeometryCollection");
|
|
3880
|
-
this.writeUint32(count ?? 0);
|
|
3881
|
-
break;
|
|
3882
|
-
}
|
|
3883
|
-
}
|
|
3884
|
-
/** Begins one point geometry. */
|
|
3885
|
-
beginPoint() {
|
|
3886
|
-
this.writeHeader("Point");
|
|
3887
|
-
}
|
|
3888
|
-
/** Begins one linestring geometry. */
|
|
3889
|
-
beginLineString(pointCount) {
|
|
3890
|
-
this.writeHeader("LineString");
|
|
3891
|
-
this.writeUint32(pointCount);
|
|
3892
|
-
}
|
|
3893
|
-
/** Begins one polygon geometry. */
|
|
3894
|
-
beginPolygon(ringCount) {
|
|
3895
|
-
this.writeHeader("Polygon");
|
|
3896
|
-
this.writeUint32(ringCount);
|
|
3897
|
-
}
|
|
3898
|
-
/** Begins one linear ring inside a polygon. */
|
|
3899
|
-
beginLinearRing(pointCount) {
|
|
3900
|
-
this.writeUint32(pointCount);
|
|
3901
|
-
}
|
|
3902
|
-
/** Begins one multipoint geometry. */
|
|
3903
|
-
beginMultiPoint(pointCount) {
|
|
3904
|
-
this.writeHeader("MultiPoint");
|
|
3905
|
-
this.writeUint32(pointCount);
|
|
3906
|
-
}
|
|
3907
|
-
/** Begins one multilinestring geometry. */
|
|
3908
|
-
beginMultiLineString(lineCount) {
|
|
3909
|
-
this.writeHeader("MultiLineString");
|
|
3910
|
-
this.writeUint32(lineCount);
|
|
3911
|
-
}
|
|
3912
|
-
/** Begins one multipolygon geometry. */
|
|
3913
|
-
beginMultiPolygon(polygonCount) {
|
|
3914
|
-
this.writeHeader("MultiPolygon");
|
|
3915
|
-
this.writeUint32(polygonCount);
|
|
3916
|
-
}
|
|
3917
|
-
/** Writes one coordinate using the builder's semantic dimension. */
|
|
3918
|
-
writeCoordinate(x, y, z, m) {
|
|
3919
|
-
let coordinate = makeCoordinate(this.dimension, x, y, z, m);
|
|
3920
|
-
if (this.transform)
|
|
3921
|
-
coordinate = this.transform(coordinate, this.dimension);
|
|
3922
|
-
const coordinateSize = getDimensionSize(this.dimension);
|
|
3923
|
-
for (let index = 0; index < coordinateSize; index++) {
|
|
3924
|
-
this.writeFloat64(coordinate[index] ?? Number.NaN);
|
|
3925
|
-
}
|
|
3926
|
-
}
|
|
3927
|
-
/** Temporarily changes the semantic dimension for a nested geometry. */
|
|
3928
|
-
withDimension(dimension, callback) {
|
|
3929
|
-
const previous = this.dimension;
|
|
3930
|
-
this.dimension = dimension;
|
|
3931
|
-
try {
|
|
3932
|
-
return callback();
|
|
3933
|
-
} finally {
|
|
3934
|
-
this.dimension = previous;
|
|
3935
|
-
}
|
|
3936
|
-
}
|
|
3937
|
-
/** Returns the number of bytes measured or written. */
|
|
3938
|
-
finishGeometry() {
|
|
3939
|
-
return this.byteOffset - this.startByteOffset;
|
|
3940
|
-
}
|
|
3941
|
-
/** Measures geometry callbacks and returns contiguous Binary offsets. */
|
|
3942
|
-
static measureGeometryArray(geometryWriters, options = {}) {
|
|
3943
|
-
const valueOffsets = new Int32Array(geometryWriters.length + 1);
|
|
3944
|
-
for (let geometryIndex = 0; geometryIndex < geometryWriters.length; geometryIndex++) {
|
|
3945
|
-
const geometryWriter = geometryWriters[geometryIndex];
|
|
3946
|
-
const byteLength = geometryWriter ? measureGeometry(geometryWriter, {
|
|
3947
|
-
...options,
|
|
3948
|
-
dimension: options.dimensionResolver?.(geometryIndex) ?? options.dimension
|
|
3949
|
-
}) : 0;
|
|
3950
|
-
const nextOffset = valueOffsets[geometryIndex] + byteLength;
|
|
3951
|
-
if (nextOffset > 2147483647)
|
|
3952
|
-
throw new Error("WKB geometry array exceeds Int32 offsets");
|
|
3953
|
-
valueOffsets[geometryIndex + 1] = nextOffset;
|
|
3954
|
-
}
|
|
3955
|
-
return valueOffsets;
|
|
3956
|
-
}
|
|
3957
|
-
/** Writes geometry callbacks into an existing contiguous values buffer. */
|
|
3958
|
-
static writeGeometryArray(geometryWriters, valueOffsets, values, options = {}) {
|
|
3959
|
-
if (valueOffsets.length !== geometryWriters.length + 1) {
|
|
3960
|
-
throw new Error("WKB valueOffsets length must equal geometry count plus one");
|
|
3961
|
-
}
|
|
3962
|
-
for (let i = 0; i < valueOffsets.length; i++) {
|
|
3963
|
-
if (!Number.isInteger(valueOffsets[i]) || valueOffsets[i] < 0 || i > 0 && valueOffsets[i] < valueOffsets[i - 1]) {
|
|
3964
|
-
throw new Error("WKB valueOffsets must be nonnegative and nondecreasing");
|
|
3965
|
-
}
|
|
3966
|
-
}
|
|
3967
|
-
if (valueOffsets[valueOffsets.length - 1] > values.byteLength) {
|
|
3968
|
-
throw new Error("WKB values buffer is smaller than its final offset");
|
|
3969
|
-
}
|
|
3970
|
-
for (let geometryIndex = 0; geometryIndex < geometryWriters.length; geometryIndex++) {
|
|
3971
|
-
const geometryWriter = geometryWriters[geometryIndex];
|
|
3972
|
-
if (!geometryWriter)
|
|
3973
|
-
continue;
|
|
3974
|
-
const builder = new _WKBBuilder({
|
|
3975
|
-
...options,
|
|
3976
|
-
mode: "write",
|
|
3977
|
-
target: values,
|
|
3978
|
-
byteOffset: valueOffsets[geometryIndex],
|
|
3979
|
-
dimension: options.dimensionResolver?.(geometryIndex) ?? options.dimension
|
|
3980
|
-
});
|
|
3981
|
-
geometryWriter(builder);
|
|
3982
|
-
const byteLength = builder.finishGeometry();
|
|
3983
|
-
if (valueOffsets[geometryIndex] + byteLength !== valueOffsets[geometryIndex + 1]) {
|
|
3984
|
-
throw new Error("WKB measure and write passes produced different byte lengths");
|
|
3985
|
-
}
|
|
3986
|
-
}
|
|
3987
|
-
return values;
|
|
3988
|
-
}
|
|
3989
|
-
/** Builds plain offsets, values, and validity buffers in two passes. */
|
|
3990
|
-
static buildGeometryArray(geometryWriters, options = {}) {
|
|
3991
|
-
const valueOffsets = _WKBBuilder.measureGeometryArray(geometryWriters, options);
|
|
3992
|
-
const values = new Uint8Array(valueOffsets[valueOffsets.length - 1]);
|
|
3993
|
-
_WKBBuilder.writeGeometryArray(geometryWriters, valueOffsets, values, options);
|
|
3994
|
-
const { nullBitmap, nullCount } = makeNullBitmap(geometryWriters);
|
|
3995
|
-
return {
|
|
3996
|
-
valueOffsets,
|
|
3997
|
-
values,
|
|
3998
|
-
...nullCount > 0 ? { nullBitmap } : {},
|
|
3999
|
-
nullCount
|
|
4000
|
-
};
|
|
4001
|
-
}
|
|
4002
|
-
writeHeader(geometryType) {
|
|
4003
|
-
this.writeUint8(this.littleEndian ? 1 : 0);
|
|
4004
|
-
this.writeUint32(getWKBTypeCode(geometryType, this.dimension, this.srid !== void 0));
|
|
4005
|
-
if (this.srid !== void 0)
|
|
4006
|
-
this.writeUint32(this.srid);
|
|
4007
|
-
}
|
|
4008
|
-
writeUint8(value2) {
|
|
4009
|
-
this.ensureSize(1);
|
|
4010
|
-
this.dataView?.setUint8(this.byteOffset, value2);
|
|
4011
|
-
this.byteOffset++;
|
|
4012
|
-
}
|
|
4013
|
-
writeUint32(value2) {
|
|
4014
|
-
if (!Number.isSafeInteger(value2) || value2 < 0 || value2 > 4294967295) {
|
|
4015
|
-
throw new Error("WKB count must be an unsigned 32-bit integer");
|
|
4016
|
-
}
|
|
4017
|
-
this.ensureSize(4);
|
|
4018
|
-
this.dataView?.setUint32(this.byteOffset, value2, this.littleEndian);
|
|
4019
|
-
this.byteOffset += 4;
|
|
4020
|
-
}
|
|
4021
|
-
writeFloat64(value2) {
|
|
4022
|
-
this.ensureSize(8);
|
|
4023
|
-
this.dataView?.setFloat64(this.byteOffset, value2, this.littleEndian);
|
|
4024
|
-
this.byteOffset += 8;
|
|
4025
|
-
}
|
|
4026
|
-
ensureSize(byteLength) {
|
|
4027
|
-
if (this.byteOffset + byteLength > this.endByteOffset) {
|
|
4028
|
-
throw new Error("WKBBuilder target buffer overflow");
|
|
4029
|
-
}
|
|
4030
|
-
}
|
|
4031
|
-
};
|
|
4032
|
-
}
|
|
4033
|
-
});
|
|
4034
|
-
|
|
4035
|
-
// ../../node_modules/@math.gl/geospatial/dist/wkb/wkt.js
|
|
4036
|
-
function formatWKT(geometry, dimension) {
|
|
4037
|
-
if (isWKTParseResult(geometry)) {
|
|
4038
|
-
return dimension === void 0 ? formatWKTResult(geometry) : formatWKTGeometry(geometry.geometry, dimension);
|
|
4039
|
-
}
|
|
4040
|
-
return formatWKTGeometry(geometry, dimension ?? inferWellKnownGeometryDimension(geometry));
|
|
4041
|
-
}
|
|
4042
|
-
function formatWKTResult(result) {
|
|
4043
|
-
return formatWKTGeometry(result.geometry, result.dimension, result.children);
|
|
4044
|
-
}
|
|
4045
|
-
function formatWKTGeometry(geometry, dimension, children2) {
|
|
4046
|
-
const dimensionToken = dimension === "xy" ? "" : " " + dimension.slice(2).toUpperCase();
|
|
4047
|
-
if (geometry.type === "GeometryCollection") {
|
|
4048
|
-
if (geometry.geometries.length === 0)
|
|
4049
|
-
return "GEOMETRYCOLLECTION" + dimensionToken + " EMPTY";
|
|
4050
|
-
const formattedChildren = children2 ? children2.map(formatWKTResult) : geometry.geometries.map((child2) => formatWKTGeometry(child2, dimension));
|
|
4051
|
-
return "GEOMETRYCOLLECTION" + dimensionToken + " (" + formattedChildren.join(", ") + ")";
|
|
4052
|
-
}
|
|
4053
|
-
const type = geometry.type.toUpperCase();
|
|
4054
|
-
const isEmpty = geometry.type === "MultiPoint" ? geometry.coordinates.length === 0 : isEmptyCoordinates(geometry.coordinates);
|
|
4055
|
-
if (isEmpty)
|
|
4056
|
-
return type + dimensionToken + " EMPTY";
|
|
4057
|
-
return type + dimensionToken + " " + formatCoordinateNesting(geometry.coordinates, getGeometryDepth(geometry.type), geometry.type === "MultiPoint");
|
|
4058
|
-
}
|
|
4059
|
-
function isWKTParseResult(value2) {
|
|
4060
|
-
return "geometry" in value2 && "dimension" in value2;
|
|
4061
|
-
}
|
|
4062
|
-
function formatCoordinateNesting(value2, depth, allowEmptyPoints = false) {
|
|
4063
|
-
if (depth === 0)
|
|
4064
|
-
return `(${value2.map(formatNumber).join(" ")})`;
|
|
4065
|
-
return `(${value2.map((child2) => {
|
|
4066
|
-
if (depth === 1) {
|
|
4067
|
-
const coordinate = child2;
|
|
4068
|
-
if (allowEmptyPoints && isEmptyCoordinates(coordinate))
|
|
4069
|
-
return "EMPTY";
|
|
4070
|
-
return coordinate.map(formatNumber).join(" ");
|
|
4071
|
-
}
|
|
4072
|
-
return formatCoordinateNesting(child2, depth - 1);
|
|
4073
|
-
}).join(", ")})`;
|
|
4074
|
-
}
|
|
4075
|
-
function formatNumber(value2) {
|
|
4076
|
-
if (!Number.isFinite(value2))
|
|
4077
|
-
return "NaN";
|
|
4078
|
-
return String(value2);
|
|
4079
|
-
}
|
|
4080
|
-
function getGeometryDepth(type) {
|
|
4081
|
-
switch (type) {
|
|
4082
|
-
case "Point":
|
|
4083
|
-
return 0;
|
|
4084
|
-
case "LineString":
|
|
4085
|
-
case "MultiPoint":
|
|
4086
|
-
return 1;
|
|
4087
|
-
case "Polygon":
|
|
4088
|
-
case "MultiLineString":
|
|
4089
|
-
return 2;
|
|
4090
|
-
case "MultiPolygon":
|
|
4091
|
-
return 3;
|
|
4092
|
-
}
|
|
4093
|
-
}
|
|
4094
|
-
function isEmptyCoordinates(value2) {
|
|
4095
|
-
if (value2.length === 0)
|
|
4096
|
-
return true;
|
|
4097
|
-
if (typeof value2[0] === "number") {
|
|
4098
|
-
return value2.every((component) => !Number.isFinite(component));
|
|
4099
|
-
}
|
|
4100
|
-
return value2.every((child2) => isEmptyCoordinates(child2));
|
|
4101
|
-
}
|
|
4102
|
-
var init_wkt = __esm({
|
|
4103
|
-
"../../node_modules/@math.gl/geospatial/dist/wkb/wkt.js"() {
|
|
4104
|
-
init_types();
|
|
4105
|
-
}
|
|
4106
|
-
});
|
|
4107
|
-
|
|
4108
|
-
// ../../node_modules/@math.gl/geospatial/dist/wkb/index.js
|
|
4109
|
-
var init_wkb2 = __esm({
|
|
4110
|
-
"../../node_modules/@math.gl/geospatial/dist/wkb/index.js"() {
|
|
4111
|
-
init_wkb();
|
|
4112
|
-
init_wkb_builder();
|
|
4113
|
-
init_wkt();
|
|
4114
|
-
}
|
|
4115
|
-
});
|
|
4116
|
-
|
|
4117
4214
|
// ../../node_modules/@math.gl/geospatial/dist/projection/experimental/parameters.js
|
|
4118
4215
|
function numberParameter(parameters, name, fallback) {
|
|
4119
4216
|
if (!Object.prototype.hasOwnProperty.call(parameters, name))
|
|
@@ -5804,16 +5901,6 @@
|
|
|
5804
5901
|
}
|
|
5805
5902
|
});
|
|
5806
5903
|
|
|
5807
|
-
// ../../node_modules/@math.gl/geospatial/dist/index.js
|
|
5808
|
-
var init_dist3 = __esm({
|
|
5809
|
-
"../../node_modules/@math.gl/geospatial/dist/index.js"() {
|
|
5810
|
-
init_ellipsoid();
|
|
5811
|
-
init_globe();
|
|
5812
|
-
init_tiles();
|
|
5813
|
-
init_wkb2();
|
|
5814
|
-
}
|
|
5815
|
-
});
|
|
5816
|
-
|
|
5817
5904
|
// ../core/src/loader-utils/index.ts
|
|
5818
5905
|
var init_loader_utils = __esm({
|
|
5819
5906
|
"../core/src/loader-utils/index.ts"() {
|
|
@@ -13473,11 +13560,11 @@ return true;`);
|
|
|
13473
13560
|
this._offsets = new OffsetsBufferBuilder(opts.type);
|
|
13474
13561
|
}
|
|
13475
13562
|
setValue(index, value2) {
|
|
13476
|
-
const
|
|
13477
|
-
const current =
|
|
13563
|
+
const pending2 = this._pending || (this._pending = /* @__PURE__ */ new Map());
|
|
13564
|
+
const current = pending2.get(index);
|
|
13478
13565
|
current && (this._pendingLength -= current.length);
|
|
13479
13566
|
this._pendingLength += value2 instanceof MapRow ? value2[kKeys].length : value2.length;
|
|
13480
|
-
|
|
13567
|
+
pending2.set(index, value2);
|
|
13481
13568
|
}
|
|
13482
13569
|
setValid(index, isValid) {
|
|
13483
13570
|
if (!super.setValid(index, isValid)) {
|
|
@@ -13500,12 +13587,12 @@ return true;`);
|
|
|
13500
13587
|
return super.finish();
|
|
13501
13588
|
}
|
|
13502
13589
|
_flush() {
|
|
13503
|
-
const
|
|
13590
|
+
const pending2 = this._pending;
|
|
13504
13591
|
const pendingLength = this._pendingLength;
|
|
13505
13592
|
this._pendingLength = 0;
|
|
13506
13593
|
this._pending = void 0;
|
|
13507
|
-
if (
|
|
13508
|
-
this._flushPending(
|
|
13594
|
+
if (pending2 && pending2.size > 0) {
|
|
13595
|
+
this._flushPending(pending2, pendingLength);
|
|
13509
13596
|
}
|
|
13510
13597
|
return this;
|
|
13511
13598
|
}
|
|
@@ -16091,11 +16178,11 @@ return true;`);
|
|
|
16091
16178
|
setValue(index, value2) {
|
|
16092
16179
|
return super.setValue(index, toUint8Array(value2));
|
|
16093
16180
|
}
|
|
16094
|
-
_flushPending(
|
|
16181
|
+
_flushPending(pending2, pendingLength) {
|
|
16095
16182
|
const offsets = this._offsets;
|
|
16096
16183
|
const data = this._values.reserve(pendingLength).buffer;
|
|
16097
16184
|
let offset = 0;
|
|
16098
|
-
for (const [index, value2] of
|
|
16185
|
+
for (const [index, value2] of pending2) {
|
|
16099
16186
|
if (value2 === void 0) {
|
|
16100
16187
|
offsets.set(index, 0);
|
|
16101
16188
|
} else {
|
|
@@ -16132,11 +16219,11 @@ return true;`);
|
|
|
16132
16219
|
setValue(index, value2) {
|
|
16133
16220
|
return super.setValue(index, toUint8Array(value2));
|
|
16134
16221
|
}
|
|
16135
|
-
_flushPending(
|
|
16222
|
+
_flushPending(pending2, pendingLength) {
|
|
16136
16223
|
const offsets = this._offsets;
|
|
16137
16224
|
const data = this._values.reserve(pendingLength).buffer;
|
|
16138
16225
|
let offset = 0;
|
|
16139
|
-
for (const [index, value2] of
|
|
16226
|
+
for (const [index, value2] of pending2) {
|
|
16140
16227
|
if (value2 === void 0) {
|
|
16141
16228
|
offsets.set(index, BigInt(0));
|
|
16142
16229
|
} else {
|
|
@@ -16447,10 +16534,10 @@ return true;`);
|
|
|
16447
16534
|
this.type = new List2(new Field2(name, child2.type, true));
|
|
16448
16535
|
return this.numChildren - 1;
|
|
16449
16536
|
}
|
|
16450
|
-
_flushPending(
|
|
16537
|
+
_flushPending(pending2) {
|
|
16451
16538
|
const offsets = this._offsets;
|
|
16452
16539
|
const [child2] = this.children;
|
|
16453
|
-
for (const [index, value2] of
|
|
16540
|
+
for (const [index, value2] of pending2) {
|
|
16454
16541
|
if (typeof value2 === "undefined") {
|
|
16455
16542
|
offsets.set(index, 0);
|
|
16456
16543
|
} else {
|
|
@@ -16489,10 +16576,10 @@ return true;`);
|
|
|
16489
16576
|
this.type = new LargeList2(new Field2(name, child2.type, true));
|
|
16490
16577
|
return this.numChildren - 1;
|
|
16491
16578
|
}
|
|
16492
|
-
_flushPending(
|
|
16579
|
+
_flushPending(pending2) {
|
|
16493
16580
|
const offsets = this._offsets;
|
|
16494
16581
|
const [child2] = this.children;
|
|
16495
|
-
for (const [index, value2] of
|
|
16582
|
+
for (const [index, value2] of pending2) {
|
|
16496
16583
|
if (typeof value2 === "undefined") {
|
|
16497
16584
|
offsets.set(index, BigInt(0));
|
|
16498
16585
|
} else {
|
|
@@ -16522,11 +16609,11 @@ return true;`);
|
|
|
16522
16609
|
}
|
|
16523
16610
|
setValue(index, value2) {
|
|
16524
16611
|
const row = value2 instanceof Map ? value2 : new Map(Object.entries(value2));
|
|
16525
|
-
const
|
|
16526
|
-
const current =
|
|
16612
|
+
const pending2 = this._pending || (this._pending = /* @__PURE__ */ new Map());
|
|
16613
|
+
const current = pending2.get(index);
|
|
16527
16614
|
current && (this._pendingLength -= current.size);
|
|
16528
16615
|
this._pendingLength += row.size;
|
|
16529
|
-
|
|
16616
|
+
pending2.set(index, row);
|
|
16530
16617
|
}
|
|
16531
16618
|
addChild(child2, name = `${this.numChildren}`) {
|
|
16532
16619
|
if (this.numChildren > 0) {
|
|
@@ -16536,10 +16623,10 @@ return true;`);
|
|
|
16536
16623
|
this.type = new Map_(new Field2(name, child2.type, true), this.type.keysSorted);
|
|
16537
16624
|
return this.numChildren - 1;
|
|
16538
16625
|
}
|
|
16539
|
-
_flushPending(
|
|
16626
|
+
_flushPending(pending2) {
|
|
16540
16627
|
const offsets = this._offsets;
|
|
16541
16628
|
const [child2] = this.children;
|
|
16542
|
-
for (const [index, value2] of
|
|
16629
|
+
for (const [index, value2] of pending2) {
|
|
16543
16630
|
if (value2 === void 0) {
|
|
16544
16631
|
offsets.set(index, 0);
|
|
16545
16632
|
} else {
|
|
@@ -16748,7 +16835,7 @@ return true;`);
|
|
|
16748
16835
|
return super.setValue(index, encodeUtf8(value2));
|
|
16749
16836
|
}
|
|
16750
16837
|
// @ts-ignore
|
|
16751
|
-
_flushPending(
|
|
16838
|
+
_flushPending(pending2, pendingLength) {
|
|
16752
16839
|
}
|
|
16753
16840
|
};
|
|
16754
16841
|
Utf8Builder.prototype._flushPending = BinaryBuilder.prototype._flushPending;
|
|
@@ -16779,7 +16866,7 @@ return true;`);
|
|
|
16779
16866
|
return super.setValue(index, encodeUtf8(value2));
|
|
16780
16867
|
}
|
|
16781
16868
|
// @ts-ignore
|
|
16782
|
-
_flushPending(
|
|
16869
|
+
_flushPending(pending2, pendingLength) {
|
|
16783
16870
|
}
|
|
16784
16871
|
};
|
|
16785
16872
|
LargeUtf8Builder.prototype._flushPending = LargeBinaryBuilder.prototype._flushPending;
|
|
@@ -18491,8 +18578,8 @@ return true;`);
|
|
|
18491
18578
|
});
|
|
18492
18579
|
|
|
18493
18580
|
// ../../node_modules/apache-arrow/ipc/reader.mjs
|
|
18494
|
-
function shouldAutoDestroy(
|
|
18495
|
-
return options && typeof options["autoDestroy"] === "boolean" ? options["autoDestroy"] :
|
|
18581
|
+
function shouldAutoDestroy(self2, options) {
|
|
18582
|
+
return options && typeof options["autoDestroy"] === "boolean" ? options["autoDestroy"] : self2["autoDestroy"];
|
|
18496
18583
|
}
|
|
18497
18584
|
function* readAllSync(source) {
|
|
18498
18585
|
const reader = RecordBatchReader.from(source);
|
|
@@ -20821,7 +20908,7 @@ return true;`);
|
|
|
20821
20908
|
throw new TypeScriptCRSError("missing-transform-stage", message);
|
|
20822
20909
|
}
|
|
20823
20910
|
var _a5, CRS_ERROR, TypeScriptCRSError;
|
|
20824
|
-
var
|
|
20911
|
+
var init_types = __esm({
|
|
20825
20912
|
"../../node_modules/@math.gl/geospatial/dist/projection/experimental/crs/types.js"() {
|
|
20826
20913
|
CRS_ERROR = /* @__PURE__ */ Symbol.for("@math.gl/projection/TypeScriptCRSError");
|
|
20827
20914
|
TypeScriptCRSError = class _TypeScriptCRSError extends Error {
|
|
@@ -20915,7 +21002,7 @@ return true;`);
|
|
|
20915
21002
|
}
|
|
20916
21003
|
var init_spatial_reference2 = __esm({
|
|
20917
21004
|
"../../node_modules/@math.gl/geospatial/dist/projection/experimental/crs/spatial-reference.js"() {
|
|
20918
|
-
|
|
21005
|
+
init_types();
|
|
20919
21006
|
}
|
|
20920
21007
|
});
|
|
20921
21008
|
|
|
@@ -21425,7 +21512,7 @@ return true;`);
|
|
|
21425
21512
|
init_ellipsoid_table();
|
|
21426
21513
|
init_primemeridian_table();
|
|
21427
21514
|
init_crs_metadata();
|
|
21428
|
-
|
|
21515
|
+
init_types();
|
|
21429
21516
|
ALIASES = {
|
|
21430
21517
|
WGS84: "+proj=longlat +datum=WGS84",
|
|
21431
21518
|
"EPSG:4326": "+proj=longlat +datum=WGS84",
|
|
@@ -21596,7 +21683,7 @@ return true;`);
|
|
|
21596
21683
|
var ARC_SECOND, WGS84;
|
|
21597
21684
|
var init_datum = __esm({
|
|
21598
21685
|
"../../node_modules/@math.gl/geospatial/dist/projection/experimental/datum.js"() {
|
|
21599
|
-
|
|
21686
|
+
init_dist2();
|
|
21600
21687
|
ARC_SECOND = Math.PI / (180 * 3600);
|
|
21601
21688
|
WGS84 = {
|
|
21602
21689
|
ellipsoid: {
|
|
@@ -21666,7 +21753,60 @@ return true;`);
|
|
|
21666
21753
|
}
|
|
21667
21754
|
var init_vertical_datum = __esm({
|
|
21668
21755
|
"../../node_modules/@math.gl/geospatial/dist/projection/experimental/vertical-datum.js"() {
|
|
21669
|
-
|
|
21756
|
+
init_types();
|
|
21757
|
+
}
|
|
21758
|
+
});
|
|
21759
|
+
|
|
21760
|
+
// ../../node_modules/@math.gl/geospatial/dist/projection/experimental/transform-description.js
|
|
21761
|
+
function describeCRS(crs) {
|
|
21762
|
+
const ellipsoid = Object.freeze({ ...crs.ellipsoid });
|
|
21763
|
+
return Object.freeze({
|
|
21764
|
+
kind: crs.kind,
|
|
21765
|
+
projection: crs.projection,
|
|
21766
|
+
parameters: Object.freeze(Object.fromEntries(Object.entries(crs.parameters).map(([name, value2]) => [name, value2 ?? null]))),
|
|
21767
|
+
ellipsoid,
|
|
21768
|
+
datum: Object.freeze({
|
|
21769
|
+
ellipsoid: Object.freeze({ ...crs.datum.ellipsoid }),
|
|
21770
|
+
towgs84: crs.datum.towgs84 && Object.freeze([...crs.datum.towgs84]),
|
|
21771
|
+
grids: crs.datum.grids && Object.freeze(crs.datum.grids.map((reference) => Object.freeze({
|
|
21772
|
+
name: reference.name,
|
|
21773
|
+
optional: reference.optional,
|
|
21774
|
+
loaded: Boolean(reference.grid)
|
|
21775
|
+
})))
|
|
21776
|
+
}),
|
|
21777
|
+
angularUnit: crs.angularUnit,
|
|
21778
|
+
toMeter: crs.toMeter,
|
|
21779
|
+
verticalUnit: crs.verticalUnit,
|
|
21780
|
+
primeMeridian: crs.primeMeridian,
|
|
21781
|
+
axis: crs.axis,
|
|
21782
|
+
storedAxis: crs.storedAxis,
|
|
21783
|
+
longitudeWrap: crs.longitudeWrap,
|
|
21784
|
+
areaOfUse: crs.areaOfUse && Object.freeze([...crs.areaOfUse]),
|
|
21785
|
+
lossy: crs.lossy,
|
|
21786
|
+
algorithm: crs.algorithm && Object.freeze({ ...crs.algorithm })
|
|
21787
|
+
});
|
|
21788
|
+
}
|
|
21789
|
+
function describeTransform(source, target, forward33, inverse33) {
|
|
21790
|
+
const opaqueReasons = [];
|
|
21791
|
+
if (!source.algorithm)
|
|
21792
|
+
opaqueReasons.push("source-algorithm");
|
|
21793
|
+
if (!target.algorithm)
|
|
21794
|
+
opaqueReasons.push("target-algorithm");
|
|
21795
|
+
if (source.datum.grids || target.datum.grids || source.parameters["geoidgrids"] || target.parameters["geoidgrids"])
|
|
21796
|
+
opaqueReasons.push("grid-resource");
|
|
21797
|
+
return Object.freeze({
|
|
21798
|
+
version: 1,
|
|
21799
|
+
source,
|
|
21800
|
+
target,
|
|
21801
|
+
forward: forward33,
|
|
21802
|
+
inverse: inverse33,
|
|
21803
|
+
lossy: source.lossy || target.lossy,
|
|
21804
|
+
complete: opaqueReasons.length === 0,
|
|
21805
|
+
opaqueReasons: Object.freeze(opaqueReasons)
|
|
21806
|
+
});
|
|
21807
|
+
}
|
|
21808
|
+
var init_transform_description = __esm({
|
|
21809
|
+
"../../node_modules/@math.gl/geospatial/dist/projection/experimental/transform-description.js"() {
|
|
21670
21810
|
}
|
|
21671
21811
|
});
|
|
21672
21812
|
|
|
@@ -21739,7 +21879,8 @@ return true;`);
|
|
|
21739
21879
|
const verticalGrid = compileVerticalGrid(crs.parameters["geoidgrids"], options.verticalGrids);
|
|
21740
21880
|
if (verticalGrid && (crs.kind === "geocentric" || crs.kind === "identity" || crs.lossy))
|
|
21741
21881
|
unsupportedStage("Vertical grids require a non-lossy geographic or projected CRS");
|
|
21742
|
-
|
|
21882
|
+
const algorithm = plugin ? plugin.semantics : { id: "@math.gl/geospatial/" + crs.kind, version: 1 };
|
|
21883
|
+
return { ...crs, datum, implementation, verticalGrid, algorithm };
|
|
21743
21884
|
}
|
|
21744
21885
|
function finite(point) {
|
|
21745
21886
|
return Number.isFinite(point.x) && Number.isFinite(point.y) && Number.isFinite(point.z);
|
|
@@ -21782,9 +21923,51 @@ return true;`);
|
|
|
21782
21923
|
if (from.kind === "projected" && to.kind === "geographic")
|
|
21783
21924
|
flat = from.implementation?.createInverseFlat?.(context);
|
|
21784
21925
|
}
|
|
21926
|
+
const requiresInputZ = Boolean(from.verticalGrid || to.verticalGrid) || from.kind === "geocentric" || /[ud]/.test(fromAxis.slice(0, 2)) || /[ud]/.test(toAxis.slice(0, 2));
|
|
21927
|
+
const stages = [];
|
|
21928
|
+
if (inputAxis)
|
|
21929
|
+
stages.push("input-axis");
|
|
21930
|
+
if (horizontalOnly)
|
|
21931
|
+
stages.push("discard-height");
|
|
21932
|
+
if (inputScale !== 1)
|
|
21933
|
+
stages.push("input-scale");
|
|
21934
|
+
if (source)
|
|
21935
|
+
stages.push("source-inverse");
|
|
21936
|
+
if (inputVerticalScale !== 1)
|
|
21937
|
+
stages.push("input-height-scale");
|
|
21938
|
+
stages.push("geographic-domain-check");
|
|
21939
|
+
if (fromPrime)
|
|
21940
|
+
stages.push("source-prime-meridian");
|
|
21941
|
+
if (from.verticalGrid)
|
|
21942
|
+
stages.push("source-vertical-grid");
|
|
21943
|
+
if (datum)
|
|
21944
|
+
stages.push("datum");
|
|
21945
|
+
if (to.verticalGrid)
|
|
21946
|
+
stages.push("target-vertical-grid");
|
|
21947
|
+
if (toPrime)
|
|
21948
|
+
stages.push("target-prime-meridian");
|
|
21949
|
+
if (longitudeWrap !== void 0)
|
|
21950
|
+
stages.push("longitude-wrap");
|
|
21951
|
+
if (target)
|
|
21952
|
+
stages.push("target-forward");
|
|
21953
|
+
if (outputScale !== 1)
|
|
21954
|
+
stages.push("output-scale");
|
|
21955
|
+
if (outputVerticalScale !== 1)
|
|
21956
|
+
stages.push("output-height-scale");
|
|
21957
|
+
if (horizontalOnly)
|
|
21958
|
+
stages.push("restore-height");
|
|
21959
|
+
if (outputAxis)
|
|
21960
|
+
stages.push("output-axis");
|
|
21785
21961
|
return {
|
|
21962
|
+
description: Object.freeze({
|
|
21963
|
+
inputAxis: fromAxis,
|
|
21964
|
+
outputAxis: toAxis,
|
|
21965
|
+
requiresInputZ,
|
|
21966
|
+
geocentricOutput: to.kind === "geocentric",
|
|
21967
|
+
stages: Object.freeze(stages)
|
|
21968
|
+
}),
|
|
21786
21969
|
flat,
|
|
21787
|
-
requiresInputZ
|
|
21970
|
+
requiresInputZ,
|
|
21788
21971
|
geocentricOutput: to.kind === "geocentric",
|
|
21789
21972
|
run(point) {
|
|
21790
21973
|
if (!finite(point))
|
|
@@ -21893,11 +22076,12 @@ return true;`);
|
|
|
21893
22076
|
init_projection_scratch();
|
|
21894
22077
|
init_scalar_output();
|
|
21895
22078
|
init_normalize();
|
|
21896
|
-
|
|
22079
|
+
init_types();
|
|
21897
22080
|
init_datum();
|
|
21898
22081
|
init_parameters();
|
|
21899
22082
|
init_geographic_rendering_profile();
|
|
21900
22083
|
init_vertical_datum();
|
|
22084
|
+
init_transform_description();
|
|
21901
22085
|
ProjectionTransform = class _ProjectionTransform {
|
|
21902
22086
|
/** Resolve required descriptors once, then return an ordinary synchronous instance. */
|
|
21903
22087
|
static async create(options = {}) {
|
|
@@ -21911,6 +22095,10 @@ return true;`);
|
|
|
21911
22095
|
getTargetRenderingProfile(coverage) {
|
|
21912
22096
|
return this.targetRenderingProfile && resolveRenderingProfile(this.targetRenderingProfile, coverage);
|
|
21913
22097
|
}
|
|
22098
|
+
/** Deferred transforms expose metadata only once their implementations are prepared. */
|
|
22099
|
+
get description() {
|
|
22100
|
+
return this.deferred?.implementation?.description ?? this.resolvedDescription;
|
|
22101
|
+
}
|
|
21914
22102
|
constructor(options = {}) {
|
|
21915
22103
|
this.coordinateScratch = new ProjectionScratch();
|
|
21916
22104
|
this.targetLongitudeOrigin = 0;
|
|
@@ -21936,6 +22124,7 @@ return true;`);
|
|
|
21936
22124
|
unsupportedStage("Horizontal extraction cannot be combined with vertical grids");
|
|
21937
22125
|
this.forwardTransform = compileTransform(from, to, Boolean(options.enforceAxis));
|
|
21938
22126
|
this.inverseTransform = compileTransform(to, from, Boolean(options.enforceAxis));
|
|
22127
|
+
this.resolvedDescription = describeTransform(describeCRS(from), describeCRS(to), this.forwardTransform.description, this.inverseTransform.description);
|
|
21939
22128
|
}
|
|
21940
22129
|
this.project = this.project.bind(this);
|
|
21941
22130
|
this.unproject = this.unproject.bind(this);
|
|
@@ -22447,6 +22636,7 @@ return true;`);
|
|
|
22447
22636
|
init_rendering_bounds();
|
|
22448
22637
|
mercator = {
|
|
22449
22638
|
name: "merc",
|
|
22639
|
+
semantics: { id: "@math.gl/geospatial/merc", version: 1 },
|
|
22450
22640
|
aliases: [
|
|
22451
22641
|
"Mercator",
|
|
22452
22642
|
"Popular Visualisation Pseudo Mercator",
|
|
@@ -22540,6 +22730,7 @@ return true;`);
|
|
|
22540
22730
|
init_rendering_bounds();
|
|
22541
22731
|
equidistantCylindrical = {
|
|
22542
22732
|
name: "eqc",
|
|
22733
|
+
semantics: { id: "@math.gl/geospatial/eqc", version: 1 },
|
|
22543
22734
|
aliases: ["Equirectangular", "Equidistant_Cylindrical", "Equidistant_Cylindrical_Spherical"],
|
|
22544
22735
|
parameters: ["lon_0", "lat_0", "lat_ts", "x_0", "y_0"],
|
|
22545
22736
|
create({ semiMajorAxis: a, parameters, primeMeridian: primeMeridian2 = 0 }) {
|
|
@@ -27487,7 +27678,7 @@ return true;`);
|
|
|
27487
27678
|
init_geographic_rendering_profile();
|
|
27488
27679
|
init_parameters();
|
|
27489
27680
|
init_rendering_profile();
|
|
27490
|
-
|
|
27681
|
+
init_types();
|
|
27491
27682
|
init_rectangular_rendering_profile();
|
|
27492
27683
|
init_geographic_bounds();
|
|
27493
27684
|
init_spherical_rendering_domain();
|
|
@@ -27840,7 +28031,7 @@ return true;`);
|
|
|
27840
28031
|
"../../node_modules/@math.gl/geospatial/dist/projection/experimental/crs/structured.js"() {
|
|
27841
28032
|
init_datum_catalog();
|
|
27842
28033
|
init_parameters();
|
|
27843
|
-
|
|
28034
|
+
init_types();
|
|
27844
28035
|
METHODS = {
|
|
27845
28036
|
hotineobliquemercator: "omerc",
|
|
27846
28037
|
hotineobliquemercatorvarianta: "omerc",
|
|
@@ -28126,11 +28317,11 @@ return true;`);
|
|
|
28126
28317
|
return result;
|
|
28127
28318
|
}
|
|
28128
28319
|
var wktCRSParser;
|
|
28129
|
-
var
|
|
28320
|
+
var init_wkt = __esm({
|
|
28130
28321
|
"../../node_modules/@math.gl/geospatial/dist/projection/experimental/crs/wkt.js"() {
|
|
28131
28322
|
init_spatial_reference();
|
|
28132
28323
|
init_wkt_crs();
|
|
28133
|
-
|
|
28324
|
+
init_types();
|
|
28134
28325
|
init_structured();
|
|
28135
28326
|
wktCRSParser = {
|
|
28136
28327
|
name: "wkt",
|
|
@@ -28213,7 +28404,7 @@ return true;`);
|
|
|
28213
28404
|
init_tpers2();
|
|
28214
28405
|
init_vandg2();
|
|
28215
28406
|
init_ob_tran();
|
|
28216
|
-
|
|
28407
|
+
init_wkt();
|
|
28217
28408
|
init_projjson();
|
|
28218
28409
|
init_projection_pipeline();
|
|
28219
28410
|
}
|
|
@@ -29877,7 +30068,7 @@ return true;`);
|
|
|
29877
30068
|
var init_convert_geojson_to_flat_geojson = __esm({
|
|
29878
30069
|
"../core/src/arrow-geometry/legacy-binary/convert-geojson-to-flat-geojson.ts"() {
|
|
29879
30070
|
"use strict";
|
|
29880
|
-
|
|
30071
|
+
init_dist3();
|
|
29881
30072
|
}
|
|
29882
30073
|
});
|
|
29883
30074
|
|
|
@@ -30171,7 +30362,7 @@ return true;`);
|
|
|
30171
30362
|
var init_convert_flat_geojson_to_binary_features = __esm({
|
|
30172
30363
|
"../core/src/arrow-geometry/legacy-binary/convert-flat-geojson-to-binary-features.ts"() {
|
|
30173
30364
|
"use strict";
|
|
30174
|
-
|
|
30365
|
+
init_dist3();
|
|
30175
30366
|
}
|
|
30176
30367
|
});
|
|
30177
30368
|
|
|
@@ -30229,6 +30420,469 @@ return true;`);
|
|
|
30229
30420
|
}
|
|
30230
30421
|
});
|
|
30231
30422
|
|
|
30423
|
+
// ../../node_modules/@math.gl/arrow/dist/wkb/types.js
|
|
30424
|
+
function getWellKnownDimensionSize(dimension) {
|
|
30425
|
+
switch (dimension) {
|
|
30426
|
+
case "xy":
|
|
30427
|
+
return 2;
|
|
30428
|
+
case "xyz":
|
|
30429
|
+
case "xym":
|
|
30430
|
+
return 3;
|
|
30431
|
+
case "xyzm":
|
|
30432
|
+
return 4;
|
|
30433
|
+
}
|
|
30434
|
+
}
|
|
30435
|
+
function inferWellKnownGeometryDimension(geometry) {
|
|
30436
|
+
const size = getGeometryDimensionSize(geometry);
|
|
30437
|
+
return size >= 4 ? "xyzm" : size === 3 ? "xyz" : "xy";
|
|
30438
|
+
}
|
|
30439
|
+
function getGeometryDimensionSize(geometry) {
|
|
30440
|
+
if (geometry.type === "GeometryCollection") {
|
|
30441
|
+
return Math.max(2, ...geometry.geometries.map(getGeometryDimensionSize));
|
|
30442
|
+
}
|
|
30443
|
+
return getCoordinateDimension(geometry.coordinates);
|
|
30444
|
+
}
|
|
30445
|
+
function getCoordinateDimension(value2) {
|
|
30446
|
+
if (value2.length === 0)
|
|
30447
|
+
return 2;
|
|
30448
|
+
if (typeof value2[0] === "number")
|
|
30449
|
+
return value2.length;
|
|
30450
|
+
return Math.max(2, ...value2.map((child2) => getCoordinateDimension(child2)));
|
|
30451
|
+
}
|
|
30452
|
+
var init_types2 = __esm({
|
|
30453
|
+
"../../node_modules/@math.gl/arrow/dist/wkb/types.js"() {
|
|
30454
|
+
}
|
|
30455
|
+
});
|
|
30456
|
+
|
|
30457
|
+
// ../../node_modules/@math.gl/arrow/dist/wkb/wkb.js
|
|
30458
|
+
function writeWKB(geometry, dimension = inferWellKnownGeometryDimension(geometry)) {
|
|
30459
|
+
const bytes = [];
|
|
30460
|
+
writeWKBGeometry(bytes, geometry, dimension);
|
|
30461
|
+
return Uint8Array.from(bytes);
|
|
30462
|
+
}
|
|
30463
|
+
function writeWKBGeometry(bytes, geometry, dimension) {
|
|
30464
|
+
bytes.push(1);
|
|
30465
|
+
const size = getWellKnownDimensionSize(dimension);
|
|
30466
|
+
const dimensionOffset = dimension === "xyz" ? 1e3 : dimension === "xym" ? 2e3 : dimension === "xyzm" ? 3e3 : 0;
|
|
30467
|
+
writeUint32(bytes, getWKBType(geometry.type) + dimensionOffset);
|
|
30468
|
+
const writeCoordinate = (coordinate) => {
|
|
30469
|
+
for (let index = 0; index < size; index++)
|
|
30470
|
+
writeFloat64(bytes, coordinate[index] ?? 0);
|
|
30471
|
+
};
|
|
30472
|
+
const writeCoordinates = (coordinates) => {
|
|
30473
|
+
writeUint32(bytes, coordinates.length);
|
|
30474
|
+
for (const coordinate of coordinates)
|
|
30475
|
+
writeCoordinate(coordinate);
|
|
30476
|
+
};
|
|
30477
|
+
switch (geometry.type) {
|
|
30478
|
+
case "Point":
|
|
30479
|
+
writeCoordinate(geometry.coordinates.length === 0 ? new Array(size).fill(Number.NaN) : geometry.coordinates);
|
|
30480
|
+
break;
|
|
30481
|
+
case "LineString":
|
|
30482
|
+
writeCoordinates(geometry.coordinates);
|
|
30483
|
+
break;
|
|
30484
|
+
case "Polygon":
|
|
30485
|
+
writeUint32(bytes, geometry.coordinates.length);
|
|
30486
|
+
for (const ring of geometry.coordinates)
|
|
30487
|
+
writeCoordinates(ring);
|
|
30488
|
+
break;
|
|
30489
|
+
case "MultiPoint":
|
|
30490
|
+
writeUint32(bytes, geometry.coordinates.length);
|
|
30491
|
+
for (const coordinate of geometry.coordinates) {
|
|
30492
|
+
writeWKBGeometry(bytes, { type: "Point", coordinates: coordinate }, dimension);
|
|
30493
|
+
}
|
|
30494
|
+
break;
|
|
30495
|
+
case "MultiLineString":
|
|
30496
|
+
writeUint32(bytes, geometry.coordinates.length);
|
|
30497
|
+
for (const coordinates of geometry.coordinates) {
|
|
30498
|
+
writeWKBGeometry(bytes, { type: "LineString", coordinates }, dimension);
|
|
30499
|
+
}
|
|
30500
|
+
break;
|
|
30501
|
+
case "MultiPolygon":
|
|
30502
|
+
writeUint32(bytes, geometry.coordinates.length);
|
|
30503
|
+
for (const coordinates of geometry.coordinates) {
|
|
30504
|
+
writeWKBGeometry(bytes, { type: "Polygon", coordinates }, dimension);
|
|
30505
|
+
}
|
|
30506
|
+
break;
|
|
30507
|
+
case "GeometryCollection":
|
|
30508
|
+
writeUint32(bytes, geometry.geometries.length);
|
|
30509
|
+
for (const child2 of geometry.geometries)
|
|
30510
|
+
writeWKBGeometry(bytes, child2, dimension);
|
|
30511
|
+
break;
|
|
30512
|
+
}
|
|
30513
|
+
}
|
|
30514
|
+
function getWKBType(type) {
|
|
30515
|
+
return [
|
|
30516
|
+
"Point",
|
|
30517
|
+
"LineString",
|
|
30518
|
+
"Polygon",
|
|
30519
|
+
"MultiPoint",
|
|
30520
|
+
"MultiLineString",
|
|
30521
|
+
"MultiPolygon",
|
|
30522
|
+
"GeometryCollection"
|
|
30523
|
+
].indexOf(type) + 1;
|
|
30524
|
+
}
|
|
30525
|
+
function writeUint32(bytes, value2) {
|
|
30526
|
+
bytes.push(value2 & 255, value2 >>> 8 & 255, value2 >>> 16 & 255, value2 >>> 24 & 255);
|
|
30527
|
+
}
|
|
30528
|
+
function writeFloat64(bytes, value2) {
|
|
30529
|
+
const buffer = new ArrayBuffer(8);
|
|
30530
|
+
new DataView(buffer).setFloat64(0, value2, true);
|
|
30531
|
+
bytes.push(...new Uint8Array(buffer));
|
|
30532
|
+
}
|
|
30533
|
+
var init_wkb = __esm({
|
|
30534
|
+
"../../node_modules/@math.gl/arrow/dist/wkb/wkb.js"() {
|
|
30535
|
+
init_types2();
|
|
30536
|
+
}
|
|
30537
|
+
});
|
|
30538
|
+
|
|
30539
|
+
// ../../node_modules/@math.gl/arrow/dist/wkb/wkb-builder.js
|
|
30540
|
+
function measureGeometry(geometryWriter, options) {
|
|
30541
|
+
const builder = new WKBBuilder({ ...options, mode: "measure" });
|
|
30542
|
+
geometryWriter(builder);
|
|
30543
|
+
return builder.finishGeometry();
|
|
30544
|
+
}
|
|
30545
|
+
function getTargetDataView(target) {
|
|
30546
|
+
return ArrayBuffer.isView(target) ? new DataView(target.buffer, target.byteOffset, target.byteLength) : new DataView(target);
|
|
30547
|
+
}
|
|
30548
|
+
function getWKBTypeCode(geometryType, dimension, hasSrid) {
|
|
30549
|
+
const geometryCode = GEOMETRY_TYPE_CODES[geometryType];
|
|
30550
|
+
if (hasSrid) {
|
|
30551
|
+
const dimensionFlags = dimension === "xyz" ? 2147483648 : dimension === "xym" ? 1073741824 : dimension === "xyzm" ? 3221225472 : 0;
|
|
30552
|
+
return (geometryCode | dimensionFlags | 536870912) >>> 0;
|
|
30553
|
+
}
|
|
30554
|
+
const dimensionOffset = dimension === "xyz" ? 1e3 : dimension === "xym" ? 2e3 : dimension === "xyzm" ? 3e3 : 0;
|
|
30555
|
+
return geometryCode + dimensionOffset;
|
|
30556
|
+
}
|
|
30557
|
+
function makeCoordinate(dimension, x, y, z, m) {
|
|
30558
|
+
switch (dimension) {
|
|
30559
|
+
case "xy":
|
|
30560
|
+
return [x, y];
|
|
30561
|
+
case "xyz":
|
|
30562
|
+
return [x, y, z ?? Number.NaN];
|
|
30563
|
+
case "xym":
|
|
30564
|
+
return [x, y, m ?? Number.NaN];
|
|
30565
|
+
case "xyzm":
|
|
30566
|
+
return [x, y, z ?? Number.NaN, m ?? Number.NaN];
|
|
30567
|
+
}
|
|
30568
|
+
}
|
|
30569
|
+
function getDimensionSize(dimension) {
|
|
30570
|
+
return dimension === "xy" ? 2 : dimension === "xyzm" ? 4 : 3;
|
|
30571
|
+
}
|
|
30572
|
+
function validateSrid(srid) {
|
|
30573
|
+
if (srid !== void 0 && (!Number.isSafeInteger(srid) || srid < 0 || srid > 4294967295)) {
|
|
30574
|
+
throw new Error("WKBBuilder srid must be an unsigned 32-bit integer");
|
|
30575
|
+
}
|
|
30576
|
+
}
|
|
30577
|
+
function makeNullBitmap(geometryWriters) {
|
|
30578
|
+
const nullBitmap = new Uint8Array(Math.ceil(geometryWriters.length / 8));
|
|
30579
|
+
let nullCount = 0;
|
|
30580
|
+
for (let geometryIndex = 0; geometryIndex < geometryWriters.length; geometryIndex++) {
|
|
30581
|
+
if (geometryWriters[geometryIndex]) {
|
|
30582
|
+
nullBitmap[geometryIndex >> 3] |= 1 << (geometryIndex & 7);
|
|
30583
|
+
} else {
|
|
30584
|
+
nullCount++;
|
|
30585
|
+
}
|
|
30586
|
+
}
|
|
30587
|
+
return { nullBitmap, nullCount };
|
|
30588
|
+
}
|
|
30589
|
+
var GEOMETRY_TYPE_CODES, WKBBuilder;
|
|
30590
|
+
var init_wkb_builder = __esm({
|
|
30591
|
+
"../../node_modules/@math.gl/arrow/dist/wkb/wkb-builder.js"() {
|
|
30592
|
+
GEOMETRY_TYPE_CODES = {
|
|
30593
|
+
Point: 1,
|
|
30594
|
+
LineString: 2,
|
|
30595
|
+
Polygon: 3,
|
|
30596
|
+
MultiPoint: 4,
|
|
30597
|
+
MultiLineString: 5,
|
|
30598
|
+
MultiPolygon: 6,
|
|
30599
|
+
GeometryCollection: 7
|
|
30600
|
+
};
|
|
30601
|
+
WKBBuilder = class _WKBBuilder {
|
|
30602
|
+
constructor(options) {
|
|
30603
|
+
this.mode = options.mode;
|
|
30604
|
+
this.dimension = options.dimension ?? "xy";
|
|
30605
|
+
this.littleEndian = options.byteOrder !== "big-endian";
|
|
30606
|
+
this.srid = options.srid;
|
|
30607
|
+
this.transform = options.transform;
|
|
30608
|
+
validateSrid(this.srid);
|
|
30609
|
+
if (options.mode === "write") {
|
|
30610
|
+
const dataView = getTargetDataView(options.target);
|
|
30611
|
+
const byteOffset = options.byteOffset ?? 0;
|
|
30612
|
+
if (!Number.isSafeInteger(byteOffset) || byteOffset < 0 || byteOffset > dataView.byteLength) {
|
|
30613
|
+
throw new Error("WKBBuilder byteOffset is outside the target");
|
|
30614
|
+
}
|
|
30615
|
+
this.dataView = dataView;
|
|
30616
|
+
this.startByteOffset = byteOffset;
|
|
30617
|
+
this.endByteOffset = dataView.byteLength;
|
|
30618
|
+
this.byteOffset = byteOffset;
|
|
30619
|
+
} else {
|
|
30620
|
+
this.dataView = null;
|
|
30621
|
+
this.startByteOffset = 0;
|
|
30622
|
+
this.endByteOffset = Number.POSITIVE_INFINITY;
|
|
30623
|
+
this.byteOffset = 0;
|
|
30624
|
+
}
|
|
30625
|
+
}
|
|
30626
|
+
/** Begins a geometry and writes its count field when required. */
|
|
30627
|
+
beginGeometry(type, count) {
|
|
30628
|
+
switch (type) {
|
|
30629
|
+
case "Point":
|
|
30630
|
+
this.beginPoint();
|
|
30631
|
+
break;
|
|
30632
|
+
case "LineString":
|
|
30633
|
+
this.beginLineString(count ?? 0);
|
|
30634
|
+
break;
|
|
30635
|
+
case "Polygon":
|
|
30636
|
+
this.beginPolygon(count ?? 0);
|
|
30637
|
+
break;
|
|
30638
|
+
case "MultiPoint":
|
|
30639
|
+
this.beginMultiPoint(count ?? 0);
|
|
30640
|
+
break;
|
|
30641
|
+
case "MultiLineString":
|
|
30642
|
+
this.beginMultiLineString(count ?? 0);
|
|
30643
|
+
break;
|
|
30644
|
+
case "MultiPolygon":
|
|
30645
|
+
this.beginMultiPolygon(count ?? 0);
|
|
30646
|
+
break;
|
|
30647
|
+
case "GeometryCollection":
|
|
30648
|
+
this.writeHeader("GeometryCollection");
|
|
30649
|
+
this.writeUint32(count ?? 0);
|
|
30650
|
+
break;
|
|
30651
|
+
}
|
|
30652
|
+
}
|
|
30653
|
+
/** Begins one point geometry. */
|
|
30654
|
+
beginPoint() {
|
|
30655
|
+
this.writeHeader("Point");
|
|
30656
|
+
}
|
|
30657
|
+
/** Begins one linestring geometry. */
|
|
30658
|
+
beginLineString(pointCount) {
|
|
30659
|
+
this.writeHeader("LineString");
|
|
30660
|
+
this.writeUint32(pointCount);
|
|
30661
|
+
}
|
|
30662
|
+
/** Begins one polygon geometry. */
|
|
30663
|
+
beginPolygon(ringCount) {
|
|
30664
|
+
this.writeHeader("Polygon");
|
|
30665
|
+
this.writeUint32(ringCount);
|
|
30666
|
+
}
|
|
30667
|
+
/** Begins one linear ring inside a polygon. */
|
|
30668
|
+
beginLinearRing(pointCount) {
|
|
30669
|
+
this.writeUint32(pointCount);
|
|
30670
|
+
}
|
|
30671
|
+
/** Begins one multipoint geometry. */
|
|
30672
|
+
beginMultiPoint(pointCount) {
|
|
30673
|
+
this.writeHeader("MultiPoint");
|
|
30674
|
+
this.writeUint32(pointCount);
|
|
30675
|
+
}
|
|
30676
|
+
/** Begins one multilinestring geometry. */
|
|
30677
|
+
beginMultiLineString(lineCount) {
|
|
30678
|
+
this.writeHeader("MultiLineString");
|
|
30679
|
+
this.writeUint32(lineCount);
|
|
30680
|
+
}
|
|
30681
|
+
/** Begins one multipolygon geometry. */
|
|
30682
|
+
beginMultiPolygon(polygonCount) {
|
|
30683
|
+
this.writeHeader("MultiPolygon");
|
|
30684
|
+
this.writeUint32(polygonCount);
|
|
30685
|
+
}
|
|
30686
|
+
/** Writes one coordinate using the builder's semantic dimension. */
|
|
30687
|
+
writeCoordinate(x, y, z, m) {
|
|
30688
|
+
let coordinate = makeCoordinate(this.dimension, x, y, z, m);
|
|
30689
|
+
if (this.transform)
|
|
30690
|
+
coordinate = this.transform(coordinate, this.dimension);
|
|
30691
|
+
const coordinateSize = getDimensionSize(this.dimension);
|
|
30692
|
+
for (let index = 0; index < coordinateSize; index++) {
|
|
30693
|
+
this.writeFloat64(coordinate[index] ?? Number.NaN);
|
|
30694
|
+
}
|
|
30695
|
+
}
|
|
30696
|
+
/** Temporarily changes the semantic dimension for a nested geometry. */
|
|
30697
|
+
withDimension(dimension, callback) {
|
|
30698
|
+
const previous = this.dimension;
|
|
30699
|
+
this.dimension = dimension;
|
|
30700
|
+
try {
|
|
30701
|
+
return callback();
|
|
30702
|
+
} finally {
|
|
30703
|
+
this.dimension = previous;
|
|
30704
|
+
}
|
|
30705
|
+
}
|
|
30706
|
+
/** Returns the number of bytes measured or written. */
|
|
30707
|
+
finishGeometry() {
|
|
30708
|
+
return this.byteOffset - this.startByteOffset;
|
|
30709
|
+
}
|
|
30710
|
+
/** Measures geometry callbacks and returns contiguous Binary offsets. */
|
|
30711
|
+
static measureGeometryArray(geometryWriters, options = {}) {
|
|
30712
|
+
const valueOffsets = new Int32Array(geometryWriters.length + 1);
|
|
30713
|
+
for (let geometryIndex = 0; geometryIndex < geometryWriters.length; geometryIndex++) {
|
|
30714
|
+
const geometryWriter = geometryWriters[geometryIndex];
|
|
30715
|
+
const byteLength = geometryWriter ? measureGeometry(geometryWriter, {
|
|
30716
|
+
...options,
|
|
30717
|
+
dimension: options.dimensionResolver?.(geometryIndex) ?? options.dimension
|
|
30718
|
+
}) : 0;
|
|
30719
|
+
const nextOffset = valueOffsets[geometryIndex] + byteLength;
|
|
30720
|
+
if (nextOffset > 2147483647)
|
|
30721
|
+
throw new Error("WKB geometry array exceeds Int32 offsets");
|
|
30722
|
+
valueOffsets[geometryIndex + 1] = nextOffset;
|
|
30723
|
+
}
|
|
30724
|
+
return valueOffsets;
|
|
30725
|
+
}
|
|
30726
|
+
/** Writes geometry callbacks into an existing contiguous values buffer. */
|
|
30727
|
+
static writeGeometryArray(geometryWriters, valueOffsets, values, options = {}) {
|
|
30728
|
+
if (valueOffsets.length !== geometryWriters.length + 1) {
|
|
30729
|
+
throw new Error("WKB valueOffsets length must equal geometry count plus one");
|
|
30730
|
+
}
|
|
30731
|
+
for (let i = 0; i < valueOffsets.length; i++) {
|
|
30732
|
+
if (!Number.isInteger(valueOffsets[i]) || valueOffsets[i] < 0 || i > 0 && valueOffsets[i] < valueOffsets[i - 1]) {
|
|
30733
|
+
throw new Error("WKB valueOffsets must be nonnegative and nondecreasing");
|
|
30734
|
+
}
|
|
30735
|
+
}
|
|
30736
|
+
if (valueOffsets[valueOffsets.length - 1] > values.byteLength) {
|
|
30737
|
+
throw new Error("WKB values buffer is smaller than its final offset");
|
|
30738
|
+
}
|
|
30739
|
+
for (let geometryIndex = 0; geometryIndex < geometryWriters.length; geometryIndex++) {
|
|
30740
|
+
const geometryWriter = geometryWriters[geometryIndex];
|
|
30741
|
+
if (!geometryWriter)
|
|
30742
|
+
continue;
|
|
30743
|
+
const builder = new _WKBBuilder({
|
|
30744
|
+
...options,
|
|
30745
|
+
mode: "write",
|
|
30746
|
+
target: values,
|
|
30747
|
+
byteOffset: valueOffsets[geometryIndex],
|
|
30748
|
+
dimension: options.dimensionResolver?.(geometryIndex) ?? options.dimension
|
|
30749
|
+
});
|
|
30750
|
+
geometryWriter(builder);
|
|
30751
|
+
const byteLength = builder.finishGeometry();
|
|
30752
|
+
if (valueOffsets[geometryIndex] + byteLength !== valueOffsets[geometryIndex + 1]) {
|
|
30753
|
+
throw new Error("WKB measure and write passes produced different byte lengths");
|
|
30754
|
+
}
|
|
30755
|
+
}
|
|
30756
|
+
return values;
|
|
30757
|
+
}
|
|
30758
|
+
/** Builds plain offsets, values, and validity buffers in two passes. */
|
|
30759
|
+
static buildGeometryArray(geometryWriters, options = {}) {
|
|
30760
|
+
const valueOffsets = _WKBBuilder.measureGeometryArray(geometryWriters, options);
|
|
30761
|
+
const values = new Uint8Array(valueOffsets[valueOffsets.length - 1]);
|
|
30762
|
+
_WKBBuilder.writeGeometryArray(geometryWriters, valueOffsets, values, options);
|
|
30763
|
+
const { nullBitmap, nullCount } = makeNullBitmap(geometryWriters);
|
|
30764
|
+
return {
|
|
30765
|
+
valueOffsets,
|
|
30766
|
+
values,
|
|
30767
|
+
...nullCount > 0 ? { nullBitmap } : {},
|
|
30768
|
+
nullCount
|
|
30769
|
+
};
|
|
30770
|
+
}
|
|
30771
|
+
writeHeader(geometryType) {
|
|
30772
|
+
this.writeUint8(this.littleEndian ? 1 : 0);
|
|
30773
|
+
this.writeUint32(getWKBTypeCode(geometryType, this.dimension, this.srid !== void 0));
|
|
30774
|
+
if (this.srid !== void 0)
|
|
30775
|
+
this.writeUint32(this.srid);
|
|
30776
|
+
}
|
|
30777
|
+
writeUint8(value2) {
|
|
30778
|
+
this.ensureSize(1);
|
|
30779
|
+
this.dataView?.setUint8(this.byteOffset, value2);
|
|
30780
|
+
this.byteOffset++;
|
|
30781
|
+
}
|
|
30782
|
+
writeUint32(value2) {
|
|
30783
|
+
if (!Number.isSafeInteger(value2) || value2 < 0 || value2 > 4294967295) {
|
|
30784
|
+
throw new Error("WKB count must be an unsigned 32-bit integer");
|
|
30785
|
+
}
|
|
30786
|
+
this.ensureSize(4);
|
|
30787
|
+
this.dataView?.setUint32(this.byteOffset, value2, this.littleEndian);
|
|
30788
|
+
this.byteOffset += 4;
|
|
30789
|
+
}
|
|
30790
|
+
writeFloat64(value2) {
|
|
30791
|
+
this.ensureSize(8);
|
|
30792
|
+
this.dataView?.setFloat64(this.byteOffset, value2, this.littleEndian);
|
|
30793
|
+
this.byteOffset += 8;
|
|
30794
|
+
}
|
|
30795
|
+
ensureSize(byteLength) {
|
|
30796
|
+
if (this.byteOffset + byteLength > this.endByteOffset) {
|
|
30797
|
+
throw new Error("WKBBuilder target buffer overflow");
|
|
30798
|
+
}
|
|
30799
|
+
}
|
|
30800
|
+
};
|
|
30801
|
+
}
|
|
30802
|
+
});
|
|
30803
|
+
|
|
30804
|
+
// ../../node_modules/@math.gl/arrow/dist/wkb/wkt.js
|
|
30805
|
+
function formatWKT(geometry, dimension) {
|
|
30806
|
+
if (isWKTParseResult(geometry)) {
|
|
30807
|
+
return dimension === void 0 ? formatWKTResult(geometry) : formatWKTGeometry(geometry.geometry, dimension);
|
|
30808
|
+
}
|
|
30809
|
+
return formatWKTGeometry(geometry, dimension ?? inferWellKnownGeometryDimension(geometry));
|
|
30810
|
+
}
|
|
30811
|
+
function formatWKTResult(result) {
|
|
30812
|
+
return formatWKTGeometry(result.geometry, result.dimension, result.children);
|
|
30813
|
+
}
|
|
30814
|
+
function formatWKTGeometry(geometry, dimension, children2) {
|
|
30815
|
+
const dimensionToken = dimension === "xy" ? "" : " " + dimension.slice(2).toUpperCase();
|
|
30816
|
+
if (geometry.type === "GeometryCollection") {
|
|
30817
|
+
if (geometry.geometries.length === 0)
|
|
30818
|
+
return "GEOMETRYCOLLECTION" + dimensionToken + " EMPTY";
|
|
30819
|
+
const formattedChildren = children2 ? children2.map(formatWKTResult) : geometry.geometries.map((child2) => formatWKTGeometry(child2, dimension));
|
|
30820
|
+
return "GEOMETRYCOLLECTION" + dimensionToken + " (" + formattedChildren.join(", ") + ")";
|
|
30821
|
+
}
|
|
30822
|
+
const type = geometry.type.toUpperCase();
|
|
30823
|
+
const isEmpty = geometry.type === "MultiPoint" ? geometry.coordinates.length === 0 : isEmptyCoordinates(geometry.coordinates);
|
|
30824
|
+
if (isEmpty)
|
|
30825
|
+
return type + dimensionToken + " EMPTY";
|
|
30826
|
+
return type + dimensionToken + " " + formatCoordinateNesting(geometry.coordinates, getGeometryDepth(geometry.type), geometry.type === "MultiPoint");
|
|
30827
|
+
}
|
|
30828
|
+
function isWKTParseResult(value2) {
|
|
30829
|
+
return "geometry" in value2 && "dimension" in value2;
|
|
30830
|
+
}
|
|
30831
|
+
function formatCoordinateNesting(value2, depth, allowEmptyPoints = false) {
|
|
30832
|
+
if (depth === 0)
|
|
30833
|
+
return `(${value2.map(formatNumber).join(" ")})`;
|
|
30834
|
+
return `(${value2.map((child2) => {
|
|
30835
|
+
if (depth === 1) {
|
|
30836
|
+
const coordinate = child2;
|
|
30837
|
+
if (allowEmptyPoints && isEmptyCoordinates(coordinate))
|
|
30838
|
+
return "EMPTY";
|
|
30839
|
+
return coordinate.map(formatNumber).join(" ");
|
|
30840
|
+
}
|
|
30841
|
+
return formatCoordinateNesting(child2, depth - 1);
|
|
30842
|
+
}).join(", ")})`;
|
|
30843
|
+
}
|
|
30844
|
+
function formatNumber(value2) {
|
|
30845
|
+
if (!Number.isFinite(value2))
|
|
30846
|
+
return "NaN";
|
|
30847
|
+
return String(value2);
|
|
30848
|
+
}
|
|
30849
|
+
function getGeometryDepth(type) {
|
|
30850
|
+
switch (type) {
|
|
30851
|
+
case "Point":
|
|
30852
|
+
return 0;
|
|
30853
|
+
case "LineString":
|
|
30854
|
+
case "MultiPoint":
|
|
30855
|
+
return 1;
|
|
30856
|
+
case "Polygon":
|
|
30857
|
+
case "MultiLineString":
|
|
30858
|
+
return 2;
|
|
30859
|
+
case "MultiPolygon":
|
|
30860
|
+
return 3;
|
|
30861
|
+
}
|
|
30862
|
+
}
|
|
30863
|
+
function isEmptyCoordinates(value2) {
|
|
30864
|
+
if (value2.length === 0)
|
|
30865
|
+
return true;
|
|
30866
|
+
if (typeof value2[0] === "number") {
|
|
30867
|
+
return value2.every((component) => !Number.isFinite(component));
|
|
30868
|
+
}
|
|
30869
|
+
return value2.every((child2) => isEmptyCoordinates(child2));
|
|
30870
|
+
}
|
|
30871
|
+
var init_wkt2 = __esm({
|
|
30872
|
+
"../../node_modules/@math.gl/arrow/dist/wkb/wkt.js"() {
|
|
30873
|
+
init_types2();
|
|
30874
|
+
}
|
|
30875
|
+
});
|
|
30876
|
+
|
|
30877
|
+
// ../../node_modules/@math.gl/arrow/dist/wkb/index.js
|
|
30878
|
+
var init_wkb2 = __esm({
|
|
30879
|
+
"../../node_modules/@math.gl/arrow/dist/wkb/index.js"() {
|
|
30880
|
+
init_wkb();
|
|
30881
|
+
init_wkb_builder();
|
|
30882
|
+
init_wkt2();
|
|
30883
|
+
}
|
|
30884
|
+
});
|
|
30885
|
+
|
|
30232
30886
|
// ../core/src/arrow-geometry/geometry-to-wkt.ts
|
|
30233
30887
|
function convertGeometryToWKT(geometry, options) {
|
|
30234
30888
|
const dimension = getWKTDimension(geometry, options);
|
|
@@ -30298,7 +30952,7 @@ return true;`);
|
|
|
30298
30952
|
var init_geometry_to_wkt = __esm({
|
|
30299
30953
|
"../core/src/arrow-geometry/geometry-to-wkt.ts"() {
|
|
30300
30954
|
"use strict";
|
|
30301
|
-
|
|
30955
|
+
init_wkb2();
|
|
30302
30956
|
}
|
|
30303
30957
|
});
|
|
30304
30958
|
|
|
@@ -30338,7 +30992,7 @@ return true;`);
|
|
|
30338
30992
|
var init_geometry_codecs = __esm({
|
|
30339
30993
|
"../core/src/arrow-geometry/geometry-codecs.ts"() {
|
|
30340
30994
|
"use strict";
|
|
30341
|
-
|
|
30995
|
+
init_wkb2();
|
|
30342
30996
|
init_geometry_to_wkt();
|
|
30343
30997
|
}
|
|
30344
30998
|
});
|
|
@@ -31102,7 +31756,7 @@ return true;`);
|
|
|
31102
31756
|
var init_wkb_builder2 = __esm({
|
|
31103
31757
|
"../core/src/arrow-geometry/wkb-builder.ts"() {
|
|
31104
31758
|
"use strict";
|
|
31105
|
-
|
|
31759
|
+
init_wkb2();
|
|
31106
31760
|
init_wkb_types();
|
|
31107
31761
|
WKBBuilder2 = class _WKBBuilder {
|
|
31108
31762
|
mode;
|
|
@@ -33177,7 +33831,7 @@ return true;`);
|
|
|
33177
33831
|
"src/flatgeobuf/flatgeobuf-loader-types.ts"() {
|
|
33178
33832
|
"use strict";
|
|
33179
33833
|
init_flatgeobuf_format();
|
|
33180
|
-
VERSION = true ? "5.0.0-beta.
|
|
33834
|
+
VERSION = true ? "5.0.0-beta.5" : "latest";
|
|
33181
33835
|
FGB_MAGIC_NUMBER = [102, 103, 98, 3, 102, 103, 98, 1];
|
|
33182
33836
|
FlatGeobufLoader = {
|
|
33183
33837
|
...FlatGeobufFormat,
|