Atlaslog / Field Notes / Styling & rendering
Field note · Styling & rendering
Labels pile up, and text-allow-overlap makes it worse
Quick answer
Only a few dozen of 823 POI labels appear because collision detection hides the rest; enabling `text-allow-overlap` shows all 823 on top of each other. That flag disables layout rather than solving crowding.
Symptom
- `queryRenderedFeatures` returns 68 rendered labels against 823 from `querySourceFeatures`
- With `"text-allow-overlap": true` all 823 names overlap at zoom 10 and become unreadable
- Labels visibly thin out as you zoom in, which users report as missing data
Checklist
- Compare `queryRenderedFeatures` and `querySourceFeatures` counts on the same layer
- Check `text-allow-overlap` and `text-ignore-placement` in the layout
- Check whether `symbol-placement: line` is forcing names into tight line layouts
- Check whether `text-size` grows linearly with zoom and inflates collision boxes
- Review `text-padding` and the layer's `minzoom`
Fix
Drive density with zoom filters and interpolated `text-size` instead of the overlap flag: keep `'text-allow-overlap': false`, set `'text-padding': 6`, and switch `setFilter('poi-label', ['>=', ['get', 'rank'], minRank])` on `zoomend` (rank 3 below z12, rank 1 from z14).
Code
const rendered = map.queryRenderedFeatures({ layers: ['poi-label'] }).length;
const total = map.querySourceFeatures('poi').length;
console.log(rendered, total); // 68 823 -> 755 个被碰撞隐藏map.addLayer({
id: 'poi-label',
type: 'symbol',
source: 'poi',
minzoom: 9,
filter: ['>=', ['get', 'rank'], 1], // rank 1 最重要
layout: {
'text-field': ['get', 'name'],
'text-size': ['interpolate', ['linear'], ['zoom'], 9, 11, 14, 14, 18, 17],
'text-padding': 6,
'text-allow-overlap': false,
'text-ignore-placement': false,
'text-max-width': 8,
'text-anchor': 'top',
'text-offset': [0, 0.6]
}
});
map.on('zoomend', () => {
const z = map.getZoom();
const minRank = z >= 14 ? 1 : z >= 12 ? 2 : 3;
map.setFilter('poi-label', ['>=', ['get', 'rank'], minRank]);
});
Watch out
- Setting `text-allow-overlap: true` to show all data, which produces an unreadable pile at low zoom
- Raising `text-size` at high zoom without changing the filter, so fewer labels fit and more are dropped
English edition written for Atlaslog from the original Chinese field note. Code is unchanged and runs as-is.
Atlaslog (2026). Labels pile up, and text-allow-overlap makes it worse. https://www.jingweizhi.com/en/cookbook/label-overlap.html (accessed 2026-11-03).