GCJ-02 to WGS84 Converter
About GCJ-02 Coordinate System
GCJ-02 (Mars Coordinate System) is a geodetic datum used in China for geospatial data. It applies an encrypted offset to WGS84 coordinates to comply with national regulations.
Developed by the Chinese National Bureau of Surveying and Mapping, GCJ-02 was introduced to implement the national security policy on geospatial information. Most Chinese map services use this system.
GCJ-02 is used by all Chinese government-approved map services including AMap (Gaode), Tencent Maps, and Apple Maps in China. It is required for any mapping application operating within mainland China.
GCJ-02 applies a non-linear offset algorithm to WGS84 coordinates, shifting positions by up to several hundred meters. The exact algorithm is classified by the Chinese government.
The encryption offset only applies within mainland China. Coordinates outside China pass through without modification.
GCJ-02 is the mandatory coordinate system for all commercial map services operating in China. Converting between WGS84 and GCJ-02 is essential for international data integration.
About WGS84 Coordinate System
WGS84 (World Geodetic System 1984) is the global standard geodetic reference system used by GPS. It defines an Earth-centered, Earth-fixed coordinate system and geodetic datum.
Developed by the U.S. Department of Defense in 1984, WGS84 has undergone several refinements (WGS84(G730), WGS84(G873), WGS84(G1150), WGS84(G1762)) to improve accuracy through GPS satellite observations.
WGS84 is the default coordinate system for GPS receivers worldwide. It is used in aviation, maritime navigation, Google Maps, OpenStreetMap, GIS applications, and scientific research.
WGS84 is the native coordinate system of the Global Positioning System (GPS), ensuring direct compatibility with all GPS receivers and satellite navigation systems worldwide.
As the most widely adopted geodetic datum, WGS84 provides a consistent global reference frame for mapping, surveying, and geospatial data exchange across international boundaries.
With continuous refinements, WGS84 achieves centimeter-level accuracy globally, making it suitable for high-precision applications like surveying, drone navigation, and scientific research.
GCJ-02 → WGS84 Conversion Guide
// GCJ-02 → WGS84 (iterative method)
// Since the GCJ-02 offset is non-linear, iterative approach is used:
function gcj02ToWgs84(lat, lon) {
dLat = transformLat(lon - 105.0, lat - 35.0)
dLon = transformLon(lon - 105.0, lat - 35.0)
radLat = lat × π / 180
magic = 1 - 0.00669342162296594323 × sin²(radLat)
sqrtMagic = √magic
dLat = (dLat × 180) / ((6335552.717 / (magic × sqrtMagic)) × π)
dLon = (dLon × 180) / ((6378245.0 / sqrtMagic × cos(radLat)) × π)
wgsLat = lat × 2 - (lat + dLat)
wgsLon = lon × 2 - (lon + dLon)
}Converting GCJ-02 back to WGS84 uses the mathematical inverse of the forward transformation. Since the offset algorithm is non-linear, the inverse uses a double-iteration approach: first compute the forward offset, then subtract it from the original coordinates (offset × 2 - forward = inverse).
- Enter GCJ-02 coordinates in decimal degrees format
- The system applies the inverse offset algorithm
- Results are WGS84 coordinates suitable for GPS and international applications
- Verify converted coordinates on Google Maps or other WGS84-based services
- GCJ-02 to WGS84 conversion is essential for using Chinese map data internationally
- Accuracy is typically within 1 meter for most locations
- Coordinates outside China pass through unchanged