Skip to main content

Data conversion

Move between data shapes

Compose small, explicit converters when the next stage needs a different table, geometry, or rendering representation.

Explicit conversion paths

Connect formats through data shapes.

Read a format, work with a documented table or geometry shape, then write the result where it needs to go. Each edge is an explicit converter that can be composed with the next one.

Keep conversion logic at the boundary so the rest of the application can stay format-agnostic.

The conversion path

Make the next shape an explicit decision.

Converters connect related data representations without making every loader understand every other format. Applications choose the edges they need and keep the rest out of the bundle.

Detect

Identify the source and target data shapes

Compose

Pass the leaf converters that define an allowed path

Preserve

Keep metadata and binary columns where the target supports them

Render

Use dedicated geometry converters when GeoJSON is not required

The loaders.gl converter system is a graph of small, explicit converter objects. You pass the converters you want, convert() finds a path, and each leaf module handles one direct step.

import {convert, TableConverter} from '@loaders.gl/core/schema-utils';
import {ArrowConverter} from '@loaders.gl/tables/arrow';
import {
FeatureCollectionConverter,
GeometryConverter
} from '@loaders.gl/core/geoarrow';

const arrowTable = convert(table, 'arrow', [TableConverter, ArrowConverter]);
const wkb = convert(geometry, 'wkb', [GeometryConverter]);
const binary = convert(features, 'binary-feature-collection', [FeatureCollectionConverter]);

Converter flow

Detailed guide

Converter families and shape paths

The sections below document the dispatcher, table and Arrow conversions, GeoArrow and feature collections, render-focused utilities, and format categories.

In This Section​

TopicUse it for
Converter dispatcherHow convert() detects shapes and chooses a path
Table and Arrow convertersMoving between loaders.gl table wrappers and Apache Arrow
GeoArrow convertersConverting GeoArrow tables and rewriting GeoArrow geometry encodings
Feature collection convertersGeoJSON, Flat GeoJSON, binary feature collections, and geometry wire formats
Render convertersDirect geometry-column to BinaryFeatureCollection and Arrow-backed binary wrappers
Format categoriesThe shapes and format families these converters connect

Core Ideas​

  • Converters are opt-in. There is no global registry.
  • Each leaf converter handles direct edges only.
  • convert() can compose multiple direct steps when you pass enough converters.
  • Geometry rendering does not have to route through GeoJSON.

Current Converter Families​

ConverterPackageDirect responsibility
TableConverter@loaders.gl/core/schema-utilsloaders.gl table wrappers
ArrowConverter@loaders.gl/tables/arrowNative Arrow and row, columnar, or GeoJSON tables
GeoArrowTableConverter@loaders.gl/core/geoarrowNative GeoArrow and row, columnar, or GeoJSON tables
GeoArrowGeometryConverter@loaders.gl/core/geoarrowGeoArrow geometry encoding rewrites
FeatureCollectionConverter@loaders.gl/core/geoarrowGeoJSON, Flat GeoJSON, binary feature collections
GeometryConverter@loaders.gl/core/geoarrowsingle geometry values like WKB, WKT, TWKB, GeoJSON geometry

Render-Focused Conversions​

Some conversions are not expressed as generic converter objects because they are rendering utilities rather than shape-dispatch nodes.

These include:

  • convertGeometryColumnToBinaryFeatureCollection()
  • convertGeometryValuesToBinaryFeatureCollection()
  • convertBinaryFeatureCollectionToArrowBinaryFeatureCollection()
  • convertArrowBinaryFeatureCollectionToBinaryFeatureCollection()

These utilities are documented in Render converters.

Why This Matters​

The converter system gives you a few practical wins:

  • small bundles through explicit imports
  • predictable conversion paths
  • reusable format-specific code in leaf modules
  • a clean separation between table conversion, geometry conversion, and render conversion

The rest of this section goes converter by converter and shape by shape.