Atlaslog
Atlaslog / Field Notes / Services & tile access
Field note · Services & tile access

Switching to a domestic basemap: what actually has to change

Quick answer

Moving from OpenStreetMap to Tianditu, Amap or Tencent is not just a URL swap. The coordinate system, key, protocol and quota rules all change, and Amap and Tencent use GCJ-02, so business data must be converted before display.

Last verified 2026-11-03 · Multiple versions · Cite this page
Applies to: Leaflet · OpenLayers
Symptom
Checklist
  1. Confirm the provider's CRS: Tianditu is CGCS2000 and close to WGS84, while Amap and Tencent are GCJ-02.
  2. Paste the full tile URL into the address bar first; Tianditu is WMTS with TILEMATRIX, TILEROW and TILECOL rather than {z}/{x}/{y}.png.
  3. Check the key whitelist: working on localhost but 403 in production points at the bound domain.
  4. Check maxZoom against the service's real upper level.
  5. Check whether y must be flipped for a TMS source.
  6. Verify that the data pipeline converts WGS84 to GCJ-02 once, at display time.
Fix

Keep raw data in WGS84 and convert once before rendering on a GCJ-02 basemap with wgs84ToGcj02, and build the Tianditu URL with SERVICE=WMTS, REQUEST=GetTile, VERSION=1.0.0, LAYER=vec, STYLE=default, TILEMATRIXSET=w, FORMAT=tiles, TILEMATRIX={z}, TILEROW={y}, TILECOL={x} and tk, using subdomains 0 to 7.

Code
L.tileLayer(
  'https://t{s}.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile' +
  '&VERSION=1.0.0&LAYER=vec&STYLE=default&TILEMATRIXSET=w' +
  '&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=你的KEY',
  { subdomains: '01234567', maxZoom: 18 }
).addTo(map);
L.tileLayer(
  'https://webrd0{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1' +
  '&scale=1&style=8&x={x}&y={y}&z={z}',
  { subdomains: '1234', maxZoom: 18 }
).addTo(map);
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). Switching to a domestic basemap: what actually has to change. https://www.jingweizhi.com/en/cookbook/domestic-basemap.html (accessed 2026-11-03).