Overflow with collision features in overscaled tiles leads to missing line labels
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
**mapbox-gl-js version**: 1.6.0
**browser**: Chrome or Firefox (tested on Firefox 70)
### Steps to Trigger Behavior
1. Define a vector tile source with maxzoom=14
2. Zoom in a dense area with many line labels to display
3. Notice that most labels will disappear on a high enough zoom level (typically after zoom 19 or 20)
### Link to Demonstration
http://jsfiddle.net/jpz05u9k/ : street names are not rendered on zoom level >= 20
### Expected Behavior
Text features that have been drawn on a certain zoom level should remain visible after zooming in, if there is no collision with any other feature.
### Actual Behavior
In overscaled tiles, mapbox-gl-js cannot keep track of all symbol instances to place. As a result nonexistent collisions are detected and some line labels are not drawn.
After digging into the implementation, it seems this is in part due to an integer overflow with `textBoxStartIndex` and `textBoxEndIndex` (both uint16) in `SymbolInstanceStruct`, whereas the number of collision circles to place in the source tile is bigger than 2^16.
I understand that this issue might be related with [a known limitation in mapbox-gl-js](https://github.com/mapbox/mapbox-gl-js/blob/v1.6.0/src/data/bucket/symbol_bucket.js#L937-L943).
Should it be made more explicit (with a dedicated warning message) ?
Could it be mitigated ? by reducing the number of collision circles in overscaled tiles ?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/data/bucket/symbol_bucket.js, especially the known limitation around line 937, and inspect SymbolInstanceStruct's textBoxStartIndex and textBoxEndIndex. Reproduce the issue with the linked jsfiddle at zoom level 20 or higher, then determine whether the fix should prevent false collisions or provide an explicit warning. Done means dense line labels remain visible when there is no collision, or the limitation is clearly reported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100