China Map Coordinate Converter

Fix the China GPS offset: convert GPS (WGS84), Amap/Tencent (GCJ-02), and Baidu (BD-09) coordinates for Chinese map services.

Why are GPS coordinates offset on Chinese maps?

Under Chinese regulations, public maps of mainland China must apply an official obfuscation algorithm to coordinates. The result is GCJ-02, often called "Mars coordinates". Amap (Gaode), Tencent Maps, Apple Maps in China, and the Google Maps road map of mainland China all use GCJ-02, while Baidu Maps applies a second offset on top of it, called BD-09. GPS receivers and phones report WGS84, so a raw GPS point pasted into one of these maps usually lands a few hundred meters away, and more than 1 km away on Baidu Maps. To fix the China GPS offset, convert the point to the coordinate system the destination map expects.

How to convert China map coordinates

1

Paste coordinates

Enter latitude and longitude from GPS, Amap/Tencent, or Baidu Maps. Put one point on each line to process several coordinates together, and keep the numeric values and separators easy to review.

2

Choose source and target

Select the system used by the device or map that produced the input, then select the map where you plan to use the result. Product names are shown with WGS84, GCJ-02, or BD-09 to make the choice easier.

3

Copy or verify on a map

Inspect the target system, choose a copy format, and copy one result or all coordinate systems. You can also open the target map to check the marker. If it looks wrong, verify the source system and coordinate order first.

Which coordinate system should I choose?

GPS / WGS84

GPS devices, Google Earth, and OpenStreetMap commonly use WGS84. It is a common global source for exchanging geographic coordinates. Tianditu uses CGCS2000; for ordinary web map markers the two are often treated as close, but surveying work should follow the specified datum.

Mars coordinates / GCJ-02

Amap, Tencent Maps, and Apple Maps in mainland China use GCJ-02. GPS coordinates pasted directly into these maps can appear offset from roads or buildings. Choose a conversion from the actual source to the destination system rather than guessing from the numbers.

Baidu / BD-09

Baidu Maps uses BD-09 latitude and longitude, which differs from GCJ-02. For a GPS point used in Baidu Maps, the usual conversion path is WGS84 to GCJ-02 and then BD-09. When moving a Baidu point to another map, select the reverse path explicitly.

Which coordinate system does each map use?

Map or data sourceCoordinate system
GPS devices, raw phone location, photo EXIFWGS84
Google Earth, OpenStreetMapWGS84
Google Maps (mainland China road map)GCJ-02 (satellite imagery is WGS84, so the layers misalign)
Apple Maps (mainland China)GCJ-02 (map data provided by Amap/AutoNavi)
Amap (Gaode), Tencent MapsGCJ-02 (Mars coordinates)
Baidu MapsBD-09 (lat/lng) / BD-09MC (meters)
TiandituCGCS2000 (close to WGS84 for web markers)

Why don't Google Maps roads line up with satellite imagery in China?

Inside mainland China, the Google Maps road map uses GCJ-02 while the satellite imagery uses WGS84, so roads and buildings shift by a few hundred meters when you switch layers. A point copied from the Google Maps road map in mainland China is GCJ-02; convert it from GCJ-02 to WGS84 before using it in a GPS device or OpenStreetMap. A point picked on the satellite layer is already WGS84.

Example: how far apart are WGS84, GCJ-02, and BD-09?

The table shows three sample points converted with this tool (latitude, longitude) and how far each result lies from the original WGS84 position.

Sample pointWGS84 (GPS)GCJ-02 (Amap/Tencent)BD-09 (Baidu)Offset from WGS84
Tiananmen Gate, Beijing39.907359, 116.39126339.908760, 116.39750439.915104, 116.403877GCJ-02 ≈ 555 m; BD-09 ≈ 1,378 m
Oriental Pearl Tower, Shanghai31.241946, 121.49526031.239947, 121.49970931.245587, 121.506320GCJ-02 ≈ 478 m; BD-09 ≈ 1,127 m
Canton Tower, Guangzhou23.109015, 113.31914823.106404, 113.32455823.112168, 113.331100GCJ-02 ≈ 625 m; BD-09 ≈ 1,272 m

Common conversion scenarios

GPS to Amap/Tencent (WGS84 to GCJ-02)

Use this when a GPS point appears offset from roads or buildings on Amap or Tencent Maps. Confirm that the input really came from GPS or another WGS84 source.

GPS to Baidu Maps (WGS84 to BD-09)

Choose this for a Baidu Maps destination. GeoQux follows the WGS84, GCJ-02, BD-09 relationship, so you do not need to convert through the intermediate system yourself.

Mars coordinates to GPS (GCJ-02 to WGS84)

Use this to prepare a point from Amap, Tencent Maps, or the Google Maps road map in China for GPS or a global map. Reverse conversion is approximate and is intended for everyday map markers and data checks, not surveying.

Baidu to Amap/Tencent (BD-09 to GCJ-02)

Use this when moving a Baidu point to Amap or Tencent Maps. Opening the converted result on the destination map can help catch a wrong source system or coordinate order.

Input format, coordinate order, and batch conversion

Enter decimal degrees with one point per line, for example the GPS coordinates of Tiananmen Gate, 39.907359, 116.391263 (latitude first) or 116.391263, 39.907359 (longitude first). The source and target selectors describe the map coordinate system; the order selector controls which number comes first. These are separate settings. Many Chinese map APIs use longitude first, while GPS data and Google Maps put latitude first, so check a sample against the original source even when the order is detected automatically. After conversion, copy only the target value or all systems, and choose comma, comma plus space, or JSON array formatting for a spreadsheet, script, or map service.

Need coordinates first? Pick a point with the GPS Coordinates Finder

Coverage and edge cases

GCJ-02 and BD-09 are primarily used by Chinese map products. Points outside mainland China usually do not need those offsets, so the tool returns them unchanged after a rough area check; this check is not an administrative or survey boundary. Map data and display rules can vary in Hong Kong, Macau, Taiwan, and around borders, so a brand name alone does not always identify the system used by a particular dataset. For important points, confirm the source device or API documentation and verify the result on the destination map. Tianditu, surveying products, and GIS datasets may also use CGCS2000, projected coordinates, or vertical datums. This tool converts geographic latitude and longitude and does not replace a professional datum or projection transformation.

Accuracy and limits

GeoQux uses common GCJ-02 and BD-09 formulas. Reverse conversion to WGS84 uses an iterative approximation; in a round-trip test on the sample points above, GCJ-02 to WGS84 differs by about 1 cm and BD-09 to WGS84 by about 6 cm. Source data, map tiles, and display behavior can also affect the visible difference. It is intended for ordinary map markers, data checks, and development, and is not guaranteed to match official survey results. Do not use it for surveying, legal boundaries, safety-critical navigation, or emergency response.

Developer snippets: WGS84, GCJ-02, and BD-09 conversion

These JavaScript and Python functions use the same formulas as this tool. Arguments and return values are longitude first.

JavaScript
const PI = Math.PI;
const A = 6378245.0;
const EE = 0.00669342162296594323;
const X_PI = PI * 3000.0 / 180.0;

function outOfChina(lng, lat) {
  return lng < 72.004 || lng > 137.8347 || lat < 0.8293 || lat > 55.8271;
}

function transformLat(x, y) {
  let ret = -100 + 2 * x + 3 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.sqrt(Math.abs(x));
  ret += (20 * Math.sin(6 * x * PI) + 20 * Math.sin(2 * x * PI)) * 2 / 3;
  ret += (20 * Math.sin(y * PI) + 40 * Math.sin(y / 3 * PI)) * 2 / 3;
  ret += (160 * Math.sin(y / 12 * PI) + 320 * Math.sin(y * PI / 30)) * 2 / 3;
  return ret;
}

function transformLng(x, y) {
  let ret = 300 + x + 2 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.sqrt(Math.abs(x));
  ret += (20 * Math.sin(6 * x * PI) + 20 * Math.sin(2 * x * PI)) * 2 / 3;
  ret += (20 * Math.sin(x * PI) + 40 * Math.sin(x / 3 * PI)) * 2 / 3;
  ret += (150 * Math.sin(x / 12 * PI) + 300 * Math.sin(x / 30 * PI)) * 2 / 3;
  return ret;
}

// WGS84 (GPS) -> GCJ-02 (Amap / Tencent)
function wgs84ToGcj02(lng, lat) {
  if (outOfChina(lng, lat)) return [lng, lat];
  const radLat = lat / 180 * PI;
  let magic = Math.sin(radLat);
  magic = 1 - EE * magic * magic;
  const sqrtMagic = Math.sqrt(magic);
  const dLat = transformLat(lng - 105, lat - 35) * 180 / ((A * (1 - EE)) / (magic * sqrtMagic) * PI);
  const dLng = transformLng(lng - 105, lat - 35) * 180 / (A / sqrtMagic * Math.cos(radLat) * PI);
  return [lng + dLng, lat + dLat];
}

// GCJ-02 -> WGS84, iterative approximation
function gcj02ToWgs84(lng, lat) {
  if (outOfChina(lng, lat)) return [lng, lat];
  let [wLng, wLat] = [lng, lat];
  for (let i = 0; i < 10; i++) {
    const [gLng, gLat] = wgs84ToGcj02(wLng, wLat);
    wLng -= gLng - lng;
    wLat -= gLat - lat;
  }
  return [wLng, wLat];
}

// GCJ-02 -> BD-09 (Baidu)
function gcj02ToBd09(lng, lat) {
  const z = Math.sqrt(lng * lng + lat * lat) + 0.00002 * Math.sin(lat * X_PI);
  const theta = Math.atan2(lat, lng) + 0.000003 * Math.cos(lng * X_PI);
  return [z * Math.cos(theta) + 0.0065, z * Math.sin(theta) + 0.006];
}

// BD-09 -> GCJ-02
function bd09ToGcj02(lng, lat) {
  const x = lng - 0.0065;
  const y = lat - 0.006;
  const z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * X_PI);
  const theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * X_PI);
  return [z * Math.cos(theta), z * Math.sin(theta)];
}
Python
import math

PI = math.pi
A = 6378245.0
EE = 0.00669342162296594323
X_PI = PI * 3000.0 / 180.0


def out_of_china(lng, lat):
    return lng < 72.004 or lng > 137.8347 or lat < 0.8293 or lat > 55.8271


def _transform_lat(x, y):
    ret = -100 + 2 * x + 3 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * math.sqrt(abs(x))
    ret += (20 * math.sin(6 * x * PI) + 20 * math.sin(2 * x * PI)) * 2 / 3
    ret += (20 * math.sin(y * PI) + 40 * math.sin(y / 3 * PI)) * 2 / 3
    ret += (160 * math.sin(y / 12 * PI) + 320 * math.sin(y * PI / 30)) * 2 / 3
    return ret


def _transform_lng(x, y):
    ret = 300 + x + 2 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * math.sqrt(abs(x))
    ret += (20 * math.sin(6 * x * PI) + 20 * math.sin(2 * x * PI)) * 2 / 3
    ret += (20 * math.sin(x * PI) + 40 * math.sin(x / 3 * PI)) * 2 / 3
    ret += (150 * math.sin(x / 12 * PI) + 300 * math.sin(x / 30 * PI)) * 2 / 3
    return ret


def wgs84_to_gcj02(lng, lat):
    """WGS84 (GPS) -> GCJ-02 (Amap / Tencent)"""
    if out_of_china(lng, lat):
        return lng, lat
    rad_lat = lat / 180 * PI
    magic = 1 - EE * math.sin(rad_lat) ** 2
    sqrt_magic = math.sqrt(magic)
    d_lat = _transform_lat(lng - 105, lat - 35) * 180 / ((A * (1 - EE)) / (magic * sqrt_magic) * PI)
    d_lng = _transform_lng(lng - 105, lat - 35) * 180 / (A / sqrt_magic * math.cos(rad_lat) * PI)
    return lng + d_lng, lat + d_lat


def gcj02_to_wgs84(lng, lat):
    """GCJ-02 -> WGS84, iterative approximation"""
    if out_of_china(lng, lat):
        return lng, lat
    w_lng, w_lat = lng, lat
    for _ in range(10):
        g_lng, g_lat = wgs84_to_gcj02(w_lng, w_lat)
        w_lng -= g_lng - lng
        w_lat -= g_lat - lat
    return w_lng, w_lat


def gcj02_to_bd09(lng, lat):
    """GCJ-02 -> BD-09 (Baidu)"""
    z = math.sqrt(lng * lng + lat * lat) + 0.00002 * math.sin(lat * X_PI)
    theta = math.atan2(lat, lng) + 0.000003 * math.cos(lng * X_PI)
    return z * math.cos(theta) + 0.0065, z * math.sin(theta) + 0.006


def bd09_to_gcj02(lng, lat):
    """BD-09 -> GCJ-02"""
    x, y = lng - 0.0065, lat - 0.006
    z = math.sqrt(x * x + y * y) - 0.00002 * math.sin(y * X_PI)
    theta = math.atan2(y, x) - 0.000003 * math.cos(x * X_PI)
    return z * math.cos(theta), z * math.sin(theta)

FAQ

Why is my GPS location offset on Chinese maps?⌄
Amap and Tencent Maps use GCJ-02 (Mars coordinates) and Baidu Maps uses BD-09, while GPS reports WGS84. The same numbers therefore land a few hundred meters to more than 1 km away on a Chinese map. Convert the point to the destination map's coordinate system to fix the offset.
What are Mars coordinates (GCJ-02)?⌄
"Mars coordinates" is the informal name for GCJ-02, the obfuscated coordinate system required for public maps of mainland China. Amap, Tencent Maps, Apple Maps in China, and the Google Maps road map of mainland China use it.
How accurate is GCJ-02 to WGS84 conversion?⌄
There is no published exact inverse, so GeoQux uses an iterative approximation. On the sample points, the round-trip error is about 1 cm for GCJ-02 and about 6 cm for BD-09, which is fine for map markers but not for surveying.
Do coordinates outside China need conversion?⌄
Usually no. GeoQux returns unchanged coordinates outside the rough China rectangle and shows a warning.
What about Hong Kong, Macau, and Taiwan?⌄
Map product behavior can vary. Choose by source and target product, then verify using the map links.
What is BD-09MC?⌄
BD-09MC is Baidu's meter-based Mercator coordinate format, usually shown as seven- or eight-digit numbers. GeoQux currently detects it but converts only BD-09 latitude and longitude.
Can I convert multiple coordinates at once?⌄
Yes. Put one point on each line, choose the source, target, and coordinate order, then convert. Copy the target values or all coordinate systems.
Does coordinate order matter?⌄
Yes. Choose longitude first or latitude first to match the original data. Automatic detection helps with common cases, but check the source when values are atypical.
Is this tool free?⌄
Yes. No signup is required, and conversion runs in your browser without uploading your coordinates.