wasm-spatial-core
    Preparing search index...

    Function parseLasHeaderOnly

    • Parse only the LAS header (first 227+ bytes) for range-based access.

      Returns a LasHeaderInfo with metadata needed to compute point offsets. This is the core COPC concept: read the header once, then fetch individual points on demand using Range headers.

      Arguments

      • bytes - At least 230 bytes from the beginning of a LAS file.

      Example

      // In the browser:
      const response = await fetch("data.las", { headers: { Range: "bytes=0-229" } });
      const headerBytes = new Uint8Array(await response.arrayBuffer());
      const info = parseLasHeaderOnly(headerBytes);
      console.log(`File has ${info.numPoints()} points`);
      
      // Fetch point 42:
      const offset = computeLasPointOffset(info, 42, info.pointFormatId());
      const pointResponse = await fetch("data.las", {
          headers: { Range: `bytes=${offset}-${offset + info.pointRecordLength() - 1}` }
      });
      const pointBytes = new Uint8Array(await pointResponse.arrayBuffer());
      const point = parseLasPointAt(pointBytes, 0, info.pointFormatId());
      

      Parameters

      • bytes: Uint8Array

      Returns LasHeaderInfo