wasm-spatial-core
    Preparing search index...

    Class PointCloudStreamer

    Streaming point cloud loader.

    Parse a LAS header first, then read points or regions on demand without loading the entire file into memory.

    Example (JS)

    const streamer = new PointCloudStreamer();
    const header = streamer.parseHeader(headerBytes);
    console.log(`File has ${header.numPoints()} points`);
    
    // Read points 100..200:
    const region = streamer.readRegion(fullBytes, headerBytes, 100, 100);
    
    Index
    • Parse a LAS header from the first 230+ bytes of a file.

      Stores metadata internally for subsequent totalPoints() and readRegion() calls. Returns the same LasHeaderInfo that parseLasHeaderOnly would produce.

      Arguments

      • bytes — At least 230 bytes from the start of a LAS file.

      Parameters

      • bytes: Uint8Array

      Returns LasHeaderInfo

    • Parse all points from a complete LAS byte buffer.

      This is a convenience method that combines header parsing with full point extraction. For large files, prefer readRegion().

      Arguments

      • bytes — Full LAS file bytes (header + point data).
      • header_bytes — First 230+ bytes (header portion).

      Parameters

      • bytes: Uint8Array
      • header_bytes: Uint8Array

      Returns LasPointCloud

    • Read a specific region of points from a LAS file.

      For uncompressed LAS, computes exact byte offsets: offset = point_data_offset + point_index * point_record_length

      Arguments

      • bytes — LAS file bytes (header + at least the requested points).
      • header_bytes — First 230+ bytes (header portion), used to initialize the streamer if not already done.
      • start_index — First point index to read (0-based).
      • count — Number of points to read.

      Parameters

      • bytes: Uint8Array
      • header_bytes: Uint8Array
      • start_index: number
      • count: number

      Returns LasPointCloud

    • Return the total number of points from the last parsed header.

      Returns 0 if no header has been parsed yet.

      Returns number