Atlaslog
Atlaslog / Field Notes / Coordinates & projections
Field note · Coordinates & projections

Baidu Mercator without MCBAND segments puts points 3 km off

Quick answer

Baidu's BD09MC is not EPSG:3857; its Y axis uses an 18-segment MCBAND/LLBAND lookup table. Computing tile coordinates with the standard Mercator formula shifts the mosaic about 3.8 km south-west, which is 15 tiles at zoom 18.

Last verified 2026-11-03 · Multiple versions · Cite this page
Applies to: Baidu Map JS API 3.0 · custom tile stitching
Symptom
Checklist
  1. Compare your computed tile indices with the tiles Baidu actually serves; a whole-grid shift means the projection differs.
  2. Search the code for the MCBAND, LLBAND and MC2LL constants.
  3. Reverse-engineer one known point (picker coordinate plus its tile number) and see whether segment coefficients are needed.
  4. Compare points at the same latitude but different longitudes: if the error varies only with latitude, the Y-axis segmenting is missing.
Fix

Do not reimplement BD09MC; keep BD-09 lon/lat and let the official API project, or use Baidu's MercatorProjection, which already carries the 18-segment table.

Code
const MCBAND = [12890594.86, 8362377.87, 5591021, 3481989.83, 1678043.12, 0];
const LLBAND  = [75, 60, 45, 30, 15, 0];

const x = 116.410172 * 20037508.34 / 180;   // 12958335
const y = Math.log(Math.tan((90 + 39.916634) * Math.PI / 360)) / (Math.PI / 180);
const yy = y * 20037508.34 / 180;            // 4855942
// 与百度实际值 12962180 / 4859510 差约 3.8 km
const projection = new BMapGL.MercatorProjection();
const p = projection.lngLatToPoint(new BMapGL.Point(116.410172, 39.916634));
// => { x: 12962179.6, y: 4859509.1 }
const ll = projection.pointToLngLat(new BMapGL.Pixel(12962179.6, 4859509.1));
// => { lng: 116.410172, lat: 39.916634 }
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). Baidu Mercator without MCBAND segments puts points 3 km off. https://www.jingweizhi.com/en/cookbook/bd09-mcband.html (accessed 2026-11-03).