Skip to content

fix: improvements for globe view mode polygon tesselation#3548

Closed
igorDykhta wants to merge 0 commit into
masterfrom
igr/tesselation-adjustments
Closed

fix: improvements for globe view mode polygon tesselation#3548
igorDykhta wants to merge 0 commit into
masterfrom
igr/tesselation-adjustments

Conversation

@igorDykhta

@igorDykhta igorDykhta commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Some polygons are badly tesselated in Globe mode

Screenshot 2026-07-23 at 11 07 17 PM Screenshot 2026-07-24 at 1 09 01 AM

Copilot AI review requested due to automatic review settings July 23, 2026 21:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR improves polygon fill rendering in Globe mode by generating and rendering a refined (subdivided) triangulation for polygon fills, preventing long fill-triangle edges from bulging off the sphere and spilling past polygon outlines.

Changes:

  • Add @math.gl/polygon and use earcut to triangulate polygon rings, then refine triangles via midpoint subdivision for globe-safe fills.
  • Extend Arrow/WKB binary conversion to attach a separate polygonsFill geometry for globe fills while keeping original polygons for outlines.
  • Update GeoJsonLayer rendering in globe mode to use the refined fill mesh (with caching to keep data references stable) and optionally render outlines via a second layer.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 5 comments.

File Description
yarn.lock Adds lockfile metadata for the new @math.gl/polygon dependency.
src/layers/package.json Adds @math.gl/polygon as a direct dependency of the layers package.
src/layers/src/layer-utils.ts Builds refined polygon-fill mesh (polygonsFill) during WKB→binary conversion using earcut + triangle subdivision.
src/layers/src/geojson-layer/geojson-layer.ts In globe mode, renders fill from polygonsFill and outline from original polygons, with a WeakMap cache for stable data references.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/layers/src/layer-utils.ts Outdated
Comment thread src/layers/src/layer-utils.ts Outdated
Comment thread src/layers/src/layer-utils.ts Outdated
Comment thread src/layers/src/geojson-layer/geojson-layer.ts Outdated
Comment thread src/layers/src/geojson-layer/geojson-layer.ts Outdated
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.

2 participants