@math.gl/core/arrow
@math.gl/core/arrow includes columnar geospatial math over runtime-neutral descriptors. Importing this combined entry point requires the application-provided Apache Arrow peer; the descriptor kernels operate directly on buffers.
It defines a small immutable descriptor ABI over borrowed typed arrays and implements synchronous
geometry kernels directly over that ABI.
For real Arrow Table/Vector inputs, use the GeoArrow adapters from the same entry point. Descriptor kernels accept physical column descriptors; vector wrappers use explicitly named vector APIs.
Usageโ
import {GeoArrowBuilder, inspectGeoArrowColumn, getGeoArrowBounds} from '@math.gl/core/arrow';
const points = GeoArrowBuilder.build(
[
{type: 'Point', coordinates: [-122.4, 37.8]},
null,
{type: 'Point', coordinates: [-73.9, 40.7]}
],
{encoding: 'geoarrow.point', dimension: 'xy'}
);
inspectGeoArrowColumn(points);
// {rowCount: 3, nullCount: 1, coordinateCount: 2, valid: true, ...}
getGeoArrowBounds(points);
// [-122.4, 37.8, -73.9, 40.7]
Featuresโ
| Feature | Support | Notes |
|---|---|---|
| Native and mixed geometry layouts | โ | Physical layouts cover homogeneous geometries, dense unions and collections with explicit XY/XYZ/XYM/XYZM semantics. |
| Null, empty, sliced and chunked arrays | โ | Logical offsets, validity bitmaps and safe Int64 offsets preserve ownership and null/empty distinctions. |
| Validation, traversal and bounds | โ | Inspection and kernels operate on column descriptors without requiring per-row geometry materialization. |
| Builders and physical-layout conversion | โ | Two-pass builders, interleave/separate conversion, union normalization and rewinding have explicit allocation/identity rules. |
| Coordinate mapping and reusable destinations | โ | Coordinate transforms can write caller-owned targets with validated layouts. |
| WKB/WKT column codecs | โ | Serialized columns retain offsets, validity, chunks and metadata through the documented codecs. |
| Polygon tessellation and transfer preparation | โ | Flat positions/indices include row attribution; explicit resource limits and transfer helpers bound supported operations. |
| XY geometry streaming and streamed tessellation | โ | Geometry streams accept external geometry engines and retain source-row attribution, with a task-worker recipe. Z/M and serialized input are outside this stream profile. |
| Direct Arrow Table/RecordBatch integration | โ | The descriptor ABI is runtime-neutral. Use the optional Arrow-backed adapter for real Arrow fields and vectors. |
| Complete GIS topology/overlay engine | โ | No general GEOS-style union, overlay, topology-repair or spatial-database engine is provided by these column kernels. |
| GPU-resident column execution | โ | The kernels are synchronous CPU operations; GPU upload/compute and device memory ownership belong to consumers. |
Design goalsโ
- Columnar first: inspection, counting, and bounds do not create per-row geometry objects.
- Runtime neutral: loaders and dataframe libraries adapt buffers at the package boundary.
- Zero-copy when possible: slices and identity conversions retain descriptor and buffer identity.
- Complete geometry semantics: XY, XYZ, XYM, and XYZM remain distinct; native, mixed, serialized, null, empty, sliced, and chunked columns share one contract.
- Renderer ready: polygon tessellation returns flat positions, row attribution, and indices without importing a graphics runtime.
- Safe by default: stable validation diagnostics and opt-in work/output limits guard untrusted inputs.
Installationโ
npm install @math.gl/core apache-arrow
Where to go nextโ
- Physical layouts explains every descriptor, nesting, offset, slice, validity, union, and ownership rule.
- API reference groups the public functions by task and documents allocation and identity behavior.
- Migration guide maps the loaders.gl and luma.gl prototypes onto the runtime-neutral API.
The package README also contains complete examples for two-pass building, codecs, tessellation, resource limits, worker transfers, and runtime adapters.
See Geometry streams and task workers for external-engine clipping, polygon tessellation and source-row attribution without materializing GeoJSON.