Coordinate Transformations and Map Misalignment
🎯 Introduction
By the end of this article, you will be able to distinguish coordinate transformation, reprojection, and simply assigning a CRS, and use evidence to diagnose map misalignment.
🔄 Transformation and Reprojection
Declaring data as EPSG:4326 adds metadata without changing its values. Transforming EPSG:4326 coordinates to EPSG:3857 recalculates those values using the two systems’ rules. For rasters, the process also generates a new target grid and is commonly called reprojection.
Transformation and reprojection allow data from different sources to align on the same map. Without transformation, data may describe the same place yet appear in different locations because its values follow different rules.
4326 commonly uses degrees; 3857 uses meters. Their numeric ranges and meanings differ. Changing an EPSG label alone does not make the data ready to overlay.
🧭 WGS84, GCJ-02, and BD-09
WGS84 is a common global coordinate reference. GCJ-02 and BD-09 are coordinate conventions used by some map services in China. All may express positions as longitude and latitude, but the values for the same place differ.
Overlaying GPS output directly on a GCJ-02 basemap can produce a systematic offset. Follow the basemap and data providers’ documentation, transform coordinates at a clearly defined integration step, and record the input and output coordinate types.
🪤 A Common Diagnostic Sequence
- Check whether the request succeeded and returned data.
- Check whether the objects fall within the current viewport.
- Check whether the coordinate order is
[longitude, latitude]. - Check whether units are degrees or meters and whether the values are plausible.
- Check whether the data and basemap use compatible CRSs.
- Check whether transformation was applied twice or omitted entirely.
This sequence rules out inexpensive, common checks before investigating coordinate rules. It avoids mistaking a failed request for a CRS error or concealing the real cause with a manual shift.
Do not fix an entire layer by adding a constant longitude and latitude offset. Misalignment can vary by location, and manual shifts can hide CRS, coordinate order, or unit errors.
🧾 Summary
- Assigning a CRS does not transform coordinates.
- 4326 uses geographic coordinates; 3857 is commonly used for web display.
- WGS84, GCJ-02, and BD-09 are not interchangeable.
- Check data, coordinate order, units, CRS, and repeated transformations when troubleshooting.
❓ Knowledge Check
Q1: Do plausible coordinate values prove the data is correct?
No. Different coordinate systems can use similar longitude and latitude ranges. Check the source documentation.
Q2: If nothing appears on the map, must it be an offset problem?
No. The cause may be the viewport, layer visibility, a request, or styling.
🧪 Exercise
Explain the possible meanings of [116.4, 39.9], [39.9, 116.4], and [12957589, 4851421], and give your reasoning.
// Write your code here
🎉 You now know a basic sequence for diagnosing map misalignment!
