@loaders.gl/las 4.4.0-alpha.2 → 4.4.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.dev.js +1022 -77
- package/dist/dist.min.js +21 -21
- package/dist/index.cjs +1024 -79
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -0
- package/dist/las-arrow-loader.d.ts +10 -8
- package/dist/las-arrow-loader.d.ts.map +1 -1
- package/dist/las-arrow-loader.js +5 -4
- package/dist/las-arrow-loader.js.map +1 -0
- package/dist/las-format.d.ts +2 -2
- package/dist/las-format.js +3 -2
- package/dist/las-format.js.map +1 -0
- package/dist/las-loader.d.ts +2 -31
- package/dist/las-loader.d.ts.map +1 -1
- package/dist/las-loader.js +2 -20
- package/dist/las-loader.js.map +1 -0
- package/dist/las-worker.js +65 -71
- package/dist/laz-rs-loader.d.ts +29 -0
- package/dist/laz-rs-loader.d.ts.map +1 -0
- package/dist/laz-rs-loader.js +17 -0
- package/dist/laz-rs-loader.js.map +1 -0
- package/dist/lazperf-loader.d.ts +31 -0
- package/dist/lazperf-loader.d.ts.map +1 -0
- package/dist/lazperf-loader.js +15 -0
- package/dist/lazperf-loader.js.map +1 -0
- package/dist/lib/get-las-schema.d.ts +1 -1
- package/dist/lib/get-las-schema.js +2 -1
- package/dist/lib/get-las-schema.js.map +1 -0
- package/dist/lib/las-types.d.ts +1 -0
- package/dist/lib/las-types.d.ts.map +1 -1
- package/dist/lib/las-types.js +1 -0
- package/dist/lib/las-types.js.map +1 -0
- package/dist/lib/{laslaz-decoder.d.ts → laz-perf/laslaz-decoder.d.ts} +1 -1
- package/dist/lib/laz-perf/laslaz-decoder.d.ts.map +1 -0
- package/dist/lib/{laslaz-decoder.js → laz-perf/laslaz-decoder.js} +4 -2
- package/dist/lib/laz-perf/laslaz-decoder.js.map +1 -0
- package/dist/lib/{parse-las.d.ts → laz-perf/parse-las.d.ts} +3 -3
- package/dist/lib/laz-perf/parse-las.d.ts.map +1 -0
- package/dist/lib/{parse-las.js → laz-perf/parse-las.js} +6 -6
- package/dist/lib/laz-perf/parse-las.js.map +1 -0
- package/dist/lib/laz-rs-wasm/laslaz-decoder.d.ts +134 -0
- package/dist/lib/laz-rs-wasm/laslaz-decoder.d.ts.map +1 -0
- package/dist/lib/laz-rs-wasm/laslaz-decoder.js +446 -0
- package/dist/lib/laz-rs-wasm/laslaz-decoder.js.map +1 -0
- package/dist/lib/laz-rs-wasm/parse-las.d.ts +18 -0
- package/dist/lib/laz-rs-wasm/parse-las.d.ts.map +1 -0
- package/dist/lib/laz-rs-wasm/parse-las.js +188 -0
- package/dist/lib/laz-rs-wasm/parse-las.js.map +1 -0
- package/dist/libs/laz-perf/laz-perf.d.ts.map +1 -0
- package/dist/{lib/libs → libs/laz-perf}/laz-perf.js +1 -0
- package/dist/libs/laz-perf/laz-perf.js.map +1 -0
- package/dist/libs/laz-rs-wasm/laz_rs_wasm.d.ts +95 -0
- package/dist/libs/laz-rs-wasm/laz_rs_wasm.d.ts.map +1 -0
- package/dist/libs/laz-rs-wasm/laz_rs_wasm.js +425 -0
- package/dist/libs/laz-rs-wasm/laz_rs_wasm.js.map +1 -0
- package/dist/workers/las-worker.js +1 -0
- package/dist/workers/las-worker.js.map +1 -0
- package/package.json +8 -5
- package/src/index.ts +8 -1
- package/src/las-arrow-loader.ts +6 -5
- package/src/las-format.ts +2 -2
- package/src/las-loader.ts +1 -23
- package/src/laz-rs-loader.ts +22 -0
- package/src/lazperf-loader.ts +22 -0
- package/src/lib/get-las-schema.ts +1 -1
- package/src/lib/las-types.ts +1 -0
- package/src/lib/{laslaz-decoder.ts → laz-perf/laslaz-decoder.ts} +4 -3
- package/src/lib/{parse-las.ts → laz-perf/parse-las.ts} +7 -10
- package/src/lib/laz-rs-wasm/laslaz-decoder.ts +528 -0
- package/src/lib/laz-rs-wasm/parse-las.ts +232 -0
- package/src/libs/laz-rs-wasm/laz_rs_wasm.d.ts +80 -0
- package/src/libs/laz-rs-wasm/laz_rs_wasm.js +477 -0
- package/src/libs/laz-rs-wasm/laz_rs_wasm_bg.wasm +0 -0
- package/src/libs/laz-rs-wasm/laz_rs_wasm_bg.wasm.d.ts +31 -0
- package/src/libs/laz-rs-wasm/package.json +19 -0
- package/dist/lib/laslaz-decoder.d.ts.map +0 -1
- package/dist/lib/libs/laz-perf.d.ts.map +0 -1
- package/dist/lib/parse-las.d.ts.map +0 -1
- /package/dist/{lib/libs → libs/laz-perf}/laz-perf.d.ts +0 -0
- /package/src/{lib/libs → libs/laz-perf}/laz-perf.ts +0 -0
package/src/las-loader.ts
CHANGED
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
// LASER (LAS) FILE FORMAT
|
|
6
|
-
import type {Loader,
|
|
6
|
+
import type {Loader, LoaderOptions} from '@loaders.gl/loader-utils';
|
|
7
7
|
import type {LASMesh} from './lib/las-types';
|
|
8
8
|
import {LASFormat} from './las-format';
|
|
9
|
-
import {parseLAS} from './lib/parse-las';
|
|
10
9
|
|
|
11
10
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
12
11
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
@@ -26,7 +25,6 @@ export type LASLoaderOptions = LoaderOptions & {
|
|
|
26
25
|
|
|
27
26
|
/**
|
|
28
27
|
* Loader for the LAS (LASer) point cloud format
|
|
29
|
-
* @note Does not support LAS v1.4
|
|
30
28
|
*/
|
|
31
29
|
export const LASWorkerLoader = {
|
|
32
30
|
...LASFormat,
|
|
@@ -34,16 +32,8 @@ export const LASWorkerLoader = {
|
|
|
34
32
|
dataType: null as unknown as LASMesh,
|
|
35
33
|
batchType: null as never,
|
|
36
34
|
|
|
37
|
-
name: 'LAS',
|
|
38
|
-
id: 'las',
|
|
39
|
-
module: 'las',
|
|
40
35
|
version: VERSION,
|
|
41
36
|
worker: true,
|
|
42
|
-
extensions: ['las', 'laz'], // LAZ is the "compressed" flavor of LAS,
|
|
43
|
-
mimeTypes: ['application/octet-stream'], // TODO - text version?
|
|
44
|
-
text: true,
|
|
45
|
-
binary: true,
|
|
46
|
-
tests: ['LAS'],
|
|
47
37
|
options: {
|
|
48
38
|
las: {
|
|
49
39
|
shape: 'mesh',
|
|
@@ -53,15 +43,3 @@ export const LASWorkerLoader = {
|
|
|
53
43
|
}
|
|
54
44
|
}
|
|
55
45
|
} as const satisfies Loader<LASMesh, never, LASLoaderOptions>;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Loader for the LAS (LASer) point cloud format
|
|
59
|
-
* @note Does not support LAS v1.4
|
|
60
|
-
*/
|
|
61
|
-
export const LASLoader = {
|
|
62
|
-
...LASWorkerLoader,
|
|
63
|
-
parse: async (arrayBuffer: ArrayBuffer, options?: LASLoaderOptions) =>
|
|
64
|
-
parseLAS(arrayBuffer, options),
|
|
65
|
-
parseSync: (arrayBuffer: ArrayBuffer, options?: LASLoaderOptions) =>
|
|
66
|
-
parseLAS(arrayBuffer, options)
|
|
67
|
-
} as const satisfies LoaderWithParser<LASMesh, never, LASLoaderOptions>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
// LASER (LAS) FILE FORMAT
|
|
6
|
+
import type {LoaderWithParser} from '@loaders.gl/loader-utils';
|
|
7
|
+
import type {LASLoaderOptions} from './las-loader';
|
|
8
|
+
import {LASWorkerLoader} from './las-loader';
|
|
9
|
+
import type {LASMesh} from './lib/las-types';
|
|
10
|
+
import {parseLAS} from './lib/laz-rs-wasm/parse-las';
|
|
11
|
+
import initLazRsWasm from './libs/laz-rs-wasm/laz_rs_wasm';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Loader for the LAS (LASer) point cloud format
|
|
15
|
+
*/
|
|
16
|
+
export const LAZRsLoader = {
|
|
17
|
+
...LASWorkerLoader,
|
|
18
|
+
parse: async (arrayBuffer: ArrayBuffer, options?: LASLoaderOptions) => {
|
|
19
|
+
await initLazRsWasm();
|
|
20
|
+
return parseLAS(arrayBuffer, {...options});
|
|
21
|
+
}
|
|
22
|
+
} as const satisfies LoaderWithParser<LASMesh, never, LASLoaderOptions>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
// LASER (LAS) FILE FORMAT
|
|
6
|
+
import type {LoaderWithParser} from '@loaders.gl/loader-utils';
|
|
7
|
+
import type {LASLoaderOptions} from './las-loader';
|
|
8
|
+
import {LASWorkerLoader} from './las-loader';
|
|
9
|
+
import type {LASMesh} from './lib/las-types';
|
|
10
|
+
import {parseLAS} from './lib/laz-perf/parse-las';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Loader for the LAS (LASer) point cloud format
|
|
14
|
+
* @note Does not support LAS v1.4
|
|
15
|
+
*/
|
|
16
|
+
export const LAZPerfLoader = {
|
|
17
|
+
...LASWorkerLoader,
|
|
18
|
+
parse: async (arrayBuffer: ArrayBuffer, options?: LASLoaderOptions) =>
|
|
19
|
+
parseLAS(arrayBuffer, options),
|
|
20
|
+
parseSync: (arrayBuffer: ArrayBuffer, options?: LASLoaderOptions) =>
|
|
21
|
+
parseLAS(arrayBuffer, options)
|
|
22
|
+
} as const satisfies LoaderWithParser<LASMesh, never, LASLoaderOptions>;
|
package/src/lib/las-types.ts
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
MIT License
|
|
9
9
|
*/
|
|
10
10
|
// laslaz.js - treat as compiled code
|
|
11
|
-
import type {LASHeader} from '
|
|
12
|
-
import getModule from '
|
|
11
|
+
import type {LASHeader} from '../las-types';
|
|
12
|
+
import getModule from '../../libs/laz-perf/laz-perf';
|
|
13
13
|
|
|
14
14
|
let Module: any = null;
|
|
15
15
|
|
|
@@ -130,7 +130,8 @@ class LASLoader {
|
|
|
130
130
|
totalToRead: 0,
|
|
131
131
|
totalRead: 0,
|
|
132
132
|
versionAsString: '',
|
|
133
|
-
isCompressed: true
|
|
133
|
+
isCompressed: true,
|
|
134
|
+
hasColor: false
|
|
134
135
|
};
|
|
135
136
|
|
|
136
137
|
constructor(arraybuffer: ArrayBuffer) {
|
|
@@ -4,25 +4,23 @@
|
|
|
4
4
|
|
|
5
5
|
// ported and es6-ified from https://github.com/verma/plasio/
|
|
6
6
|
// import type {ArrowTable, ColumnarTable} from '@loaders.gl/schema';
|
|
7
|
-
import type {LASLoaderOptions} from '
|
|
8
|
-
import type {LASMesh, LASHeader} from '
|
|
7
|
+
import type {LASLoaderOptions} from '../../las-loader';
|
|
8
|
+
import type {LASMesh, LASHeader} from '../las-types';
|
|
9
9
|
import {getMeshBoundingBox /* , convertMeshToTable */} from '@loaders.gl/schema-utils';
|
|
10
|
+
import {getLASSchema} from '../get-las-schema';
|
|
10
11
|
import {LASFile} from './laslaz-decoder';
|
|
11
|
-
import {getLASSchema} from './get-las-schema';
|
|
12
12
|
|
|
13
13
|
type LASChunk = {
|
|
14
14
|
count: number;
|
|
15
15
|
buffer: ArrayBuffer;
|
|
16
16
|
hasMoreData: boolean;
|
|
17
|
-
versionAsString?: string;
|
|
18
|
-
isCompressed?: boolean;
|
|
19
17
|
};
|
|
20
18
|
|
|
21
19
|
/**
|
|
22
20
|
* Parsing of .las file
|
|
23
21
|
* @param arrayBuffer
|
|
24
22
|
* @param options
|
|
25
|
-
* @returns
|
|
23
|
+
* @returns LASMesh
|
|
26
24
|
*/
|
|
27
25
|
export function parseLAS(arrayBuffer: ArrayBuffer, options?: LASLoaderOptions): LASMesh {
|
|
28
26
|
return parseLASMesh(arrayBuffer, options);
|
|
@@ -73,7 +71,7 @@ function parseLASMesh(arrayBuffer: ArrayBuffer, options: LASLoaderOptions = {}):
|
|
|
73
71
|
const PositionsType = options.las?.fp64 ? Float64Array : Float32Array;
|
|
74
72
|
positions = new PositionsType(total * 3);
|
|
75
73
|
// laslaz-decoder.js `pointFormatReaders`
|
|
76
|
-
colors = lasHeader.
|
|
74
|
+
colors = lasHeader.hasColor ? new Uint8Array(total * 4) : null;
|
|
77
75
|
intensities = new Uint16Array(total);
|
|
78
76
|
classifications = new Uint8Array(total);
|
|
79
77
|
|
|
@@ -172,13 +170,12 @@ export function parseLASChunked(rawData: ArrayBuffer, skip: number, onParseData:
|
|
|
172
170
|
|
|
173
171
|
/* eslint-disable no-constant-condition */
|
|
174
172
|
while (true) {
|
|
175
|
-
|
|
173
|
+
// @ts-ignore TODO - fix this, looks like we are not passing the right params?
|
|
174
|
+
const chunk: LASChunk = dataHandler.readData(1000 * 100, skip);
|
|
176
175
|
|
|
177
176
|
totalRead += chunk.count;
|
|
178
177
|
|
|
179
178
|
header.totalRead = totalRead;
|
|
180
|
-
header.versionAsString = chunk.versionAsString;
|
|
181
|
-
header.isCompressed = chunk.isCompressed;
|
|
182
179
|
|
|
183
180
|
const unpacker = new Unpacker(chunk.buffer, chunk.count, header);
|
|
184
181
|
|