@loaders.gl/pointclouds 5.0.0-beta.1 → 5.0.0-beta.10
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/LAS-README.md +1 -1
- package/PCD-README.md +1 -1
- package/PLY-README.md +1 -1
- package/README.md +5 -1
- package/dist/dist.dev.js +3584 -2211
- package/dist/dist.min.js +20 -20
- package/dist/index.cjs +0 -6
- package/dist/index.cjs.map +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/las/bundled.cjs +0 -3
- package/dist/las/bundled.cjs.map +2 -2
- package/dist/las/bundled.d.ts +0 -1
- package/dist/las/bundled.d.ts.map +1 -1
- package/dist/las/bundled.js +0 -1
- package/dist/las/bundled.js.map +1 -1
- package/dist/las/index.cjs +0 -3
- package/dist/las/index.cjs.map +3 -3
- package/dist/las/index.d.ts +0 -2
- package/dist/las/index.d.ts.map +1 -1
- package/dist/las/index.js +0 -3
- package/dist/las/index.js.map +1 -1
- package/dist/las/las-copc-loader-types.cjs +1 -1
- package/dist/las/las-copc-loader-types.cjs.map +2 -2
- package/dist/las/las-copc-loader-types.d.ts +13 -9
- package/dist/las/las-copc-loader-types.d.ts.map +1 -1
- package/dist/las/las-copc-loader-types.js +1 -1
- package/dist/las/las-copc-loader-types.js.map +1 -1
- package/dist/las/las-copc-loader.cjs +8 -5
- package/dist/las/las-copc-loader.cjs.map +2 -2
- package/dist/las/las-copc-loader.d.ts +8 -6
- package/dist/las/las-copc-loader.d.ts.map +1 -1
- package/dist/las/las-copc-loader.js +11 -6
- package/dist/las/las-copc-loader.js.map +1 -1
- package/dist/las/las-loader-shared.cjs +4 -2
- package/dist/las/las-loader-shared.cjs.map +2 -2
- package/dist/las/las-loader-shared.d.ts +9 -7
- package/dist/las/las-loader-shared.d.ts.map +1 -1
- package/dist/las/las-loader-shared.js +4 -2
- package/dist/las/las-loader-shared.js.map +1 -1
- package/dist/las/las-loader-types.cjs +3 -6
- package/dist/las/las-loader-types.cjs.map +2 -2
- package/dist/las/las-loader-types.d.ts +18 -45
- package/dist/las/las-loader-types.d.ts.map +1 -1
- package/dist/las/las-loader-types.js +1 -3
- package/dist/las/las-loader-types.js.map +1 -1
- package/dist/las/las-loader.cjs +61 -13
- package/dist/las/las-loader.cjs.map +3 -3
- package/dist/las/las-loader.d.ts +51 -5
- package/dist/las/las-loader.d.ts.map +1 -1
- package/dist/las/las-loader.js +56 -6
- package/dist/las/las-loader.js.map +1 -1
- package/dist/las/las-writer.cjs +3 -3
- package/dist/las/las-writer.cjs.map +2 -2
- package/dist/las/las-writer.d.ts +4 -3
- package/dist/las/las-writer.d.ts.map +1 -1
- package/dist/las/las-writer.js +4 -6
- package/dist/las/las-writer.js.map +1 -1
- package/dist/las/laz-rs-loader-types.cjs +1 -1
- package/dist/las/laz-rs-loader-types.cjs.map +2 -2
- package/dist/las/laz-rs-loader-types.d.ts +13 -9
- package/dist/las/laz-rs-loader-types.d.ts.map +1 -1
- package/dist/las/laz-rs-loader-types.js +1 -1
- package/dist/las/laz-rs-loader-types.js.map +1 -1
- package/dist/las/laz-rs-loader.cjs +8 -5
- package/dist/las/laz-rs-loader.cjs.map +2 -2
- package/dist/las/laz-rs-loader.d.ts +8 -6
- package/dist/las/laz-rs-loader.d.ts.map +1 -1
- package/dist/las/laz-rs-loader.js +11 -6
- package/dist/las/laz-rs-loader.js.map +1 -1
- package/dist/las/lazperf-loader-types.cjs +1 -1
- package/dist/las/lazperf-loader-types.cjs.map +2 -2
- package/dist/las/lazperf-loader-types.d.ts +14 -10
- package/dist/las/lazperf-loader-types.d.ts.map +1 -1
- package/dist/las/lazperf-loader-types.js +1 -1
- package/dist/las/lazperf-loader-types.js.map +1 -1
- package/dist/las/lazperf-loader.cjs +9 -6
- package/dist/las/lazperf-loader.cjs.map +2 -2
- package/dist/las/lazperf-loader.d.ts +9 -7
- package/dist/las/lazperf-loader.d.ts.map +1 -1
- package/dist/las/lazperf-loader.js +12 -7
- package/dist/las/lazperf-loader.js.map +1 -1
- package/dist/las/lib/copc/parse-las.cjs +1 -1
- package/dist/las/lib/copc/parse-las.cjs.map +2 -2
- package/dist/las/lib/copc/parse-las.js +1 -1
- package/dist/las/lib/copc/parse-las.js.map +1 -1
- package/dist/las/lib/get-las-schema.cjs +5 -0
- package/dist/las/lib/get-las-schema.cjs.map +2 -2
- package/dist/las/lib/get-las-schema.d.ts.map +1 -1
- package/dist/las/lib/get-las-schema.js +6 -0
- package/dist/las/lib/get-las-schema.js.map +1 -1
- package/dist/las/lib/las-extra-bytes.cjs +6 -1
- package/dist/las/lib/las-extra-bytes.cjs.map +2 -2
- package/dist/las/lib/las-extra-bytes.d.ts.map +1 -1
- package/dist/las/lib/las-extra-bytes.js +6 -4
- package/dist/las/lib/las-extra-bytes.js.map +1 -1
- package/dist/las/lib/laz-perf/parse-las.cjs +9 -8
- package/dist/las/lib/laz-perf/parse-las.cjs.map +3 -3
- package/dist/las/lib/laz-perf/parse-las.js +9 -8
- package/dist/las/lib/laz-perf/parse-las.js.map +1 -1
- package/dist/las/lib/laz-rs-wasm/parse-las.cjs +9 -8
- package/dist/las/lib/laz-rs-wasm/parse-las.cjs.map +3 -3
- package/dist/las/lib/laz-rs-wasm/parse-las.js +9 -8
- package/dist/las/lib/laz-rs-wasm/parse-las.js.map +1 -1
- package/dist/las/lib/typescript/parse-las.cjs +135 -13
- package/dist/las/lib/typescript/parse-las.cjs.map +3 -3
- package/dist/las/lib/typescript/parse-las.d.ts.map +1 -1
- package/dist/las/lib/typescript/parse-las.js +106 -10
- package/dist/las/lib/typescript/parse-las.js.map +1 -1
- package/dist/las/unbundled.cjs +0 -2
- package/dist/las/unbundled.cjs.map +2 -2
- package/dist/las/unbundled.d.ts +1 -1
- package/dist/las/unbundled.d.ts.map +1 -1
- package/dist/las/unbundled.js +1 -1
- package/dist/las/unbundled.js.map +1 -1
- package/dist/las/workers/las-worker.cjs +5 -5
- package/dist/las/workers/las-worker.cjs.map +2 -2
- package/dist/las/workers/las-worker.js +6 -6
- package/dist/las/workers/las-worker.js.map +1 -1
- package/dist/las-copc-loader-types.cjs +51 -0
- package/dist/las-copc-loader-types.cjs.map +7 -0
- package/dist/las-copc-loader-types.d.ts +2 -0
- package/dist/las-copc-loader-types.d.ts.map +1 -0
- package/dist/las-copc-loader-types.js +2 -0
- package/dist/las-copc-loader-types.js.map +1 -0
- package/dist/las-copc-loader.cjs +62 -0
- package/dist/las-copc-loader.cjs.map +7 -0
- package/dist/las-copc-loader.d.ts +2 -0
- package/dist/las-copc-loader.d.ts.map +1 -0
- package/dist/las-copc-loader.js +2 -0
- package/dist/las-copc-loader.js.map +1 -0
- package/dist/las-loader-types.cjs +53 -0
- package/dist/las-loader-types.cjs.map +7 -0
- package/dist/las-loader-types.d.ts +2 -0
- package/dist/las-loader-types.d.ts.map +1 -0
- package/dist/las-loader-types.js +2 -0
- package/dist/las-loader-types.js.map +1 -0
- package/dist/las-loader.cjs +130 -0
- package/dist/las-loader.cjs.map +7 -0
- package/dist/las-loader.d.ts +2 -0
- package/dist/las-loader.d.ts.map +1 -0
- package/dist/las-loader.js +2 -0
- package/dist/las-loader.js.map +1 -0
- package/dist/las-worker.js +1219 -253
- package/dist/las-writer.cjs +1056 -0
- package/dist/las-writer.cjs.map +7 -0
- package/dist/las-writer.d.ts +2 -0
- package/dist/las-writer.d.ts.map +1 -0
- package/dist/las-writer.js +2 -0
- package/dist/las-writer.js.map +1 -0
- package/dist/laz-rs-loader-types.cjs +51 -0
- package/dist/laz-rs-loader-types.cjs.map +7 -0
- package/dist/laz-rs-loader-types.d.ts +2 -0
- package/dist/laz-rs-loader-types.d.ts.map +1 -0
- package/dist/laz-rs-loader-types.js +2 -0
- package/dist/laz-rs-loader-types.js.map +1 -0
- package/dist/laz-rs-loader.cjs +277 -0
- package/dist/laz-rs-loader.cjs.map +7 -0
- package/dist/laz-rs-loader.d.ts +2 -0
- package/dist/laz-rs-loader.d.ts.map +1 -0
- package/dist/laz-rs-loader.js +2 -0
- package/dist/laz-rs-loader.js.map +1 -0
- package/dist/lazperf-loader-types.cjs +51 -0
- package/dist/lazperf-loader-types.cjs.map +7 -0
- package/dist/lazperf-loader-types.d.ts +2 -0
- package/dist/lazperf-loader-types.d.ts.map +1 -0
- package/dist/lazperf-loader-types.js +2 -0
- package/dist/lazperf-loader-types.js.map +1 -0
- package/dist/lazperf-loader.cjs +65 -0
- package/dist/lazperf-loader.cjs.map +7 -0
- package/dist/lazperf-loader.d.ts +2 -0
- package/dist/lazperf-loader.d.ts.map +1 -0
- package/dist/lazperf-loader.js +2 -0
- package/dist/lazperf-loader.js.map +1 -0
- package/dist/pcd/bundled.cjs +2 -4
- package/dist/pcd/bundled.cjs.map +2 -2
- package/dist/pcd/bundled.d.ts +1 -1
- package/dist/pcd/bundled.d.ts.map +1 -1
- package/dist/pcd/bundled.js +1 -1
- package/dist/pcd/bundled.js.map +1 -1
- package/dist/pcd/index.cjs +0 -3
- package/dist/pcd/index.cjs.map +3 -3
- package/dist/pcd/index.d.ts +0 -2
- package/dist/pcd/index.d.ts.map +1 -1
- package/dist/pcd/index.js +0 -3
- package/dist/pcd/index.js.map +1 -1
- package/dist/pcd/pcd-loader-types.cjs +9 -10
- package/dist/pcd/pcd-loader-types.cjs.map +2 -2
- package/dist/pcd/pcd-loader-types.d.ts +18 -41
- package/dist/pcd/pcd-loader-types.d.ts.map +1 -1
- package/dist/pcd/pcd-loader-types.js +6 -6
- package/dist/pcd/pcd-loader-types.js.map +1 -1
- package/dist/pcd/pcd-loader.cjs +82 -25
- package/dist/pcd/pcd-loader.cjs.map +3 -3
- package/dist/pcd/pcd-loader.d.ts +42 -6
- package/dist/pcd/pcd-loader.d.ts.map +1 -1
- package/dist/pcd/pcd-loader.js +72 -21
- package/dist/pcd/pcd-loader.js.map +1 -1
- package/dist/pcd/pcd-writer.cjs +3 -3
- package/dist/pcd/pcd-writer.cjs.map +2 -2
- package/dist/pcd/pcd-writer.d.ts +5 -4
- package/dist/pcd/pcd-writer.d.ts.map +1 -1
- package/dist/pcd/pcd-writer.js +4 -4
- package/dist/pcd/pcd-writer.js.map +1 -1
- package/dist/pcd/unbundled.cjs +2 -4
- package/dist/pcd/unbundled.cjs.map +2 -2
- package/dist/pcd/unbundled.d.ts +1 -1
- package/dist/pcd/unbundled.d.ts.map +1 -1
- package/dist/pcd/unbundled.js +1 -1
- package/dist/pcd/unbundled.js.map +1 -1
- package/dist/pcd/workers/pcd-worker.cjs +5 -5
- package/dist/pcd/workers/pcd-worker.cjs.map +2 -2
- package/dist/pcd/workers/pcd-worker.js +6 -6
- package/dist/pcd/workers/pcd-worker.js.map +1 -1
- package/dist/pcd-loader-types.cjs +65 -0
- package/dist/pcd-loader-types.cjs.map +7 -0
- package/dist/pcd-loader-types.d.ts +2 -0
- package/dist/pcd-loader-types.d.ts.map +1 -0
- package/dist/pcd-loader-types.js +2 -0
- package/dist/pcd-loader-types.js.map +1 -0
- package/dist/pcd-loader.cjs +203 -0
- package/dist/pcd-loader.cjs.map +7 -0
- package/dist/pcd-loader.d.ts +2 -0
- package/dist/pcd-loader.d.ts.map +1 -0
- package/dist/pcd-loader.js +2 -0
- package/dist/pcd-loader.js.map +1 -0
- package/dist/pcd-worker.js +1457 -418
- package/dist/pcd-writer.cjs +136 -0
- package/dist/pcd-writer.cjs.map +7 -0
- package/dist/pcd-writer.d.ts +2 -0
- package/dist/pcd-writer.d.ts.map +1 -0
- package/dist/pcd-writer.js +2 -0
- package/dist/pcd-writer.js.map +1 -0
- package/dist/ply/bundled.cjs +2 -4
- package/dist/ply/bundled.cjs.map +2 -2
- package/dist/ply/bundled.d.ts +1 -1
- package/dist/ply/bundled.d.ts.map +1 -1
- package/dist/ply/bundled.js +1 -1
- package/dist/ply/bundled.js.map +1 -1
- package/dist/ply/index.cjs +0 -3
- package/dist/ply/index.cjs.map +3 -3
- package/dist/ply/index.d.ts +0 -2
- package/dist/ply/index.d.ts.map +1 -1
- package/dist/ply/index.js +0 -3
- package/dist/ply/index.js.map +1 -1
- package/dist/ply/lib/get-ply-schema.cjs +4 -2
- package/dist/ply/lib/get-ply-schema.cjs.map +2 -2
- package/dist/ply/lib/get-ply-schema.d.ts +6 -0
- package/dist/ply/lib/get-ply-schema.d.ts.map +1 -1
- package/dist/ply/lib/get-ply-schema.js +1 -1
- package/dist/ply/lib/get-ply-schema.js.map +1 -1
- package/dist/ply/lib/parse-ply-arrow.cjs +1 -1
- package/dist/ply/lib/parse-ply-arrow.cjs.map +2 -2
- package/dist/ply/lib/parse-ply-arrow.js +2 -2
- package/dist/ply/lib/parse-ply-arrow.js.map +1 -1
- package/dist/ply/lib/parse-ply-in-batches.cjs +14 -8
- package/dist/ply/lib/parse-ply-in-batches.cjs.map +3 -3
- package/dist/ply/lib/parse-ply-in-batches.d.ts.map +1 -1
- package/dist/ply/lib/parse-ply-in-batches.js +9 -4
- package/dist/ply/lib/parse-ply-in-batches.js.map +1 -1
- package/dist/ply/lib/parse-ply.cjs +3 -0
- package/dist/ply/lib/parse-ply.cjs.map +2 -2
- package/dist/ply/lib/parse-ply.d.ts +1 -1
- package/dist/ply/lib/parse-ply.d.ts.map +1 -1
- package/dist/ply/lib/parse-ply.js +4 -0
- package/dist/ply/lib/parse-ply.js.map +1 -1
- package/dist/ply/ply-loader-types.cjs +9 -10
- package/dist/ply/ply-loader-types.cjs.map +2 -2
- package/dist/ply/ply-loader-types.d.ts +19 -42
- package/dist/ply/ply-loader-types.d.ts.map +1 -1
- package/dist/ply/ply-loader-types.js +6 -6
- package/dist/ply/ply-loader-types.js.map +1 -1
- package/dist/ply/ply-loader.cjs +82 -24
- package/dist/ply/ply-loader.cjs.map +3 -3
- package/dist/ply/ply-loader.d.ts +43 -6
- package/dist/ply/ply-loader.d.ts.map +1 -1
- package/dist/ply/ply-loader.js +71 -19
- package/dist/ply/ply-loader.js.map +1 -1
- package/dist/ply/ply-writer.cjs +3 -3
- package/dist/ply/ply-writer.cjs.map +2 -2
- package/dist/ply/ply-writer.d.ts +5 -4
- package/dist/ply/ply-writer.d.ts.map +1 -1
- package/dist/ply/ply-writer.js +4 -4
- package/dist/ply/ply-writer.js.map +1 -1
- package/dist/ply/unbundled.cjs +2 -4
- package/dist/ply/unbundled.cjs.map +2 -2
- package/dist/ply/unbundled.d.ts +1 -1
- package/dist/ply/unbundled.d.ts.map +1 -1
- package/dist/ply/unbundled.js +1 -1
- package/dist/ply/unbundled.js.map +1 -1
- package/dist/ply/workers/ply-worker.cjs +6 -6
- package/dist/ply/workers/ply-worker.cjs.map +2 -2
- package/dist/ply/workers/ply-worker.js +8 -8
- package/dist/ply/workers/ply-worker.js.map +1 -1
- package/dist/ply-loader-types.cjs +66 -0
- package/dist/ply-loader-types.cjs.map +7 -0
- package/dist/ply-loader-types.d.ts +2 -0
- package/dist/ply-loader-types.d.ts.map +1 -0
- package/dist/ply-loader-types.js +2 -0
- package/dist/ply-loader-types.js.map +1 -0
- package/dist/ply-loader.cjs +194 -0
- package/dist/ply-loader.cjs.map +7 -0
- package/dist/ply-loader.d.ts +2 -0
- package/dist/ply-loader.d.ts.map +1 -0
- package/dist/ply-loader.js +2 -0
- package/dist/ply-loader.js.map +1 -0
- package/dist/ply-worker.js +2099 -312
- package/dist/ply-writer.cjs +177 -0
- package/dist/ply-writer.cjs.map +7 -0
- package/dist/ply-writer.d.ts +2 -0
- package/dist/ply-writer.d.ts.map +1 -0
- package/dist/ply-writer.js +2 -0
- package/dist/ply-writer.js.map +1 -0
- package/package.json +75 -71
- package/src/index.ts +3 -3
- package/src/las/bundled.ts +0 -1
- package/src/las/index.ts +0 -4
- package/src/las/las-copc-loader-types.ts +3 -3
- package/src/las/las-copc-loader.ts +12 -12
- package/src/las/las-loader-shared.ts +9 -7
- package/src/las/las-loader-types.ts +3 -6
- package/src/las/las-loader.ts +63 -9
- package/src/las/las-writer.ts +17 -13
- package/src/las/laz-rs-loader-types.ts +3 -3
- package/src/las/laz-rs-loader.ts +11 -11
- package/src/las/lazperf-loader-types.ts +3 -3
- package/src/las/lazperf-loader.ts +13 -13
- package/src/las/lib/copc/parse-las.ts +1 -1
- package/src/las/lib/get-las-schema.ts +5 -0
- package/src/las/lib/las-extra-bytes.ts +6 -4
- package/src/las/lib/laz-perf/parse-las.ts +8 -9
- package/src/las/lib/laz-rs-wasm/parse-las.ts +8 -9
- package/src/las/lib/typescript/parse-las.ts +143 -11
- package/src/las/libs/laz-rs-wasm/README.md +5 -0
- package/src/las/libs/laz-rs-wasm/package.json +6 -0
- package/src/las/unbundled.ts +1 -1
- package/src/las/workers/las-worker.ts +6 -6
- package/src/las-copc-loader-types.ts +1 -0
- package/src/las-copc-loader.ts +1 -0
- package/src/las-loader-types.ts +1 -0
- package/src/las-loader.ts +1 -0
- package/src/las-writer.ts +1 -0
- package/src/laz-rs-loader-types.ts +1 -0
- package/src/laz-rs-loader.ts +1 -0
- package/src/lazperf-loader-types.ts +1 -0
- package/src/lazperf-loader.ts +1 -0
- package/src/pcd/bundled.ts +1 -4
- package/src/pcd/index.ts +0 -4
- package/src/pcd/pcd-loader-types.ts +10 -11
- package/src/pcd/pcd-loader.ts +97 -29
- package/src/pcd/pcd-writer.ts +12 -8
- package/src/pcd/unbundled.ts +1 -1
- package/src/pcd/workers/pcd-worker.ts +6 -6
- package/src/pcd-loader-types.ts +1 -0
- package/src/pcd-loader.ts +1 -0
- package/src/pcd-writer.ts +1 -0
- package/src/ply/bundled.ts +1 -4
- package/src/ply/index.ts +0 -4
- package/src/ply/lib/get-ply-schema.ts +1 -1
- package/src/ply/lib/parse-ply-arrow.ts +2 -2
- package/src/ply/lib/parse-ply-in-batches.ts +9 -4
- package/src/ply/lib/parse-ply.ts +4 -1
- package/src/ply/ply-loader-types.ts +10 -11
- package/src/ply/ply-loader.ts +94 -24
- package/src/ply/ply-writer.ts +12 -8
- package/src/ply/unbundled.ts +1 -1
- package/src/ply/workers/ply-worker.ts +8 -8
- package/src/ply-loader-types.ts +1 -0
- package/src/ply-loader.ts +1 -0
- package/src/ply-writer.ts +1 -0
package/src/las/las-loader.ts
CHANGED
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import type
|
|
5
|
+
import {paceBatchIterator, type LoaderWithParser} from '@loaders.gl/core/loader-utils';
|
|
6
|
+
import type {Table, RecordBatch} from 'apache-arrow';
|
|
7
|
+
import {makeArrowMetadataBatch} from '@loaders.gl/core/schema-utils';
|
|
6
8
|
import type {MeshArrowTable} from '@loaders.gl/core/schema';
|
|
7
|
-
import {
|
|
9
|
+
import {convertMeshToArrowTableWrapper, convertTableToMesh} from '@loaders.gl/core/schema-utils';
|
|
8
10
|
import {
|
|
9
11
|
formatLASMeshColors,
|
|
10
12
|
getLASShape,
|
|
@@ -14,7 +16,7 @@ import {
|
|
|
14
16
|
import {
|
|
15
17
|
serializeArrowWorkerTable,
|
|
16
18
|
deserializeArrowWorkerTable
|
|
17
|
-
} from '@loaders.gl/core/
|
|
19
|
+
} from '@loaders.gl/core/arrow-worker-transport';
|
|
18
20
|
import type {LASMesh} from './lib/las-types';
|
|
19
21
|
import {
|
|
20
22
|
decodeLAZChunkToArrowTable,
|
|
@@ -35,8 +37,10 @@ type LASWorkerOptions = LASLoaderOptions & {
|
|
|
35
37
|
};
|
|
36
38
|
|
|
37
39
|
/** Parser-bearing TypeScript-only LAS loader implementation. */
|
|
38
|
-
export const
|
|
40
|
+
export const LASColumnLoader = {
|
|
39
41
|
...LAS_LOADER_METADATA,
|
|
42
|
+
dataType: null as unknown as LASMesh | MeshArrowTable,
|
|
43
|
+
batchType: null as unknown as LASMesh | MeshArrowTable,
|
|
40
44
|
worker: true,
|
|
41
45
|
workerInBatches: true,
|
|
42
46
|
serializeWorkerResult: serializeArrowWorkerTable,
|
|
@@ -72,15 +76,14 @@ function convertLASMesh(
|
|
|
72
76
|
options?.las?.colorFormat === undefined || options.las.colorFormat === 'uint8norm'
|
|
73
77
|
? table
|
|
74
78
|
: {
|
|
75
|
-
...
|
|
76
|
-
formatLASMeshColors(convertTableToMesh(table) as LASMesh, options.las.colorFormat)
|
|
77
|
-
'arrow-table'
|
|
79
|
+
...convertMeshToArrowTableWrapper(
|
|
80
|
+
formatLASMeshColors(convertTableToMesh(table) as LASMesh, options.las.colorFormat)
|
|
78
81
|
),
|
|
79
82
|
loader: table.loader,
|
|
80
83
|
loaderData: table.loaderData,
|
|
81
84
|
progress: table.progress
|
|
82
85
|
};
|
|
83
|
-
if (getLASShape(options) === 'arrow
|
|
86
|
+
if (getLASShape(options) === 'arrow') {
|
|
84
87
|
return formattedTable;
|
|
85
88
|
}
|
|
86
89
|
return {
|
|
@@ -95,7 +98,11 @@ async function* convertLASMeshBatches(
|
|
|
95
98
|
tableBatches: AsyncIterable<LASArrowTable>,
|
|
96
99
|
options?: LASLoaderOptions
|
|
97
100
|
): AsyncIterable<LASMesh | MeshArrowTable> {
|
|
98
|
-
for await (const table of tableBatches
|
|
101
|
+
for await (const table of paceBatchIterator(tableBatches, {
|
|
102
|
+
batchMaxRowsPerSecond: options?.core?.batchMaxRowsPerSecond,
|
|
103
|
+
getRowCount: batch => batch.data.numRows,
|
|
104
|
+
signal: options?.signal
|
|
105
|
+
})) {
|
|
99
106
|
yield convertLASMesh(table, options);
|
|
100
107
|
}
|
|
101
108
|
}
|
|
@@ -107,3 +114,50 @@ function deserializeLASWorkerTable(
|
|
|
107
114
|
): LASMesh | MeshArrowTable {
|
|
108
115
|
return convertLASMesh(deserializeArrowWorkerTable(result), options);
|
|
109
116
|
}
|
|
117
|
+
|
|
118
|
+
/** Exposes native Arrow while retaining the column worker and mesh compatibility paths. */
|
|
119
|
+
export const LASLoaderWithParser = {
|
|
120
|
+
...LASColumnLoader,
|
|
121
|
+
dataType: LAS_LOADER_METADATA.dataType,
|
|
122
|
+
batchType: LAS_LOADER_METADATA.batchType,
|
|
123
|
+
parse: async (input: ArrayBuffer, options?: LASLoaderOptions) =>
|
|
124
|
+
toPublicLASResult(await LASColumnLoader.parse(input, options)),
|
|
125
|
+
parseSync: (input: ArrayBuffer, options?: LASLoaderOptions) =>
|
|
126
|
+
toPublicLASResult(LASColumnLoader.parseSync(input, options)),
|
|
127
|
+
async *parseInBatches(input, options) {
|
|
128
|
+
for await (const result of LASColumnLoader.parseInBatches(input, options)) {
|
|
129
|
+
if ('shape' in result) yield* getLASRecordBatches(result);
|
|
130
|
+
else yield result;
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
deserializeWorkerResult: (result: unknown, options?: LASLoaderOptions) =>
|
|
134
|
+
toPublicLASResult(deserializeLASWorkerTable(result, options)),
|
|
135
|
+
deserializeWorkerBatch(result: unknown, options?: LASLoaderOptions) {
|
|
136
|
+
const decoded = deserializeLASWorkerTable(result, options);
|
|
137
|
+
return 'shape' in decoded ? getLASRecordBatches(decoded)[0] : decoded;
|
|
138
|
+
}
|
|
139
|
+
} as const satisfies LoaderWithParser<LASMesh | Table, LASMesh | RecordBatch, LASLoaderOptions>;
|
|
140
|
+
|
|
141
|
+
/** Unwraps the Arrow table with its complete file header. */
|
|
142
|
+
export function toPublicLASResult(result: LASMesh | MeshArrowTable): LASMesh | Table {
|
|
143
|
+
if (!('shape' in result)) return result;
|
|
144
|
+
const header = JSON.stringify((result as LASArrowTable).loaderData, (_key, value) =>
|
|
145
|
+
typeof value === 'bigint'
|
|
146
|
+
? value.toString()
|
|
147
|
+
: ArrayBuffer.isView(value)
|
|
148
|
+
? Array.from(value as Uint8Array)
|
|
149
|
+
: value
|
|
150
|
+
);
|
|
151
|
+
if (header) {
|
|
152
|
+
result.data.schema.metadata.set('loaders.gl.las.header', header);
|
|
153
|
+
for (const batch of result.data.batches)
|
|
154
|
+
batch.schema.metadata.set('loaders.gl.las.header', header);
|
|
155
|
+
}
|
|
156
|
+
return result.data;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** Unwraps the record batches, retaining schema on empty LAS results. */
|
|
160
|
+
export function getLASRecordBatches(result: MeshArrowTable): RecordBatch[] {
|
|
161
|
+
const table = toPublicLASResult(result) as Table;
|
|
162
|
+
return table.batches.length ? table.batches : [makeArrowMetadataBatch(table.schema)];
|
|
163
|
+
}
|
package/src/las/las-writer.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
+
import type {Table} from 'apache-arrow';
|
|
5
6
|
import {
|
|
6
7
|
encodeLASzipVLR,
|
|
7
8
|
encodeLAZChunk,
|
|
@@ -11,7 +12,7 @@ import {
|
|
|
11
12
|
type WriterWithEncoder
|
|
12
13
|
} from '@loaders.gl/core/loader-utils';
|
|
13
14
|
import type {Mesh, MeshArrowTable, MeshAttribute} from '@loaders.gl/core/schema';
|
|
14
|
-
import {
|
|
15
|
+
import {convertMeshToArrowTableWrapper, convertTableToMesh} from '@loaders.gl/core/schema-utils';
|
|
15
16
|
import {LASFormat} from './las-format';
|
|
16
17
|
|
|
17
18
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
@@ -86,7 +87,7 @@ export type LASWriterOptions = WriterOptions & {
|
|
|
86
87
|
*/
|
|
87
88
|
export const LASWriter = {
|
|
88
89
|
...LASFormat,
|
|
89
|
-
dataType: null as unknown as Mesh | MeshArrowTable,
|
|
90
|
+
dataType: null as unknown as Mesh | MeshArrowTable | Table,
|
|
90
91
|
batchType: null as never,
|
|
91
92
|
version: VERSION,
|
|
92
93
|
extensions: ['las', 'laz'],
|
|
@@ -96,16 +97,19 @@ export const LASWriter = {
|
|
|
96
97
|
encode: async (data, options) => encodeLASSync(data, options),
|
|
97
98
|
encodeSync: encodeLASSync,
|
|
98
99
|
encodeInBatches: async function* (dataIterator, options) {
|
|
99
|
-
const batches: (Mesh | MeshArrowTable)[] = [];
|
|
100
|
-
for await (const batch of dataIterator as AsyncIterable<Mesh | MeshArrowTable>) {
|
|
100
|
+
const batches: (Mesh | MeshArrowTable | Table)[] = [];
|
|
101
|
+
for await (const batch of dataIterator as AsyncIterable<Mesh | MeshArrowTable | Table>) {
|
|
101
102
|
batches.push(batch);
|
|
102
103
|
}
|
|
103
104
|
yield encodeLASSync(mergeMeshBatches(batches), options);
|
|
104
105
|
}
|
|
105
|
-
} as const satisfies WriterWithEncoder<Mesh | MeshArrowTable, never, LASWriterOptions>;
|
|
106
|
+
} as const satisfies WriterWithEncoder<Mesh | MeshArrowTable | Table, never, LASWriterOptions>;
|
|
106
107
|
|
|
107
108
|
/** Encode mesh category data as LAS or LAZ bytes. */
|
|
108
|
-
function encodeLASSync(
|
|
109
|
+
function encodeLASSync(
|
|
110
|
+
data: Mesh | MeshArrowTable | Table,
|
|
111
|
+
options: LASWriterOptions = {}
|
|
112
|
+
): ArrayBuffer {
|
|
109
113
|
const format = options.las?.format || 'las';
|
|
110
114
|
const colorDepth = options.las?.colorDepth;
|
|
111
115
|
if (colorDepth !== undefined && colorDepth !== 'auto' && colorDepth !== 8 && colorDepth !== 16)
|
|
@@ -652,22 +656,22 @@ function validateLAZOptions(
|
|
|
652
656
|
}
|
|
653
657
|
|
|
654
658
|
/** Return mesh data as a Mesh, converting MeshArrowTable input first. */
|
|
655
|
-
function normalizeMesh(data: Mesh | MeshArrowTable): Mesh {
|
|
656
|
-
if ('
|
|
659
|
+
function normalizeMesh(data: Mesh | MeshArrowTable | Table): Mesh {
|
|
660
|
+
if (!('attributes' in data)) {
|
|
657
661
|
return convertTableToMesh(data);
|
|
658
662
|
}
|
|
659
663
|
return data as Mesh;
|
|
660
664
|
}
|
|
661
665
|
|
|
662
666
|
/** Return mesh data as a MeshArrowTable, converting plain Mesh data first. */
|
|
663
|
-
function normalizeMeshArrowTable(data: Mesh | MeshArrowTable): MeshArrowTable {
|
|
664
|
-
return '
|
|
665
|
-
? data
|
|
666
|
-
: convertMeshToTable(data as Mesh, 'arrow-table');
|
|
667
|
+
function normalizeMeshArrowTable(data: Mesh | MeshArrowTable | Table): MeshArrowTable | Table {
|
|
668
|
+
return !('attributes' in data) ? data : convertMeshToArrowTableWrapper(data as Mesh);
|
|
667
669
|
}
|
|
668
670
|
|
|
669
671
|
/** Merge buffered mesh batches for `encodeInBatches`. */
|
|
670
|
-
function mergeMeshBatches(
|
|
672
|
+
function mergeMeshBatches(
|
|
673
|
+
batches: (Mesh | MeshArrowTable | Table)[]
|
|
674
|
+
): Mesh | MeshArrowTable | Table {
|
|
671
675
|
if (batches.length === 0) {
|
|
672
676
|
throw new Error('LASWriter: at least one input batch is required');
|
|
673
677
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
// LASER (LAS) FILE FORMAT
|
|
6
6
|
import type {Loader} from '@loaders.gl/core/loader-utils';
|
|
7
|
-
import type {
|
|
7
|
+
import type {Table, RecordBatch} from 'apache-arrow';
|
|
8
8
|
import {LAS_LOADER_METADATA, type LASLoaderOptions} from './las-loader-shared';
|
|
9
9
|
import type {LASMesh} from './lib/las-types';
|
|
10
10
|
|
|
@@ -15,7 +15,7 @@ export const LAZRsLoader = {
|
|
|
15
15
|
...LAS_LOADER_METADATA,
|
|
16
16
|
name: 'LAS (laz-rs)',
|
|
17
17
|
preload: async () => {
|
|
18
|
-
const {LAZRsLoaderWithParser} = await import('@loaders.gl/pointclouds/
|
|
18
|
+
const {LAZRsLoaderWithParser} = await import('@loaders.gl/pointclouds/laz-rs-loader');
|
|
19
19
|
return LAZRsLoaderWithParser;
|
|
20
20
|
}
|
|
21
|
-
} as const satisfies Loader<LASMesh |
|
|
21
|
+
} as const satisfies Loader<LASMesh | Table, LASMesh | RecordBatch, LASLoaderOptions>;
|
package/src/las/laz-rs-loader.ts
CHANGED
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
// LASER (LAS) FILE FORMAT
|
|
6
6
|
import type {LoaderWithParser} from '@loaders.gl/core/loader-utils';
|
|
7
|
+
import type {Table, RecordBatch} from 'apache-arrow';
|
|
8
|
+
import {getLASRecordBatches, toPublicLASResult} from './las-loader';
|
|
7
9
|
import type {MeshArrowTable} from '@loaders.gl/core/schema';
|
|
8
|
-
import {
|
|
10
|
+
import {convertMeshToArrowTableWrapper, convertTableToMesh} from '@loaders.gl/core/schema-utils';
|
|
9
11
|
import {
|
|
10
12
|
formatLASMeshColors,
|
|
11
13
|
getLASShape,
|
|
@@ -24,25 +26,23 @@ export const LAZRsLoaderWithParser = {
|
|
|
24
26
|
name: 'LAS (laz-rs)',
|
|
25
27
|
parse: async (arrayBuffer: ArrayBuffer, options?: LASLoaderOptions) => {
|
|
26
28
|
await initLazRsWasm();
|
|
27
|
-
return convertLASMesh(parseLAS(arrayBuffer, {...options}), options);
|
|
29
|
+
return toPublicLASResult(convertLASMesh(parseLAS(arrayBuffer, {...options}), options));
|
|
28
30
|
},
|
|
29
31
|
parseInBatches: async function* (arrayBufferIterator, options?: LASLoaderOptions) {
|
|
30
32
|
await initLazRsWasm();
|
|
31
33
|
for await (const mesh of parseLASInBatches(arrayBufferIterator, options)) {
|
|
32
|
-
|
|
34
|
+
const result = convertLASMesh(mesh, options);
|
|
35
|
+
if ('shape' in result) yield* getLASRecordBatches(result);
|
|
36
|
+
else yield result;
|
|
33
37
|
}
|
|
34
38
|
}
|
|
35
|
-
} as const satisfies LoaderWithParser<
|
|
36
|
-
LASMesh | MeshArrowTable,
|
|
37
|
-
LASMesh | MeshArrowTable,
|
|
38
|
-
LASLoaderOptions
|
|
39
|
-
>;
|
|
39
|
+
} as const satisfies LoaderWithParser<LASMesh | Table, LASMesh | RecordBatch, LASLoaderOptions>;
|
|
40
40
|
|
|
41
41
|
function convertLASMesh(mesh: LASMesh, options?: LASLoaderOptions): LASMesh | MeshArrowTable {
|
|
42
42
|
const formattedMesh = formatLASMeshColors(mesh, options?.las?.colorFormat || 'uint8norm');
|
|
43
|
-
const table =
|
|
44
|
-
if (getLASShape(options) === 'arrow
|
|
45
|
-
return table;
|
|
43
|
+
const table = convertMeshToArrowTableWrapper(formattedMesh) as MeshArrowTable;
|
|
44
|
+
if (getLASShape(options) === 'arrow') {
|
|
45
|
+
return {...table, loaderData: mesh.loaderData};
|
|
46
46
|
}
|
|
47
47
|
return {
|
|
48
48
|
...(convertTableToMesh(table) as LASMesh),
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
// LASER (LAS) FILE FORMAT
|
|
6
6
|
import type {Loader} from '@loaders.gl/core/loader-utils';
|
|
7
|
-
import type {
|
|
7
|
+
import type {Table, RecordBatch} from 'apache-arrow';
|
|
8
8
|
import {LAS_LOADER_METADATA, type LASLoaderOptions} from './las-loader-shared';
|
|
9
9
|
import type {LASMesh} from './lib/las-types';
|
|
10
10
|
|
|
@@ -16,7 +16,7 @@ export const LAZPerfLoader = {
|
|
|
16
16
|
...LAS_LOADER_METADATA,
|
|
17
17
|
name: 'LAS (laz-perf)',
|
|
18
18
|
preload: async () => {
|
|
19
|
-
const {LAZPerfLoaderWithParser} = await import('@loaders.gl/pointclouds/
|
|
19
|
+
const {LAZPerfLoaderWithParser} = await import('@loaders.gl/pointclouds/lazperf-loader');
|
|
20
20
|
return LAZPerfLoaderWithParser;
|
|
21
21
|
}
|
|
22
|
-
} as const satisfies Loader<LASMesh |
|
|
22
|
+
} as const satisfies Loader<LASMesh | Table, LASMesh | RecordBatch, LASLoaderOptions>;
|
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
// LASER (LAS) FILE FORMAT
|
|
6
6
|
import type {LoaderWithParser} from '@loaders.gl/core/loader-utils';
|
|
7
|
+
import type {Table, RecordBatch} from 'apache-arrow';
|
|
8
|
+
import {getLASRecordBatches, toPublicLASResult} from './las-loader';
|
|
7
9
|
import type {MeshArrowTable} from '@loaders.gl/core/schema';
|
|
8
|
-
import {
|
|
10
|
+
import {convertMeshToArrowTableWrapper, convertTableToMesh} from '@loaders.gl/core/schema-utils';
|
|
9
11
|
import {
|
|
10
12
|
formatLASMeshColors,
|
|
11
13
|
getLASShape,
|
|
@@ -23,23 +25,19 @@ export const LAZPerfLoaderWithParser = {
|
|
|
23
25
|
...LAS_LOADER_METADATA,
|
|
24
26
|
name: 'LAS (laz-perf)',
|
|
25
27
|
parse: async (arrayBuffer: ArrayBuffer, options?: LASLoaderOptions) =>
|
|
26
|
-
convertLASMesh(parseLAS(arrayBuffer, options), options),
|
|
28
|
+
toPublicLASResult(convertLASMesh(parseLAS(arrayBuffer, options), options)),
|
|
27
29
|
parseSync: (arrayBuffer: ArrayBuffer, options?: LASLoaderOptions) =>
|
|
28
|
-
convertLASMesh(parseLAS(arrayBuffer, options), options),
|
|
30
|
+
toPublicLASResult(convertLASMesh(parseLAS(arrayBuffer, options), options)),
|
|
29
31
|
parseInBatches: async function* (arrayBufferIterator, options?: LASLoaderOptions) {
|
|
30
32
|
yield* convertLASMeshBatches(parseLASInBatches(arrayBufferIterator, options), options);
|
|
31
33
|
}
|
|
32
|
-
} as const satisfies LoaderWithParser<
|
|
33
|
-
LASMesh | MeshArrowTable,
|
|
34
|
-
LASMesh | MeshArrowTable,
|
|
35
|
-
LASLoaderOptions
|
|
36
|
-
>;
|
|
34
|
+
} as const satisfies LoaderWithParser<LASMesh | Table, LASMesh | RecordBatch, LASLoaderOptions>;
|
|
37
35
|
|
|
38
36
|
function convertLASMesh(mesh: LASMesh, options?: LASLoaderOptions): LASMesh | MeshArrowTable {
|
|
39
37
|
const formattedMesh = formatLASMeshColors(mesh, options?.las?.colorFormat || 'uint8norm');
|
|
40
|
-
const table =
|
|
41
|
-
if (getLASShape(options) === 'arrow
|
|
42
|
-
return table;
|
|
38
|
+
const table = convertMeshToArrowTableWrapper(formattedMesh) as MeshArrowTable;
|
|
39
|
+
if (getLASShape(options) === 'arrow') {
|
|
40
|
+
return {...table, loaderData: mesh.loaderData};
|
|
43
41
|
}
|
|
44
42
|
return {
|
|
45
43
|
...(convertTableToMesh(table) as LASMesh),
|
|
@@ -58,8 +56,10 @@ function convertLASMesh(mesh: LASMesh, options?: LASLoaderOptions): LASMesh | Me
|
|
|
58
56
|
async function* convertLASMeshBatches(
|
|
59
57
|
meshBatches: AsyncIterable<LASMesh>,
|
|
60
58
|
options?: LASLoaderOptions
|
|
61
|
-
): AsyncIterable<LASMesh |
|
|
59
|
+
): AsyncIterable<LASMesh | RecordBatch> {
|
|
62
60
|
for await (const mesh of meshBatches) {
|
|
63
|
-
|
|
61
|
+
const result = convertLASMesh(mesh, options);
|
|
62
|
+
if ('shape' in result) yield* getLASRecordBatches(result);
|
|
63
|
+
else yield result;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -260,6 +260,6 @@ function detectTwoByteColors(
|
|
|
260
260
|
* @returns Point count per decoded batch
|
|
261
261
|
*/
|
|
262
262
|
function getBatchSize(options: LASLoaderOptions): number {
|
|
263
|
-
const batchSize = options.
|
|
263
|
+
const batchSize = options.core?.batchSize;
|
|
264
264
|
return typeof batchSize === 'number' ? batchSize : DEFAULT_BATCH_SIZE;
|
|
265
265
|
}
|
|
@@ -46,5 +46,10 @@ export function makeMetadataFromLasHeader(lasHeader: LASHeader): Record<string,
|
|
|
46
46
|
if (lasHeader.isCompressed !== undefined) {
|
|
47
47
|
metadata.las_isCompressed = lasHeader.isCompressed.toString();
|
|
48
48
|
}
|
|
49
|
+
if (lasHeader.metadata?.wkt) metadata.las_wkt = lasHeader.metadata.wkt;
|
|
50
|
+
if (lasHeader.metadata?.wktMathTransform)
|
|
51
|
+
metadata.las_wktMathTransform = lasHeader.metadata.wktMathTransform;
|
|
52
|
+
if (lasHeader.metadata?.geotiff)
|
|
53
|
+
metadata.las_geotiff = JSON.stringify(lasHeader.metadata.geotiff);
|
|
49
54
|
return metadata;
|
|
50
55
|
}
|
|
@@ -166,10 +166,12 @@ export function populateLASTypedExtraBytes(
|
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
function readLASString(bytes: Uint8Array, offset: number, length: number): string {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
169
|
+
const decoded = new TextDecoder().decode(bytes.subarray(offset, offset + length));
|
|
170
|
+
let end = decoded.length;
|
|
171
|
+
while (end > 0 && decoded[end - 1] === '\0') {
|
|
172
|
+
end--;
|
|
173
|
+
}
|
|
174
|
+
return decoded.slice(0, end).trim();
|
|
173
175
|
}
|
|
174
176
|
|
|
175
177
|
function sanitizeExtraBytesName(name: string): string {
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
// ported and es6-ified from https://github.com/verma/plasio/
|
|
6
|
-
|
|
6
|
+
import {getLoaderLog} from '@loaders.gl/core/loader-utils';
|
|
7
7
|
import type {LASLoaderOptions} from '../../las-loader-types';
|
|
8
8
|
import type {LASMesh, LASHeader} from '../las-types';
|
|
9
9
|
import type {MeshAttributes} from '@loaders.gl/core/schema';
|
|
10
|
-
import {getMeshBoundingBox
|
|
10
|
+
import {getMeshBoundingBox} from '@loaders.gl/core/schema-utils';
|
|
11
11
|
import {concatenateArrayBuffersAsync} from '@loaders.gl/core/loader-utils';
|
|
12
12
|
import {getLASSchema} from '../get-las-schema';
|
|
13
13
|
import {LASFile} from './laslaz-decoder';
|
|
@@ -133,7 +133,7 @@ function parseLASMesh(arrayBuffer: ArrayBuffer, options: LASLoaderOptions = {}):
|
|
|
133
133
|
offset: [offsetX, offsetY, offsetZ]
|
|
134
134
|
} = lasHeader;
|
|
135
135
|
|
|
136
|
-
const twoByteColor = detectTwoByteColors(decoder, batchSize, options
|
|
136
|
+
const twoByteColor = detectTwoByteColors(decoder, batchSize, options);
|
|
137
137
|
|
|
138
138
|
for (let i = 0; i < batchSize; i++) {
|
|
139
139
|
const {position, color, intensity, classification} = decoder.getPoint(i);
|
|
@@ -270,7 +270,7 @@ function populateLASAttributes(
|
|
|
270
270
|
scale: [scaleX, scaleY, scaleZ],
|
|
271
271
|
offset: [offsetX, offsetY, offsetZ]
|
|
272
272
|
} = lasHeader;
|
|
273
|
-
const twoByteColor = detectTwoByteColors(decoder, batchSize, options
|
|
273
|
+
const twoByteColor = detectTwoByteColors(decoder, batchSize, options);
|
|
274
274
|
|
|
275
275
|
for (let i = 0; i < batchSize; i++) {
|
|
276
276
|
const {position, color, intensity, classification} = decoder.getPoint(i);
|
|
@@ -369,7 +369,7 @@ function* parseLASChunkedIterator(
|
|
|
369
369
|
* @returns Point count per decoded batch
|
|
370
370
|
*/
|
|
371
371
|
function getBatchSize(options: LASLoaderOptions): number {
|
|
372
|
-
const batchSize = options.
|
|
372
|
+
const batchSize = options.core?.batchSize;
|
|
373
373
|
return typeof batchSize === 'number' ? batchSize : DEFAULT_BATCH_SIZE;
|
|
374
374
|
}
|
|
375
375
|
|
|
@@ -382,10 +382,10 @@ function getBatchSize(options: LASLoaderOptions): number {
|
|
|
382
382
|
function detectTwoByteColors(
|
|
383
383
|
decoder: any = {},
|
|
384
384
|
batchSize: number,
|
|
385
|
-
|
|
385
|
+
options: LASLoaderOptions
|
|
386
386
|
): boolean {
|
|
387
387
|
let twoByteColor = false;
|
|
388
|
-
switch (colorDepth) {
|
|
388
|
+
switch (options.las?.colorDepth) {
|
|
389
389
|
case 8:
|
|
390
390
|
twoByteColor = false;
|
|
391
391
|
break;
|
|
@@ -404,8 +404,7 @@ function detectTwoByteColors(
|
|
|
404
404
|
}
|
|
405
405
|
break;
|
|
406
406
|
default:
|
|
407
|
-
|
|
408
|
-
console.warn('las: illegal value for options.las.colorDepth');
|
|
407
|
+
getLoaderLog(options).warn('las: illegal value for options.las.colorDepth')();
|
|
409
408
|
break;
|
|
410
409
|
}
|
|
411
410
|
return twoByteColor;
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
// ported and es6-ified from https://github.com/verma/plasio/
|
|
6
|
-
|
|
6
|
+
import {getLoaderLog} from '@loaders.gl/core/loader-utils';
|
|
7
7
|
import type {LASLoaderOptions} from '../../las-loader-types';
|
|
8
8
|
import type {LASMesh, LASHeader} from '../las-types';
|
|
9
9
|
import type {MeshAttributes} from '@loaders.gl/core/schema';
|
|
10
|
-
import {getMeshBoundingBox
|
|
10
|
+
import {getMeshBoundingBox} from '@loaders.gl/core/schema-utils';
|
|
11
11
|
import {concatenateArrayBuffersAsync} from '@loaders.gl/core/loader-utils';
|
|
12
12
|
import {getLASSchema} from '../get-las-schema';
|
|
13
13
|
import {LASFile} from './laslaz-decoder';
|
|
@@ -133,7 +133,7 @@ function parseLASMesh(arrayBuffer: ArrayBuffer, options: LASLoaderOptions = {}):
|
|
|
133
133
|
offset: [offsetX, offsetY, offsetZ]
|
|
134
134
|
} = lasHeader;
|
|
135
135
|
|
|
136
|
-
const twoByteColor = detectTwoByteColors(decoder, batchSize, options
|
|
136
|
+
const twoByteColor = detectTwoByteColors(decoder, batchSize, options);
|
|
137
137
|
|
|
138
138
|
for (let i = 0; i < batchSize; i++) {
|
|
139
139
|
const {position, color, intensity, classification} = decoder.getPoint(i);
|
|
@@ -270,7 +270,7 @@ function populateLASAttributes(
|
|
|
270
270
|
scale: [scaleX, scaleY, scaleZ],
|
|
271
271
|
offset: [offsetX, offsetY, offsetZ]
|
|
272
272
|
} = lasHeader;
|
|
273
|
-
const twoByteColor = detectTwoByteColors(decoder, batchSize, options
|
|
273
|
+
const twoByteColor = detectTwoByteColors(decoder, batchSize, options);
|
|
274
274
|
|
|
275
275
|
for (let i = 0; i < batchSize; i++) {
|
|
276
276
|
const {position, color, intensity, classification} = decoder.getPoint(i);
|
|
@@ -369,7 +369,7 @@ function* parseLASChunkedIterator(
|
|
|
369
369
|
* @returns Point count per decoded batch
|
|
370
370
|
*/
|
|
371
371
|
function getBatchSize(options: LASLoaderOptions): number {
|
|
372
|
-
const batchSize = options.
|
|
372
|
+
const batchSize = options.core?.batchSize;
|
|
373
373
|
return typeof batchSize === 'number' ? batchSize : DEFAULT_BATCH_SIZE;
|
|
374
374
|
}
|
|
375
375
|
|
|
@@ -382,10 +382,10 @@ function getBatchSize(options: LASLoaderOptions): number {
|
|
|
382
382
|
function detectTwoByteColors(
|
|
383
383
|
decoder: any = {},
|
|
384
384
|
batchSize: number,
|
|
385
|
-
|
|
385
|
+
options: LASLoaderOptions
|
|
386
386
|
): boolean {
|
|
387
387
|
let twoByteColor = false;
|
|
388
|
-
switch (colorDepth) {
|
|
388
|
+
switch (options.las?.colorDepth) {
|
|
389
389
|
case 8:
|
|
390
390
|
twoByteColor = false;
|
|
391
391
|
break;
|
|
@@ -404,8 +404,7 @@ function detectTwoByteColors(
|
|
|
404
404
|
}
|
|
405
405
|
break;
|
|
406
406
|
default:
|
|
407
|
-
|
|
408
|
-
console.warn('las: illegal value for options.las.colorDepth');
|
|
407
|
+
getLoaderLog(options).warn('las: illegal value for options.las.colorDepth')();
|
|
409
408
|
break;
|
|
410
409
|
}
|
|
411
410
|
return twoByteColor;
|