Skip to main content

Composable APIs

Design apps around your data, not data formats.

Loader categories normalize related formats into shared structures, so your application code can stay focused on the data.

meshtableGISscenegraph

Category data

Change the input format without changing the app.

A loader category defines a compatible result shape. Your application can register another loader in the same category without growing another rendering, analysis, or export path.

Common result

A documented shape shared by related loaders

Typical groups

Tables, GIS, images, textures, meshes, and scenes

Writers follow

Writers accept the category shape as input

Format-specific data

Use loaderData when the common shape is not enough

Start here​

Choose a loader category when your application should accept several formats without separate code paths for each one. The category defines the common result shape, while each loader handles its own file format.

To simplify working with related formats, loaders and writers in loaders.gl are grouped into categories. A category defines the data shape that an application can rely on after loading, so one rendering, analysis, or export path can accept several input formats.

Each loader still preserves format-specific details in loaderData when they do not fit the common shape. Category data is therefore a stable application boundary, not a promise that every format has identical capabilities.

Detailed guide

The category contract

The detailed sections explain registration, returned data formats, writers, and the escape hatch for format-specific fields.

Categories and Loader Registration​

The fact that loaders belong to categories enables applications to register additional loaders in the same category.

For instance, an application can register several point-cloud loaders during startup and let the shared loader selector choose between them:

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

registerLoaders([LASLoader, PCDLoader]);

async function loadPointCloud(url: string) {
const pointCloud = await load(url);
// Use some WebGL framework to render the parsed cloud
}

Data format​

Each category documents the returned data format. Loaders and writers reference the category documentation.

Writers and categories​

Writers for a format that belongs to a category accept data objects with fields described by the documentation for that category.

Accessing format-specific data​

Sometimes, not all the properties provided by a certain file format can be mapped to common properties defined by the corresponding loader category.

To access format-specific properties, use the loaderData field in data object returned by the loader.

Available Categories​

Categories are described in the specifications section. Some currently defined categories are: