@math.gl/geospatial/projection
@math.gl/geospatial/projection converts coordinates between geographic, projected and
geocentric coordinate reference systems. Use it for map coordinates, in-place
coordinate buffers, explicit datum transformations and coordinate propagation
between epochs.
For backend-independent interfaces, see @math.gl/geospatial/projection-types.
Numerical accuracy is evaluated against native PROJ. The pinned proj4js reference serves compatibility tests and benchmarks. The independent references qualify specific configurations and coordinate domains; they do not establish complete modern PROJ equivalence. See independent validation and the modern PROJ audit for coverage and remaining gaps.
For definitions of surface models, paths, reference systems, and distortion properties, see Geospatial terminology.
Relationship to mapsโ
Use this subpath when coordinates must be expressed in a different CRS. Use
@math.gl/geospatial/maps when a renderer needs chart
coverage, interruptions, insets, picking or unfolding. Map layouts consume
spherical longitude/latitude in degrees; they do not resolve source CRSs or
perform datum/epoch operations.
The subpaths are independent. Convert source data with projection APIs before
feeding it to a map when necessary. For a textured ordinary projection,
prepareProjectionSurface from
/maps/surfaces samples a projection over an explicit geographic rectangle.
Its placement in maps reflects its rendering responsibility, even when its
coordinate transform comes from projection.
See choosing and combining the APIs for a decision table and the complete data-to-renderer workflow.
Usageโ
import { projectionEngine } from "@math.gl/geospatial/projection";
const projection = projectionEngine.createProjection({
from: "EPSG:4326",
to: "EPSG:3857",
});
const meters = projection.project([12, 55]);
const longitudeLatitude = projection.unproject(meters);
const positions = new Float64Array([12, 55, 13, 56]);
projection.projectFlat(positions, 2); // transforms the same buffer
Featuresโ
| Feature | Support | Notes |
|---|---|---|
| Geographic, projected and geocentric transforms | โ | Projection engines and the algorithm catalogue support the documented definitions and parameters. |
| Bulk buffers and reusable output storage | โ | ProjectionBuffer supports strided/interleaved/column layouts and explicit ownership contracts. |
| Explicit unit, axis and datum pipelines | โ | ProjectionPipeline composes supported stages in a declared order. |
| Horizontal and vertical grid operations | โ | Prepared datum/height grids, including supported NTv2 and decoded GeoTIFF inputs; data loading stays explicit. |
| Coordinate epochs and deformation models | โ | Temporal models and deformation operations have model/coverage-specific contracts. |
| Reviewed operation selection | โ | OperationCatalog selects application-supplied operations by area, epoch, accuracy and grid metadata. |
| Lazy/selective loading and worker execution | โ | Entry-point choices and persistent worker recipes separate startup, transfer and warm execution costs. |
| Complete modern PROJ numerical/parameter parity | โ | The independent validation and modern PROJ audit report tested domains and retained findings. |
| Unrestricted EPSG operation discovery | โ | No bundled complete authority/operation database or automatic remote-grid search; the application reviews catalogue entries. |
| Arbitrary PROJ pipeline/compound-CRS execution | โ | Supported typed stages and reader profiles are implemented; unrestricted pipeline/compound semantics remain bounded roadmap work. |
| Built-in WASM/SIMD/GPU algorithm backends | โ | Worker acceleration and external-engine adapters exist; native accelerated math.gl kernels are not delivered by the acceleration probes. |
Tectonic time machineโ
Loading Tectonic time machineโฆ
Play continental motion from 1.8 billion years ago to 300 Ma into the future, and change projections while playback continues. Past positions use published GPlates rotations; future assembly is illustrative, not a forecast. Terrain shows modern NASA imagery carried with the blocks, not reconstructed ancient landscapes. Choose a data source to visit Nuna (Columbia), Rodinia and Pangaea.
Open the full example for data credits and limits.
See external projection engines for proj4js and D3 adapter examples.
Learn about projectionsโ
Start with coordinate systems, ellipsoids, datums and epochs for the concepts behind a transformation. The projection catalogue explains the built-in algorithms, their distortion tradeoffs and their sphere or ellipsoid support. It includes examples for regional, global and polar maps.
| Guide | What you will learn |
|---|---|
| Imports, plugins and loading | Choose entry points, register algorithms, load on demand and compare bundle sizes |
| Coordinate systems | Distinguish projection, ellipsoid, datum, height and coordinate epoch |
| Projection catalogue | Choose an algorithm and understand its useful domain |
| Reusable coordinate buffers | Transform separate, strided and column buffers with reusable scratch and explicit ownership |
| Operation pipelines | Order units, axes, projections, datum shifts and time-dependent operations explicitly |
| Operation selection | Select application-reviewed operations by area, epoch, accuracy and prepared grids |
| Temporal models | Combine velocities, acceleration, events and relaxation with explicit epochs |
| Optional acceleration | Evaluate persistent workers, ownership and complete application costs |
| Deformation models | Propagate coordinates between epochs with prepared velocity grids |
| Supported definitions | Understand accepted definitions and differences from proj4js |
| Performance and live benchmarks | Compare math.gl flat and scalar transforms with proj4js in your browser |
| Projection scorecard | Inspect source-matched accuracy, throughput, startup, allocation, memory and bundle evidence |
| Independent validation | Inspect numerical references and qualification limits |
Choose an APIโ
The CRS and projection API guide explains how source metadata, CRS descriptors, transforms, algorithm plugins and projection analysis fit together, and when to use each.
| API | Use it when |
|---|---|
FullProjectionEngine | You want all built-in algorithms and WKT/PROJJSON readers |
ConfigurableProjectionEngine | You want an explicit list of plugins, readers and grids for a smaller bundle |
LazyProjectionEngine (/projections/lazy) | You want built-in algorithms to load automatically when requested |
WebMercatorProjectionEngine (/web-mercator) | You need only WGS84 and EPSG:3857 with a minimal bundle |
ProjectionPipeline (/pipeline) | You need explicit operation order or coordinate epochs |
OperationCatalog (/operations) | You need to select among application-reviewed transformations |
createCRSDescriptor (@math.gl/geospatial/crs) | You have external converters and explicit CRS metadata/rendering policy |
The @math.gl/geospatial/projection entry point exports the full and configurable engines and the default projectionEngine.
Projection and ProjectionEngine are type contracts, available from
@math.gl/geospatial/projection-types. Import
@math.gl/geospatial/projection-core for the engine without the catalogue.
The kernel index lists individual algorithms and lazy descriptors.
Readers, grids, pipelines, operation selection and deformation models have optional subpaths. See the
entry-point reference.
@math.gl/geospatial/crs provides CRS definitions, syntax readers and spatial
reference metadata. This module executes supported coordinate operations. Reading
a CRS definition successfully does not establish that its coordinates can be
transformed: use checkProjectionCompatibility with the same plugins and readers
as construction, then verify your coordinate domain and grid coverage.
Named coordinate systemsโ
These definitions are built in. Selective engines still require the corresponding projection algorithm; an alias does not load it.
| Coordinate system | Aliases | Algorithm |
|---|---|---|
| WGS84 longitude/latitude | EPSG:4326, WGS84, OGC:CRS84, CRS:84 | Core geographic coordinates |
| NAD83 longitude/latitude | EPSG:4269 | Core geographic coordinates |
| WGS84 longitude/latitude/ellipsoidal height | EPSG:4979, OGC:CRS84h | Core geographic coordinates |
| WGS84 geocentric | EPSG:4978 | geocentric |
| Web Mercator | EPSG:3857, EPSG:3785, GOOGLE, EPSG:900913, EPSG:102113 | mercator |
| WGS84 UTM north | EPSG:32601 through EPSG:32660 | universalTransverseMercator |
| WGS84 UTM south | EPSG:32701 through EPSG:32760 | universalTransverseMercator |
| WGS84 UPS north/south | EPSG:5041, EPSG:5042 | stereographic |
The engine also accepts the OGC URN and URI forms of these identifiers, such as
urn:ogc:def:crs:EPSG::32631 and http://www.opengis.net/def/crs/OGC/1.3/CRS84. It
normalizes them with normalizeCRSIdentifier()
before the alias lookup. An application alias for the written spelling takes precedence. A
versioned EPSG URN or URI, such as urn:ogc:def:crs:EPSG:9.9:3857, uses the built-in
definition of its code. The engine uses longitude/latitude order for EPSG:4326 and for
OGC:CRS84 unless you set enforceAxis. To get the authority axis order of a CRS, use
getCRSAuthorityAxisOrder().
There is no automatic EPSG database lookup or network access. Supply other named definitions through aliases or pass an explicit PROJ string, WKT or supported PROJJSON object. A CRS identifier describes much more than a projection algorithm; check its datum, units, axes and area of use.
Attributionโ
The math.gl projection engine is derived from proj4js, with an independently designed modular runtime and additional coordinate operations. Many numerical kernels, shared mathematical helpers and datum equations are direct ports or adaptations of proj4js. Selected algorithms and numerical corrections also draw on PROJ. These contributions are an important part of the implementation; the engine is not a clean-room rewrite.
The plugin architecture, execution and loading system, bulk coordinate APIs and
much of the newer pipeline and epoch functionality are original math.gl work.
Source headers distinguish direct ports, adaptations and implementations inspired
by upstream work. Distributed license files and
third-party notices
retain the applicable upstream credits and terms. Engine source headers use
SPDX-License-Identifier for licenses, SPDX-FileCopyrightText for copyright
holders and SPDX-FileComment for provenance and modifications. Equal Earth
retains its Apache-2.0 license and original authorship. Removing the proj4js runtime
dependency does not remove attribution for derived code. The shared spheroid
arithmetic in @math.gl/core retains the existing proj4js MIT attribution
and full notice in the core package. Geospatial's retained three-radius/interior
kernels preserve their CesiumJS/Apache-2.0 provenance.
The implementation has diverged through selective imports, deferred algorithms, in-place buffers and additional explicit operations. Performance advantages depend on the workload; numerical improvements and supported features are qualified individually. This is not a claim of unrestricted proj4js or PROJ parity. See the parity audit, independent validation and support profile for the measured scope and current limits.
See Attributions for the project-wide source inventory and acknowledgments.