UNPKG

gis-tools-ts

Version:

A collection of geospatial tools primarily designed for WGS84, Web Mercator, and S2.

145 lines 5.75 kB
import { LAZHeaderItemType } from './types.js'; import { Transformer } from '../../index.js'; import type { FeatureIterator, GeoKeyDirectory, GridReader, ProjectionTransformDefinition, Properties, Reader, ReaderInputs, VectorFeature, VectorPointM } from '../../index.js'; import type { LASExtendedVariableLengthRecord, LASFormat, LASHeader, LASVariableLengthRecord, LAZHeader } from './types.js'; export * from './getPoint.js'; export * from './types.js'; /** * # LAS Reader * * ## Description * Reads LAS data. Supports up to the LAS 1.4 specification. * [See specification](https://www.asprs.org/wp-content/uploads/2010/12/LAS_1_4_r13.pdf) * Implements the {@link FeatureIterator} interface * * Data is stored like so: *``` * | PUBLIC HEADER BLOCK | * | VARIABLE LENGTH RECORDS | * | POINT DATA RECORDS | * ``` * * ## Usage * ```ts * import { LASReader } from 'gis-tools-ts'; * import { FileReader } from 'gis-tools-ts/file'; * // or use the MMapReader if using Bun: * // import { MMapReader } from 'gis-tools-ts/mmap'; * * const reader = new LASReader(new FileReader('./data.las')); * * // read the features * for (const feature of reader) { * console.log(feature); * } * ``` * * ## Links * - https://www.usgs.gov/ngp-standards-and-specifications/lidar-base-specification-online * - https://www.asprs.org/wp-content/uploads/2010/12/LAS_1_4_r13.pdf * - https://liblas.org/development/index.html * - https://downloads.rapidlasso.de/doc/LAZ_Specification_1.4_R1.pdf * - https://github.com/PDAL/PDAL * - https://github.com/libLAS/libLAS (deprecated for PDAL) * - https://github.com/LASzip */ export declare class LASReader implements FeatureIterator<undefined, LASFormat, Properties> { #private; readonly dontTransform: boolean; readonly reader: Reader; readonly header: LASHeader; readonly variableLengthRecords: Record<number, LASVariableLengthRecord | LASExtendedVariableLengthRecord>; readonly wkt?: string; readonly GeoKeyDirectory?: GeoKeyDirectory; readonly transformer: Transformer; /** * @param input - The LAS input data from a reader/buffer * @param definitions - an array of projection definitions for the transformer if needed * @param epsgCodes - a record of EPSG codes to use for the transformer if needed * @param gridStores - an array of grid readers if needed * @param dontTransform - if you set to true, the source projection is kept */ constructor(input: ReaderInputs, definitions?: ProjectionTransformDefinition[], epsgCodes?: Record<string, string>, gridStores?: GridReader[], dontTransform?: boolean); /** * Get the number of points stored * @returns - the number of points */ get length(): number; /** * Reads a point in at index * @param index - The index of the point to read * @returns - The parsed point */ getPoint(index: number): VectorPointM<LASFormat>; /** * Generator to iterate over each WGS84 lon-lat point * @yields {VectorFeature} */ [Symbol.asyncIterator](): AsyncGenerator<VectorFeature<undefined, LASFormat, Properties>>; } /** A step of decompression from the reader */ export interface LAZPointData { type: LAZHeaderItemType; rawData: DataView; } /** * # LASzip Reader * * ## Description * Reads LAS zipped data. Supports LAS 1.4 specification although missing some support. * [See specification](https://downloads.rapidlasso.de/doc/LAZ_Specification_1.4_R1.pdf) * Implements the {@link FeatureIterator} interface * * Data is stored like so: *``` * | PUBLIC HEADER BLOCK | * | VARIABLE LENGTH RECORDS | * | POINT DATA RECORDS | * | Extended Variable Length Records (EVLRs) | * | Field Chunk table start position (EOF) | * ``` * * ## Usage * ```ts * import { LASZipReader } from 'gis-tools-ts'; * import { FileReader } from 'gis-tools-ts/file'; * // or use the MMapReader if using Bun: * // import { MMapReader } from 'gis-tools-ts/mmap'; * * const reader = new LASZipReader(new FileReader('./data.laz')); * * // read the features * for (const feature of reader) { * console.log(feature); * } * ``` * * ## Links * - https://www.usgs.gov/ngp-standards-and-specifications/lidar-base-specification-online * - https://www.asprs.org/wp-content/uploads/2010/12/LAS_1_4_r13.pdf * - https://liblas.org/development/index.html * - https://downloads.rapidlasso.de/doc/LAZ_Specification_1.4_R1.pdf * - https://github.com/PDAL/PDAL * - https://github.com/libLAS/libLAS (deprecated for PDAL) * - https://github.com/LASzip */ export declare class LASZipReader extends LASReader implements FeatureIterator<undefined, LASFormat, Properties> { #private; readonly lazHeader: LAZHeader; decompressSelective: number; layeredLas14Compression: boolean; /** * @param input - The LAZ input data from a reader/buffer * @param definitions - an array of projection definitions for the transformer if needed * @param epsgCodes - a record of EPSG codes to use for the transformer if needed * @param gridStores - an array of grid readers if needed * @param dontTransform - if you set to true, the source projection is kept */ constructor(input: ReaderInputs, definitions?: ProjectionTransformDefinition[], epsgCodes?: Record<string, string>, gridStores?: GridReader[], dontTransform?: boolean); /** * Generator to iterate over each WGS84 lon-lat point * @yields {VectorFeature} */ [Symbol.asyncIterator](): AsyncGenerator<VectorFeature<undefined, LASFormat, Properties>>; } //# sourceMappingURL=index.d.ts.map