mapbox / mapbox/mapbox-gl-js

Unexpected results from overlapping polygons

Open
#13,301 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged bug :lady_beetle:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

**mapbox-gl-js version**: 3.7.0

**browser**: Google Chrome 130

### Steps to Trigger Behavior

Create a map instance with a filled Polygon containing three sets of coordinates.
1. The entire world - `[[180, 90], [-180, 90], [-180, -90], [180, -90]]`
2. A triangle - `[[149.4, -37.3], [152.5, -32.1], [150.1, -32.6]]`
3. A triangle within the previous one - `[[151, -32.8], [151.5, -32.8], [152, -32.6]]`

### Link to Demonstration

https://codepen.io/farseekers/pen/abeWNVz

### Expected Behavior

I acknowledge there might be different interpretations of whether the inner triangle should be filled or not, but I expect the corners of the resulting shapes to be limited to the supplied points.

### Actual Behavior

At a certain zoom level, there is a triangle that seems unrelated to any of the input points. I've used markers to indicate the input points.

demo

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in the linked CodePen using mapbox-gl-js 3.7.0 in Chrome 130, with the world polygon and the two nested triangles described in the steps. Vary the zoom level and compare the rendered corners with the supplied coordinates; done means the unrelated triangle no longer appears and the resulting polygon geometry matches the reported expected behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
computer-graphics, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.