Coordinate Systems for Web Mapping
A coordinate pair is incomplete without its coordinate reference and source. The same longitude and latitude can land in different places when GPS data, a GCJ-02 basemap, and Baidu's BD-09 ecosystem are mixed.
1. WGS-84: The Global Standard
WGS 84 is the reference system associated with GPS. Browser geolocation usually returns latitude and longitude values that application developers treat as WGS-84 coordinates, but the API also reports an accuracy radius. Decimal precision is not the same as measured accuracy: six decimal places do not make a noisy phone fix centimeter-accurate.
2. The China Problem: GCJ-02 and BD-09
GCJ-02 is commonly used by Chinese map services, while Baidu uses BD-09 on top of that ecosystem. Plotting coordinates from one system on tiles from another produces a visible offset. Provider documentation and applicable mapping rules—not a generic blog statement—should determine the coordinate system used in a production integration.
Furthermore, Baidu Maps uses its own system, BD-09, which adds another layer of complexity.
3. The Conversion Solution
The Coordinate Converter implements browser-side conversions between all three labels. Its WGS-84/GCJ-02 functions apply an approximate public-domain-style formula inside a rectangular “China” bounds check; outside that box the values are returned unchanged. GCJ-02/BD-09 uses the familiar trigonometric offset formula. Results are displayed to six decimal places.
- WGS-84 → GCJ-02 → BD-09: the BD value is derived through GCJ-02.
- GCJ-02 → WGS-84: an approximate inverse, not a surveyed ground truth.
- BD-09 → GCJ-02 → WGS-84: each transformation can introduce rounding and approximation error.
🗺️ Developer Note
Store the original numeric pair together with an explicit field such as coordinateSystem: "wgs84", plus source and accuracy when available. Convert at a clearly documented boundary. Never overwrite the only source value with an approximate conversion.
4. Test the Whole Map Pipeline
- Use control points whose expected positions are known in the chosen provider.
- Test a mainland point, a point outside the converter's bounds, and coordinates near the boundary.
- Verify latitude/longitude order: this tool accepts separate fields and copies output as
latitude, longitude. - Round-trip a point and record the residual error; do not expect exact equality.
- Confirm the map SDK, search API, stored data, and exported files all use the declared system.
Conclusion
Conversion can align a known source with a known map provider, but it cannot repair an inaccurate GPS fix or replace authoritative geospatial processing. Preserve provenance, label the system, and verify against the actual basemap.