mapbox / mapbox/mapbox-gl-js

Symbols getting clipped when rendering too many

Open
#12,827 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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**: 2.15.0

**browser**: Chrome version 114.0.5735.198

### Steps to Trigger Behavior

1. Create a source
2. Create a symbol icon type layer
3. Add more than 32768 points close to each other
4. Zoom out and then zoom in for show clipped symbols (error occurs on zoom 9-)

![image](https://github.com/mapbox/mapbox-gl-js/assets/31936477/f0e7072f-ad61-4e2b-9b47-edc7506aab1e)

### Expected Behavior

Symbols render normally

### Actual Behavior

Symbols are not rendering

### Code to demonstration

```html

mapboxgl.accessToken = "<access_token>"

var map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/mapbox/streets-v12', // stylesheet location
center: [-46.50, -23.90], // starting position [lng, lat]
zoom: 9 // starting zoom
});

map.showTileBoundaries = true;

map.loadImage('https://upload.wikimedia.org/wikipedia/commons/7/7c/201408_cat.png', function(error, image) {
if (error) throw error;

map.addImage('custom-marker', image);

var points = [];

for (var i = 0; i < 42000; i++) {
var lngLat = [
-46.50 + (Math.random() - 0.5) * 0.40,
-23.90 + (Math.random() - 0.5) * 0.40
];
points.push({
type: 'Feature',
geometry: {
type: 'Point',
coordinates: lngLat
}
});
}

map.on('load', function() {
map.addLayer({
id: 'points',
type: 'symbol',
source: {
type: 'geojson',
data: {
type: 'FeatureCollection',
features: points
}
},
layout: {
'icon-allow-overlap': true,
'icon-image': 'custom-marker',
'icon-size': 0.05
}
});
});
});

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

Start by running the supplied Chrome reproduction with 42,000 symbol points and zooming around level 9. Trace the symbol rendering path to find where counts above 32,768 are clipped or omitted. Done means the symbols render normally while zooming in and out, with coverage for the reproduced case if the relevant test location is identified.

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.