Skip to content

feat(core): layer coordinateSystem supports arbitrary CRS - #10874

Merged
Pessimistress merged 7 commits into
masterfrom
codex/source-crs-resolution
Oct 21, 2026
Merged

Pessimistress merged 7 commits into
masterfrom
codex/source-crs-resolution

Conversation

@Pessimistress

@Pessimistress Pessimistress commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

For #10739

Background

Major conceptual clean up of projection pipeline. Now explicitly separates:

  • Layer's data coordinate system
  • Layer's packed positions attribute coordinate system
  • View's target CRS coordinate system
  • Shaderlib's common space

For example, MVTLayer in v9.4 creates sublayers with coordinateSystem: 'cartesian' in MapView and coordinateSystem: 'lnglat' in GlobeView. After this PR, it creates sublayers with coordinateSystem: 'OSMTile512' in all viewports.

Antarctica, coordinateSystem: 'EPSG:3031' (Stereographic) + GlobeView
custom-projection-antarctica-globe

France regions, coordinateSystem: 'EPSG:2154' (Lambert-93) + MapView
custom-projection-france-map

Switzerland cantons, coordinateSystem: 'EPSG:2056' (LV95) + CustomProjectionView toCrs: 'EPSG:8857' (Equal Earth)
custom-projection-switzerland-equal-earth

Change List

  • Accept arbitrary CRS strings in Layer.coordinateSystem
  • Resolve source CRS before initializing or updating layers
  • Track per-layer preprojection and packed-coordinate CRS
  • Keep shader-supported coordinates untransformed during attribute packing
  • Load MVT geometry consistently in OSMTile512
  • Derive subdivision steps from source CRS units and viewport resolution
  • Tessellate polygons in the viewport’s target CRS
  • Unit tests, render tests, docs, and upgrade guide

Note

High Risk
Breaking v10 changes across projection, layer initialization, multi-view filtering, and exported constants, with broad impact on aggregation, picking, and tiled layers.

Overview
Layers can declare data CRS with strings (EPSG/PROJ, legacy aliases like 'meter-offsets') instead of the removed COORDINATE_SYSTEM export. The layer manager resolves CRS asynchronously, blocks init/update until ready, and tracks source vs packed attribute CRS plus CPU preproject / unpreproject when the view shader cannot consume the source CRS directly. coordinateOrigin applies in source CRS before conversion for absolute CRSs.

Projection pipeline refactor: viewport getPreprojection(sourceCrs) replaces ad-hoc preproject flags; shader uniform coordinateSystem → coordinateFrame (identity/geodetic/projected/geocentric). Multi-view: first viewport allowed by layerFilter (screen pass) seeds a layer’s projection context; draw activates viewport once per layer. resolution subdivision is earth-circumference–based (opt-in, including Globe); layers use getSubdivisionStep(sourceCrs).

Aggregation, tiles, picking: aggregation/custom-projection paths use project.isCustomProjection and layer preprojection state; hexagon pick adds position in source CRS (nullable); PickingInfo.coordinate may be null. MVT documents/uses tile-local OSMTile512; v10 examples switch to string coordinate systems.

Docs/upgrade guide cover v10 viewport CRS, Globe position, and migration from constants.

Reviewed by Cursor Bugbot for commit 248a5e0. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread modules/core/src/lib/layer.ts
Comment thread modules/core/src/viewports/viewport.ts
Comment thread modules/geo-layers/src/mvt-layer/mvt-layer.ts
@greptile-apps

greptile-apps Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 3/5

[High impact] The changes reach deck.gl’s shared projection path across views and layer types.

Fix the stale polygon transforms and the outstanding binary globe tile winding issue before merging.

Findings

  1. P1 Polygon transforms stop working ▶

Summary

Layers can declare arbitrary source CRSs, with CPU conversion when the view cannot use those coordinates directly.

  • Layers can use a source coordinate system that differs from the viewport.
  • Viewport resolution controls geometry detail across coordinate systems.
  • MVT sublayers use tile-local coordinates in every viewport.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Source coordinates] --> B[Apply layer transforms]
  B --> C{View accepts source CRS?}
  C -->|Yes| D[Keep native attributes]
  C -->|No| E[Convert positions on CPU]
  D --> F[Triangulate with transformed coordinates]
  E --> F
  F --> G[Draw polygon]
Loading

Reviews (8) · Last reviewed commit: "Invalidate triangulation when modelMatri..." · Reviewed by Greptile

Comment thread modules/geo-layers/src/mvt-layer/mvt-layer.ts Outdated
Comment thread modules/core/src/lib/layer.ts
Comment thread modules/core/src/lib/layer.ts Outdated
Comment thread modules/core/src/lib/layer.ts
@coveralls

coveralls commented Oct 15, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 84.132% (+0.4%) from 83.717% — codex/source-crs-resolution into master

@kylebarron

Copy link
Copy Markdown
Collaborator
  • Accept arbitrary CRS strings in Layer.coordinateSystem

The typedef of CRS definition should at least include objects to support PROJJSON, a more modern description of CRS than the relatively fickle and outdated proj strings

@Pessimistress
Pessimistress force-pushed the codex/source-crs-resolution branch from df1769d to bbbcc9c Compare October 15, 2026 21:35
Comment thread modules/core/src/index.ts
Comment thread modules/layers/src/solid-polygon-layer/solid-polygon-layer.ts

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread modules/core/src/lib/layer.ts Outdated
Comment thread modules/extensions/src/clip/clip-extension.ts
Base automatically changed from codex/crs-descriptor-integration to codex/async-view-resolution October 20, 2026 00:29
@Pessimistress
Pessimistress force-pushed the codex/source-crs-resolution branch from b0c50dc to d747d88 Compare October 20, 2026 00:49
Comment thread modules/core/src/lib/layer-manager.ts Outdated
Comment thread modules/core/src/shaderlib/project/coordinate-systems.ts

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread modules/core/src/utils/crs.ts
@Pessimistress
Pessimistress changed the base branch from codex/async-view-resolution to master October 20, 2026 17:19
@Pessimistress
Pessimistress force-pushed the codex/source-crs-resolution branch from d747d88 to 599ff79 Compare October 20, 2026 21:58

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread modules/carto/src/layers/vector-tile-layer.ts

@ibgreen ibgreen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the substantial work on the CRS refactor. I’m requesting one correctness fix before approval: globe polygon triangulation still becomes invalid when a shader-side layer transform moves the polygon across the globe. The current code even documents this assumption, but modelMatrix and coordinateOrigin are public layer props and can change without rebuilding indices. Please make the temporary coordinates used for geocentric winding include the same transforms as rendering, and invalidate/retriangulate when those transforms change. A north-to-south move is a concrete case where triangles become inward-facing and disappear under back-face culling.

Comment thread modules/layers/src/solid-polygon-layer/solid-polygon-layer.ts

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 248a5e0. Configure here.

Comment thread modules/layers/src/solid-polygon-layer/solid-polygon-layer.ts
Comment thread modules/layers/src/solid-polygon-layer/solid-polygon-layer.ts
@Pessimistress
Pessimistress merged commit ce528a4 into master Oct 21, 2026
8 checks passed
@Pessimistress
Pessimistress deleted the codex/source-crs-resolution branch October 21, 2026 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants