Atlaslog
Atlaslog / Field Notes / Tiles
Field note · Tiles

One-pixel white seams between tiles

Quick answer

Every tile loads, yet the mosaic shows thin white lines that get denser at lower zoom. Fractional pixel positioning from a container size that is not a multiple of `tileSize`, together with browser scaling and antialiasing, produces the gaps.

Last verified 2026-11-03 · Multiple versions · Cite this page
Applies to: Leaflet 1.9.x / OpenLayers 9.x / high-DPI displays
Symptom
Checklist
  1. Set browser zoom to 100% and see whether the seams vanish
  2. Log the tile container transform and look for fractional values
  3. Check the map container width and height against a multiple of `tileSize`
  4. Look for a CSS `scale` or `zoom` on an ancestor of the map
  5. Compare `tileSize` with the actual tile pixel dimensions
Fix

Oversize tiles by one pixel (`.leaflet-tile { width: 257px !important; height: 257px !important; }`), avoid fractional transforms by snapping the container to a multiple of 256, and for 512-pixel tiles set `tileSize: 512` with `zoomOffset: -1` and `detectRetina: false`.

Code
console.log(layer.getContainer().style.transform);

console.log(map.getSize());   // Point(1023, 767) 不是 256 的整数倍
/* 1. 让瓦片比格子大 1 像素,缝隙被覆盖 */
.leaflet-tile {
  width: 257px !important;
  height: 257px !important;
}

/* 2. 关闭瓦片层的硬件加速,避免小数像素抗锯齿 */
.leaflet-tile-container {
  will-change: auto;
  transform-style: flat;
}
Watch out
All 120 field notesChinese originalRunnable examples
English edition written for Atlaslog from the original Chinese field note. Code is unchanged and runs as-is.
Cite this page

Atlaslog (2026). One-pixel white seams between tiles. https://www.jingweizhi.com/en/cookbook/tile-seam-gap.html (accessed 2026-11-03).