Skip to main content

PCD module · loader API

PCDLoader

Decode ASCII, binary, and compressed Point Cloud Data into a point-cloud object or a Mesh Arrow table with named attributes.

What it returns

Keep point positions and named attributes together.

PCDLoader reads the schema in the PCD header, then decodes the point records into the representation that best fits the next stage of the pipeline.

Input

ASCII, binary, or compressed PCD

Default

Legacy PointCloud mesh object

Arrow

Mesh Arrow table with columns

Streaming

Batches for ASCII and uncompressed binary

Detailed guide

PCDLoader reference

The sections below document format metadata, usage, batch parsing, output shapes, and options.

PCDLoader parses point cloud data in the Point Cloud Data (PCD) format and returns a Mesh Arrow table by default.

Set pcd.shape: 'mesh' when a legacy PointCloud object is required.

ShapeOutputUse when
arrowMesh Arrow tableYou want columnar point cloud attributes.
meshPointCloudYou need the legacy point cloud object.

Note: Currently supports ascii, binary and compressed binary files.

Usage​

import {PCDLoader} from '@loaders.gl/pointclouds/pcd';
import {load} from '@loaders.gl/core';

const data = await load(url, PCDLoader, options);
const table = await load(url, PCDLoader, {pcd: {shape: 'arrow'}});

Batched Parsing​

PCDLoader supports loadInBatches and parseInBatches for ASCII and uncompressed binary PCD data. When pcd.shape: 'arrow' is set, the loader yields native Apache Arrow RecordBatch objects. Compressed binary PCD files fall back to a single parsed batch.

import {loadInBatches} from '@loaders.gl/core';
import {PCDLoader} from '@loaders.gl/pointclouds/pcd';

const batches = await loadInBatches(url, PCDLoader, {
batchSize: 100_000,
pcd: {shape: 'arrow'}
});

for await (const batch of batches) {
console.log(batch.length, batch.data);
}

Options​

OptionTypeDefaultDescription
pcd.shape'mesh' | 'arrow''arrow'Selects PointCloud or Mesh Arrow table output.

Worker batches​

PCDLoader supports parseInBatches() on its built-in browser worker. The worker stays leased for the input iterator and transfers owned Arrow column buffers. The caller hydrates Mesh Arrow tables and performs any requested legacy shape: 'mesh' conversion. Schemas and small loader/batch descriptors accompany the binary buffers; decoded row objects are not sent from the worker. JSON conversion, if needed by an application, happens on the caller.

const batches = await parseInBatches(input, PCDLoader, {
core: {worker: true, batchSize: 1000},
pcd: {shape: 'arrow'}
});
for await (const batch of batches) {
consume(batch.data);
}

PCD currently collects the complete input before decoding. ASCII and uncompressed binary output is split by core.batchSize; compressed input may produce a single batch.

Cancellation uses the shared signal option. Aborting or ending iteration releases the worker; transferred input buffers remain detached. Self-hosted workers must implement the batch protocol and opt in with core.workerInBatches: true. Custom workers must use the current Arrow column wire format. This module ships a browser worker; Node workers require a compatible Node artifact. The parser-bearing loader is available from @loaders.gl/pointclouds/pcd.