Skip to content

About

Chinese coordinate conversion toolkit — WGS-84 / GCJ-02 / BD-09 conversion and Amap tile reprojection in QGIS | 中国坐标系转换工具集:WGS-84/GCJ-02/BD-09 互转 + 高德瓦片 QGIS 纠偏

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Coord Convert

English | 简体中文

Coordinate conversion utilities for the Chinese map coordinate systems, implementing the standard algorithms used by China's surveying authorities.

Why this exists

Chinese online maps are required by law to render coordinates with a non-linear offset applied — GCJ-02, colloquially "Mars coordinates". Raw GPS data (WGS-84) therefore does not line up with Amap, Baidu, or Tencent imagery, and mixing the two silently shifts points by several hundred metres. This toolkit makes the conversion explicit, verifiable, and reversible.

Supported systems

System Description Used by
WGS-84 Standard GPS coordinates International systems, offline maps
GCJ-02 Obfuscated "Mars" coordinates Amap, Google China, Tencent
BD-09 Baidu coordinates (GCJ-02 plus a second offset) Baidu Maps

Tools

File Purpose
gcj2wgs_converter.py GCJ-02 → WGS-84, supports single points and batch conversion
amap_wgs84_loader.py Loads Amap tiles in QGIS with real-time correction to WGS-84
test_coord_conversion.py Algorithm verification and error measurement

Usage

# Convert GCJ-02 to WGS-84
python gcj2wgs_converter.py

# Run algorithm verification
python test_coord_conversion.py

Code example

from gcj2wgs_converter import gcj02_to_wgs84

# An Amap coordinate (GCJ-02)
gcj_lon, gcj_lat = 114.305202, 30.625309

# Convert to standard GPS coordinates (WGS-84)
wgs_lon, wgs_lat = gcj02_to_wgs84(gcj_lon, gcj_lat)
print(f"WGS-84: {wgs_lon:.6f}, {wgs_lat:.6f}")

QGIS tile correction

amap_wgs84_loader.py builds an Amap vector-tile layer inside QGIS that is reprojected from GCJ-02 to WGS-84 at load time, so the basemap can be overlaid on standard GPS data without manual offsetting. Run it from the QGIS Python console.

License

MIT © Retter Wang

About

Chinese coordinate conversion toolkit — WGS-84 / GCJ-02 / BD-09 conversion and Amap tile reprojection in QGIS | 中国坐标系转换工具集:WGS-84/GCJ-02/BD-09 互转 + 高德瓦片 QGIS 纠偏

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages