@margoengine/points 0.0.0-stage → 1.0.0
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/LICENSE +201 -0
- package/NOTICE +4 -0
- package/README.md +876 -2
- package/dist/attributes-DNc-1pdr.js +256 -0
- package/dist/attributes.d.ts +48 -0
- package/dist/clip.d.ts +55 -0
- package/dist/clip.js +122 -0
- package/dist/cloud-B4O_G-Df.js +545 -0
- package/dist/cloud.d.ts +155 -0
- package/dist/color.d.ts +1 -0
- package/dist/copc-write.d.ts +95 -0
- package/dist/copc-write.js +318 -0
- package/dist/copc.d.ts +55 -0
- package/dist/copc.js +127 -0
- package/dist/depth-video.d.ts +98 -0
- package/dist/depth-video.js +164 -0
- package/dist/e57.d.ts +163 -0
- package/dist/e57.js +624 -0
- package/dist/frame.d.ts +14 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +1246 -0
- package/dist/las.d.ts +213 -0
- package/dist/las.js +500 -0
- package/dist/laz-encode-CHXgHra_.js +446 -0
- package/dist/laz-encode.d.ts +14 -0
- package/dist/laz-model-DCphHLqH.js +385 -0
- package/dist/laz-model.d.ts +47 -0
- package/dist/laz-write.d.ts +46 -0
- package/dist/laz-write.js +75 -0
- package/dist/laz.d.ts +50 -0
- package/dist/laz.js +645 -0
- package/dist/material.d.ts +167 -0
- package/dist/math.d.ts +103 -0
- package/dist/octree.d.ts +182 -0
- package/dist/octree.js +360 -0
- package/dist/pick.d.ts +76 -0
- package/dist/pick.js +192 -0
- package/dist/plugin.d.ts +235 -0
- package/dist/potree-las-RC8sjbYU.js +1 -0
- package/dist/potree-las.d.ts +1 -0
- package/dist/potree.d.ts +70 -0
- package/dist/potree.js +451 -0
- package/dist/range-BQuJAjUM.js +23 -0
- package/dist/range.d.ts +4 -0
- package/dist/screen-door-CALlYs39.js +7 -0
- package/dist/shaders-DCnbvb0-.js +282 -0
- package/dist/shaders.d.ts +52 -0
- package/dist/shared/fog.d.ts +33 -0
- package/dist/shared/pass.d.ts +53 -0
- package/dist/shared/selection-mask.d.ts +52 -0
- package/dist/shared/style-expression.d.ts +18 -0
- package/dist/sprites.d.ts +78 -0
- package/dist/storage-limit.d.ts +6 -0
- package/dist/style.d.ts +124 -0
- package/dist/style.js +709 -0
- package/dist/surfels.d.ts +95 -0
- package/dist/surfels.js +538 -0
- package/dist/survey-DToZwkJv.js +46 -0
- package/dist/survey.d.ts +10 -0
- package/dist/tier-BcFbLPVT.js +91 -0
- package/dist/tier.d.ts +6 -0
- package/package.json +102 -4
package/dist/las.d.ts
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/** One variable length record (VLR) or extended VLR (EVLR). */
|
|
2
|
+
export interface LASRecord {
|
|
3
|
+
readonly userId: string;
|
|
4
|
+
readonly recordId: number;
|
|
5
|
+
readonly description: string;
|
|
6
|
+
readonly data: Uint8Array;
|
|
7
|
+
readonly extended: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** An extra bytes attribute (LASF_Spec record 4). */
|
|
10
|
+
export interface LASExtraBytes {
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly description: string;
|
|
13
|
+
/** 1 u8, 2 i8, 3 u16, 4 i16, 5 u32, 6 i32, 7 u64, 8 i64, 9 f32, 10 f64; 0 = undocumented bytes. The deprecated pairs and triples (types 11 to 30) come as one entry per element, `name[0]`, `name[1]`, ... */
|
|
14
|
+
readonly dataType: number;
|
|
15
|
+
/** Byte offset inside the extra bytes of each record, and size. */
|
|
16
|
+
readonly offset: number;
|
|
17
|
+
readonly size: number;
|
|
18
|
+
readonly scale: number;
|
|
19
|
+
readonly addOffset: number;
|
|
20
|
+
readonly noData?: number;
|
|
21
|
+
}
|
|
22
|
+
/** The public header block. */
|
|
23
|
+
export interface LASHeader {
|
|
24
|
+
readonly versionMajor: number;
|
|
25
|
+
readonly versionMinor: number;
|
|
26
|
+
readonly fileSourceId: number;
|
|
27
|
+
readonly globalEncoding: number;
|
|
28
|
+
readonly projectId: string;
|
|
29
|
+
readonly systemIdentifier: string;
|
|
30
|
+
readonly generatingSoftware: string;
|
|
31
|
+
readonly creationDay: number;
|
|
32
|
+
readonly creationYear: number;
|
|
33
|
+
readonly headerSize: number;
|
|
34
|
+
readonly pointDataOffset: number;
|
|
35
|
+
/** Point data record format 0 to 10 (the compression bit 7 removed); see `compressed`. */
|
|
36
|
+
readonly pointFormat: number;
|
|
37
|
+
/** True for LAZ: bit 7 (or 6) of the format byte is set. */
|
|
38
|
+
readonly compressed: boolean;
|
|
39
|
+
readonly pointRecordLength: number;
|
|
40
|
+
readonly pointCount: number;
|
|
41
|
+
readonly pointsByReturn: readonly number[];
|
|
42
|
+
readonly scale: readonly [number, number, number];
|
|
43
|
+
readonly offset: readonly [number, number, number];
|
|
44
|
+
readonly min: readonly [number, number, number];
|
|
45
|
+
readonly max: readonly [number, number, number];
|
|
46
|
+
/** Where the waveform data record starts in this file (LAS 1.3 and later), 0 when it holds none. */
|
|
47
|
+
readonly waveformDataOffset: number;
|
|
48
|
+
/**
|
|
49
|
+
* LAS 1.5: the Time Offset in units of 10^6 s. With global encoding bits 0 and 6 both set, a point's standard GPS time
|
|
50
|
+
* is its `gpsTime` + 10^6 x `timeOffset`. 0 before LAS 1.5.
|
|
51
|
+
*/
|
|
52
|
+
readonly timeOffset: number;
|
|
53
|
+
/** LAS 1.5: the smallest and largest point GPS time as the header states them (both 0 when the writer left them). */
|
|
54
|
+
readonly gpsTimeRange?: readonly [number, number];
|
|
55
|
+
}
|
|
56
|
+
/** What `code` on a reader's RangeError or TypeError says went wrong. */
|
|
57
|
+
export type LASErrorCode = 'header' | 'truncated' | 'range' | 'unsupported';
|
|
58
|
+
/** The waveform packet of each point, in formats 4, 5, 9 and 10. */
|
|
59
|
+
export interface LASWavePackets {
|
|
60
|
+
/** Which wave packet descriptor a point uses (`lasWaveDescriptors`); 0 means it has no waveform. */
|
|
61
|
+
readonly descriptor: Uint8Array;
|
|
62
|
+
/** Byte offset of the samples, from the start of the waveform data record. */
|
|
63
|
+
readonly offset: Float64Array;
|
|
64
|
+
/** Size of the samples in bytes. */
|
|
65
|
+
readonly size: Uint32Array;
|
|
66
|
+
/** Time from the first sample to this return, in picoseconds. */
|
|
67
|
+
readonly location: Float32Array;
|
|
68
|
+
/** xyz per point: how the pulse moves per picosecond, to place any sample along its ray. */
|
|
69
|
+
readonly direction: Float32Array;
|
|
70
|
+
}
|
|
71
|
+
/** A wave packet descriptor (LASF_Spec records 100 to 354): how the samples of a waveform are stored. */
|
|
72
|
+
export interface LASWaveDescriptor {
|
|
73
|
+
readonly bitsPerSample: number;
|
|
74
|
+
/** 0 is uncompressed, the only value LAS defines. */
|
|
75
|
+
readonly compression: number;
|
|
76
|
+
readonly samples: number;
|
|
77
|
+
/** Time between samples in picoseconds. */
|
|
78
|
+
readonly spacing: number;
|
|
79
|
+
/** Volts per unit of a raw sample. */
|
|
80
|
+
readonly gain: number;
|
|
81
|
+
/** Volts at a raw sample of 0. */
|
|
82
|
+
readonly offset: number;
|
|
83
|
+
}
|
|
84
|
+
/** The coordinate reference system, when the file names one. */
|
|
85
|
+
export interface LASCrs {
|
|
86
|
+
/** OGC WKT (record 2112), when present. */
|
|
87
|
+
readonly wkt?: string;
|
|
88
|
+
/** EPSG code of the horizontal CRS (ProjectedCSTypeGeoKey 3072 or GeographicTypeGeoKey 2048). */
|
|
89
|
+
readonly epsg?: number;
|
|
90
|
+
/** EPSG code of the vertical CRS (VerticalCSTypeGeoKey 4096). */
|
|
91
|
+
readonly verticalEpsg?: number;
|
|
92
|
+
/** All GeoTIFF keys as id to value (numbers, or text for ASCII keys). */
|
|
93
|
+
readonly geoKeys?: ReadonlyMap<number, number | string | readonly number[]>;
|
|
94
|
+
}
|
|
95
|
+
/** Decoded points: float32 positions relative to `origin`, and every attribute of the format. */
|
|
96
|
+
export interface LASPoints {
|
|
97
|
+
readonly header: LASHeader;
|
|
98
|
+
readonly records: readonly LASRecord[];
|
|
99
|
+
readonly crs?: LASCrs;
|
|
100
|
+
readonly extraBytes: readonly LASExtraBytes[];
|
|
101
|
+
/** Points decoded (fewer than header.pointCount with `maxPoints`, a stride or a file cut short when `partial`). */
|
|
102
|
+
readonly count: number;
|
|
103
|
+
/** World position of local [0, 0, 0] (float64): see {@link LASOptions.origin}. */
|
|
104
|
+
readonly origin: readonly [number, number, number];
|
|
105
|
+
/** xyz per point relative to `origin`, float32 (sub-millimetre for a scan a few kilometres across). */
|
|
106
|
+
readonly positions: Float32Array;
|
|
107
|
+
readonly intensity: Uint16Array;
|
|
108
|
+
readonly returnNumber: Uint8Array;
|
|
109
|
+
readonly numberOfReturns: Uint8Array;
|
|
110
|
+
/** ASPRS class (0 to 31 for formats 0 to 5, 0 to 255 for 6 to 10). */
|
|
111
|
+
readonly classification: Uint8Array;
|
|
112
|
+
/** Bit 0 synthetic, 1 key-point, 2 withheld, 3 overlap. */
|
|
113
|
+
readonly classificationFlags: Uint8Array;
|
|
114
|
+
readonly scanDirection: Uint8Array;
|
|
115
|
+
readonly edgeOfFlightLine: Uint8Array;
|
|
116
|
+
/** Scan angle in degrees. */
|
|
117
|
+
readonly scanAngle: Float32Array;
|
|
118
|
+
readonly userData: Uint8Array;
|
|
119
|
+
readonly pointSourceId: Uint16Array;
|
|
120
|
+
readonly scannerChannel?: Uint8Array;
|
|
121
|
+
readonly gpsTime?: Float64Array;
|
|
122
|
+
/** RGB per point, 16-bit as stored. */
|
|
123
|
+
readonly rgb?: Uint16Array;
|
|
124
|
+
readonly nir?: Uint16Array;
|
|
125
|
+
/** Waveform packets, in formats 4, 5, 9 and 10. Read the samples with `lasWaveform`. */
|
|
126
|
+
readonly wavePackets?: LASWavePackets;
|
|
127
|
+
/** Extra bytes attributes, scaled and offset, by name. */
|
|
128
|
+
readonly extra: Readonly<Record<string, Float64Array>>;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Decompresses LAZ point data into uncompressed LAS records: all at once (a `Uint8Array`), or one chunk at a time (an
|
|
132
|
+
* async iterable of record blocks, decoded into the point arrays as they arrive, so the whole uncompressed file is
|
|
133
|
+
* never held). `createLazDecoder()` from `margoengine/points/laz` is one, and the default.
|
|
134
|
+
*/
|
|
135
|
+
export type LazDecoder = (file: Uint8Array, header: LASHeader, records: readonly LASRecord[], signal?: AbortSignal) => Uint8Array | Promise<Uint8Array> | AsyncIterable<Uint8Array>;
|
|
136
|
+
/** Options of `parseLAS`. */
|
|
137
|
+
export interface LASOptions {
|
|
138
|
+
/**
|
|
139
|
+
* World position to store positions relative to. Default: the header's bounding box centre; `'min'` is its minimum
|
|
140
|
+
* corner. Some writers put a wrong box in the header, so when the first point lies outside it the first point is the
|
|
141
|
+
* origin in both of those cases, which keeps float32 exact. The result's `origin` says which was used.
|
|
142
|
+
*/
|
|
143
|
+
origin?: readonly [number, number, number] | 'min';
|
|
144
|
+
/** Decode at most this many points. Default: all. */
|
|
145
|
+
maxPoints?: number;
|
|
146
|
+
/** Keep every n-th point (a quick preview). Default 1. */
|
|
147
|
+
stride?: number;
|
|
148
|
+
/** Decompressor for LAZ files. Default: `createLazDecoder()` from `margoengine/points/laz`, loaded when a file needs it. */
|
|
149
|
+
laz?: LazDecoder;
|
|
150
|
+
/** Accept a file whose point data is cut short (decode what is there). Default false: throw a RangeError. */
|
|
151
|
+
partial?: boolean;
|
|
152
|
+
signal?: AbortSignal;
|
|
153
|
+
}
|
|
154
|
+
/** Size in bytes of each standard point record format, 0 to 10. */
|
|
155
|
+
export declare const LAS_RECORD_SIZES: readonly number[];
|
|
156
|
+
/** Reads only the header and records (cheap: no point data is touched). */
|
|
157
|
+
export declare function readLASHeader(input: ArrayBuffer | Uint8Array): {
|
|
158
|
+
header: LASHeader;
|
|
159
|
+
records: LASRecord[];
|
|
160
|
+
};
|
|
161
|
+
/** The extra bytes descriptors (LASF_Spec record 4, which some writers split over several records), in record order. */
|
|
162
|
+
export declare function lasExtraBytes(records: readonly LASRecord[], header: LASHeader): LASExtraBytes[];
|
|
163
|
+
/** The CRS records: OGC WKT (2112) and GeoTIFF keys (34735, with doubles 34736 and ASCII 34737). */
|
|
164
|
+
export declare function lasCrs(records: readonly LASRecord[]): LASCrs | undefined;
|
|
165
|
+
/** The wave packet descriptors of a file (LASF_Spec records 100 to 354), by the index points store. */
|
|
166
|
+
export declare function lasWaveDescriptors(records: readonly LASRecord[]): Map<number, LASWaveDescriptor>;
|
|
167
|
+
/**
|
|
168
|
+
* The waveform of point `index`: its raw samples and their voltages. `source` is the file itself when the waveforms
|
|
169
|
+
* sit inside it, or the bytes of the `.wdp` file beside it when global encoding bit 2 says they sit outside.
|
|
170
|
+
* Returns undefined for a point with no waveform. Throws a MargoError with code `unsupported` for samples that are
|
|
171
|
+
* compressed or not 8, 16 or 32 bits, and a RangeError when `source` is too short.
|
|
172
|
+
*/
|
|
173
|
+
export declare function lasWaveform(las: Pick<LASPoints, 'header' | 'records' | 'wavePackets'>, index: number, source: Uint8Array): {
|
|
174
|
+
raw: Uint32Array;
|
|
175
|
+
volts: Float64Array;
|
|
176
|
+
spacing: number;
|
|
177
|
+
} | undefined;
|
|
178
|
+
/** Parses a LAS or LAZ file. A LAZ file loads the decoder of `margoengine/points/laz` unless `options.laz` is given. */
|
|
179
|
+
export declare function parseLAS(input: ArrayBuffer | Uint8Array, options?: LASOptions): Promise<LASPoints>;
|
|
180
|
+
/** Decodes uncompressed point records (what a LAZ decoder returns, or the file after the point data offset). */
|
|
181
|
+
export declare function decodePoints(header: LASHeader, records: readonly LASRecord[], data: Uint8Array, options?: LASOptions): LASPoints;
|
|
182
|
+
/** Fetches and parses a LAS file. Aborts with `options.signal`. */
|
|
183
|
+
export declare function loadLAS(url: string | URL, options?: LASOptions & {
|
|
184
|
+
fetch?: typeof fetch;
|
|
185
|
+
}): Promise<LASPoints>;
|
|
186
|
+
/** Input of `writeLAS`: world positions (float64) and any attributes of the chosen format. */
|
|
187
|
+
export interface LASWriteInput {
|
|
188
|
+
/** xyz per point, world units. */
|
|
189
|
+
positions: ArrayLike<number>;
|
|
190
|
+
/** Point data record format 0 to 10. Default: 6, or 7 with rgb. */
|
|
191
|
+
pointFormat?: number;
|
|
192
|
+
/** LAS minor version, 0 to 5. Default 4 (formats 6 to 10 need 4 or 5); 2 or 3 for formats 0 to 5, which LAS 1.5 removed. */
|
|
193
|
+
versionMinor?: number;
|
|
194
|
+
/** Coordinate resolution. Default [0.001, 0.001, 0.001]. */
|
|
195
|
+
scale?: readonly [number, number, number];
|
|
196
|
+
intensity?: ArrayLike<number>;
|
|
197
|
+
classification?: ArrayLike<number>;
|
|
198
|
+
returnNumber?: ArrayLike<number>;
|
|
199
|
+
numberOfReturns?: ArrayLike<number>;
|
|
200
|
+
gpsTime?: ArrayLike<number>;
|
|
201
|
+
/** 16-bit RGB per point. */
|
|
202
|
+
rgb?: ArrayLike<number>;
|
|
203
|
+
nir?: ArrayLike<number>;
|
|
204
|
+
pointSourceId?: ArrayLike<number>;
|
|
205
|
+
/** Scalar extra bytes attributes stored as float64 (data type 10), by name. */
|
|
206
|
+
extra?: Record<string, ArrayLike<number>>;
|
|
207
|
+
/** OGC WKT of the CRS (record 2112; sets the WKT global encoding bit for LAS 1.4). */
|
|
208
|
+
wkt?: string;
|
|
209
|
+
/** EPSG code stored as GeoTIFF keys (34735). Formats 0 to 5 before LAS 1.5 only: formats 6 to 10 need `wkt`. */
|
|
210
|
+
epsg?: number;
|
|
211
|
+
}
|
|
212
|
+
/** Writes uncompressed LAS. Meant for tools and round-trip tests. */
|
|
213
|
+
export declare function writeLAS(input: LASWriteInput): Uint8Array;
|