Repository navigation
feat(core): layer coordinateSystem supports arbitrary CRS - #10874
Conversation
[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
SummaryLayers can declare arbitrary source CRSs, with CPU conversion when the view cannot use those coordinates directly.
|
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 |
df1769d to
bbbcc9c
Compare
bbbcc9c to
b0c50dc
Compare
b0c50dc to
d747d88
Compare
d747d88 to
599ff79
Compare
ibgreen
left a comment
There was a problem hiding this comment.
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.
Master's GLSL terrain module samples the Mercator height map through the globe inverse for both PROJECTION_MODE_GLOBE and GLOBE_METER_OFFSETS (#10874). Match it in the WGSL plugin so meter-offset layers on GlobeView read and write the height map at the right texels. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…11013) * fix(extensions): ClipExtension geometry mode in GlobeView In geometry (fragment) mode the extension compared `geometry.position.xy` with `clipBounds` projected through `layer.projectPosition()`. Both are in the active projection's common space, which under GlobeView is sphere XYZ: comparing the x/y of a sphere position against a box has no geographic meaning and rendered a single diagonal stripe instead of the clipped rectangle. Use the flat common-space helpers from the framework branch instead: the vertex shader converts `geometry.position` with `project_common_position_to_flat()` (identity for flat projections, sphere -> absolute Web Mercator under GLOBE) and `draw()` produces the bounds with `projectBoundsToFlatCommon()`, its CPU twin, so both sides agree in every projection mode. The instance (vertex) mode compares raw lng/lat and is untouched, as is the WebGPU path. Tests: new render spec test/render/test-cases/clip-extension.spec.ts renders `clip-geometry` (PolygonLayer, clipByInstance: false) and `clip-instance` (ScatterplotLayer) under MapView, GlobeView and OrthographicView via expandViewMatrix (6 goldens; all show the same clipped rectangle). Unit spec asserts the `clip.bounds` uniform equals the Mercator projection of clipBounds on both WebMercatorViewport and GlobeViewport in geometry mode and stays raw lng/lat in instance mode. Docs: clip-extension.md gains a Remarks section (GlobeView support, Mercator evaluation, antimeridian, clipByInstance semantics). Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01FyzWaF5TmQPmGjh3Zr3XL9 * fix(extensions, layers): clip in flat space on WebGPU and across the antimeridian The WGSL layers passed raw geometry.position.xy to clip_filterColor, which is sphere XY under GlobeView while the bounds are now Mercator. Add clip_getCoordinates() in the WGSL clip module and use it in ScatterplotLayer, PathLayer and SolidPolygonLayer. Both GLSL and WGSL now wrap the flat position around the bounds centre, so geometry stays continuous across the antimeridian and bounds whose left edge is east of their right edge clip the intended region instead of needing two layers. Adds a side-by-side MapView/GlobeView render case. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01FyzWaF5TmQPmGjh3Zr3XL9 * docs(extensions): ClipExtension remarks for antimeridian bounds and clipByInstance Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01FyzWaF5TmQPmGjh3Zr3XL9 * test(render): ClipExtension grid cases with obvious expected results Replace the San Francisco zip-code data with a 7 x 4 grid of squares and dots whose bounds cut through known columns and rows, and state the expected picture for every case in the spec. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01FyzWaF5TmQPmGjh3Zr3XL9 * docs(extensions): ClipExtension GlobeView support in what's new, limitation in Remarks Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01FyzWaF5TmQPmGjh3Zr3XL9 * fix(extensions): wrap clip coordinates per fragment, not per vertex Wrapping each vertex about the bounds centre tears triangles that straddle the point 180° from the bounds, so a polygon there leaked a stripe into the bounds. Keep the varying continuous within each triangle (globe seam opposite the camera) and wrap in the fragment stage, in GLSL and WGSL. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01FyzWaF5TmQPmGjh3Zr3XL9 * docs(extensions): tighten ClipExtension antimeridian note and render test comments * docs(extensions): state the 180° condition for antimeridian clip bounds Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01FyzWaF5TmQPmGjh3Zr3XL9 --------- Co-authored-by: Claude <[email protected]> (cherry picked from commit e1d346d) [9.4-release] Check only viewport.isGeospatial: project.isCustomProjection comes from #10874, which is not in 9.4, and 9.4 has no custom geospatial projection mode.
Master's GLSL terrain module samples the Mercator height map through the globe inverse for both PROJECTION_MODE_GLOBE and GLOBE_METER_OFFSETS (#10874). Match it in the WGSL plugin so meter-offset layers on GlobeView read and write the height map at the right texels. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Master's GLSL terrain module samples the Mercator height map through the globe inverse for both PROJECTION_MODE_GLOBE and GLOBE_METER_OFFSETS (#10874). Match it in the WGSL plugin so meter-offset layers on GlobeView read and write the height map at the right texels. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Master's GLSL terrain module samples the Mercator height map through the globe inverse for both PROJECTION_MODE_GLOBE and GLOBE_METER_OFFSETS (#10874). Match it in the WGSL plugin so meter-offset layers on GlobeView read and write the height map at the right texels. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Master's GLSL terrain module samples the Mercator height map through the globe inverse for both PROJECTION_MODE_GLOBE and GLOBE_METER_OFFSETS (#10874). Match it in the WGSL plugin so meter-offset layers on GlobeView read and write the height map at the right texels. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Master's GLSL terrain module samples the Mercator height map through the globe inverse for both PROJECTION_MODE_GLOBE and GLOBE_METER_OFFSETS (#10874). Match it in the WGSL plugin so meter-offset layers on GlobeView read and write the height map at the right texels. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…10751) * Add WebGPU terrain height-map fitting * Keep renderer definitions isolated between Vitest projects * Release per-test WebGL contexts before they evict the shared test device * Preserve billboard extrusion and translated terrain bounds * Keep source geometry available after terrain projection * fix(extensions): treat globe meter offsets as globe in WGSL terrain Master's GLSL terrain module samples the Mercator height map through the globe inverse for both PROJECTION_MODE_GLOBE and GLOBE_METER_OFFSETS (#10874). Match it in the WGSL plugin so meter-offset layers on GlobeView read and write the height map at the right texels. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix: adapt terrain fitting to shared shader hooks * test: cover rotated terrain bounds * fix: keep globe terrain bounds in Mercator space * fix: scale globe terrain heights at projected anchors * fix(extensions): preserve perspective terrain billboard sizing * fix(extensions): preserve terrain and clipping hook composition * fix(extensions): preserve camera-clipped terrain path widths * fix(extensions): exclude display bias from terrain height selection * docs: describe extension behavior and limits * test(extensions): run Terrain coverage in the standard GPU suite * fix(extensions): default WebGPU terrain fitting to offset * fix(extensions): register terrain effect when adding the extension --------- Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Ib Green <[email protected]>
Resolve conflicts with the coordinate system and dependency upgrades on master: - wms-layer.ts: keep the fix that reads `crs` from the stored GetImageParameters, and use the 'lnglat' / 'cartesian' coordinate system strings from visgl#10874. - wms-layer.spec.ts: keep the new URL source test from master and the EPSG:4326 test from this branch. Use the loaders.gl and math.gl subpath imports from visgl#11274, and expect 'lnglat' because COORDINATE_SYSTEM is no longer exported.
For #10739
Background
Major conceptual clean up of projection pipeline. Now explicitly separates:
For example, MVTLayer in v9.4 creates sublayers with
coordinateSystem: 'cartesian'in MapView andcoordinateSystem: 'lnglat'in GlobeView. After this PR, it creates sublayers withcoordinateSystem: 'OSMTile512'in all viewports.Antarctica,

coordinateSystem: 'EPSG:3031'(Stereographic) +GlobeViewFrance regions,

coordinateSystem: 'EPSG:2154'(Lambert-93) +MapViewSwitzerland cantons,

coordinateSystem: 'EPSG:2056'(LV95) +CustomProjectionView toCrs: 'EPSG:8857'(Equal Earth)Change List
Layer.coordinateSystemOSMTile512Note
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 removedCOORDINATE_SYSTEMexport. The layer manager resolves CRS asynchronously, blocks init/update until ready, and tracks source vs packed attribute CRS plus CPUpreproject/unpreprojectwhen the view shader cannot consume the source CRS directly.coordinateOriginapplies in source CRS before conversion for absolute CRSs.Projection pipeline refactor: viewport
getPreprojection(sourceCrs)replaces ad-hocpreprojectflags; shader uniformcoordinateSystem→coordinateFrame(identity/geodetic/projected/geocentric). Multi-view: first viewport allowed bylayerFilter(screen pass) seeds a layer’s projection context; draw activates viewport once per layer.resolutionsubdivision is earth-circumference–based (opt-in, including Globe); layers usegetSubdivisionStep(sourceCrs).Aggregation, tiles, picking: aggregation/custom-projection paths use
project.isCustomProjectionand layer preprojection state; hexagon pick addspositionin source CRS (nullable);PickingInfo.coordinatemay benull. MVT documents/uses tile-localOSMTile512; 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.