1. Geodesy

Geodesy is the science of measuring and mapping the earth’s surface, including the determination of the earth’s gravity field and the topography of the ocean floor.

1.1 Geoid

The geoid is the shape of the ocean surface, excluding wind and tide and other influences, and only considering the influence of gravity and rotation. This shape extends across the land, creating a closed curved surface. Although the Earth is usually said to be a sphere or ellipsoid, the geoid is an irregular smooth surface due to the uneven distribution of the earth’s gravity (due to different densities, etc.). Although irregular, it can be approximated as an ellipsoid, which is called a Reference ellipsoid. The height of the geoid relative to the reference ellipsoid is called Undulation of the geoid. This fluctuation is not very large, the highest is 85m in Iceland, the lowest is −106 m in south India, a total of less than 200m. The following figure from Wikipedia indicates the Undulation of different regions under EGM96 GEOID.

1.2 Reference Ellipsoid

A Reference ellipsoid is a mathematically defined surface of the Earth that approximates the geoid. Because it is a geometric model, we can use the major axis, the short axis and the oblateness to determine. What we call longitude, latitude, and altitude are all based on this.

On the one hand, our measurements of the shape of the Earth become more accurate over time. On the other hand, because the geoid is not regular, different regions of the earth often need different reference ellipsoids to fit the geoid as well as possible. There have been many different reference ellipsoids throughout history and many are still in use. Beijing 54 and Xi ‘an 90 coordinate system have been used in China in the past. The Reference ellipsoid of Krasovsky 1940 was used in Beijing 54, and the reference ellipsoid of Xi ‘an 80 was recommended by the 16th Congress of the International Union of Geodesy and Geophysics in 1975. At present, the reference ellipsoid defined by WGS is more commonly used worldwide.

2. Coordinate system

Once you have a geometric model like a reference ellipsoid, you can define coordinates to describe positions, measure distances, and so on, There are usually two kinds of coordinate systems: geographic coordinate systems and projected coordinate systems.

2.1 Geographic Coordinate system

A geographic coordinate system is generally a coordinate system of longitude, latitude, and altitude that can identify any location on the earth.

As mentioned earlier, different reference ellipsoids may be used in different regions, and even if the same ellipsoid is used, the orientation and even size of the ellipsoid may be adjusted so that the ellipsoid better matches the local geoid. This requires the use of different Geodetic datum systems to identify.

Therefore, different measurement systems will give different coordinates for a particular location on the Earth. When we deal with geographical data, we must first confirm the measurement system used.

In fact, as our measurements of the shape of the earth become more accurate, the NAD83 base used in North America and the ETRS89 base used in Europe are basically consistent with the WGS84 base, and even the difference between our CGCS2000 and WGS84 is very small. However, the difference is very small and does not mean that it is completely consistent. Take NAD83 for example, because it has to be constant in North America, so the difference between it and WGS84 is constantly changing. For most parts of the United States, there is a difference of 1-2cm per year.

2.1.1 Enumeration of geographic coordinates

We usually use latitude and longitude to represent a geographical location, but for some reason, the latitude and longitude information we get from different sources may not be in the same coordinate system.

  • Amap, Tencent map and Google China Map use the GCJ-02 coordinate system
  • Baidu map uses the bD-09 coordinate system
  • The coordinates obtained by the underlying interface (HTML5 Geolocation or ios or Android API) from the GPS device use the WGS-84 coordinate system

There may be deviations of tens to hundreds of meters between different coordinate systems, so when developing map-based products, or when visualizing geographic data, we need to correct deviations between different coordinate systems.

2.1.2 WGS-84 – World Geodetic System

Wgs-84 (World Geodetic System, WGS) is the most widely used coordinate System, is also the World’s common coordinate System, alias: WGS:1984, EPSG:4326. The latitude and longitude obtained by the GPS device is the latitude and longitude in the WGS84 coordinate system. Generally, the positioning information obtained through the underlying interface is the WGS84 coordinate system.

2.1.3 GCJ-02 – Coordinate system of National Survey Bureau

Gcj-02 (G-GUOjia Country, C-CEhui Surveying and Mapping, J-JU Bureau), also known as the Mars Coordinate system, is a geodesy system based on WGS-84 developed by the China National Survey Bureau. The obfuscation algorithm used in this coordinate system adds random offsets to the latitude and longitude.

Gcj-02 coordinate system application of some maps listed: Google China map, SOso map, Aliyun map, mapABC map and Gaode map, etc.

🚨 note:

According to national regulations, all public geographic data in mainland China should be encrypted with at least GCJ-02, which means that the data we get from the products of domestic companies must be encrypted. The vast majority of domestic Internet map providers use gCJ-02 coordinate system, including Autonavi, Google Maps China, etc.

Before the public publication, sale, dissemination, display and use of navigational electronic maps, the spatial location technology must be processed. GB 20263-2006 basic requirements for safety processing technology of navigational electronic maps, 4.1

2.1.4 BD-09-Baidu coordinate system

Bd-09 (Baidu, BD) is a geographic coordinate system used by Baidu Map, which adds one more transformation on GCJ-02 to protect users’ privacy. All coordinates obtained from Baidu products are bD-09 coordinate system.

2.1.5 CGCS2000 – National Geodetic Coordinate System

National Geodetic Coordinate System 2000, known as China Geodetic Coordinate System 2000 or CGCS2000, is the latest national Geodetic Coordinate System in China.

2000 The origin of the national geodetic coordinate system is the center of mass of the entire earth including the ocean and atmosphere; The Z axis of the 2000 national geodetic coordinate system points from the origin to the direction of the earth reference pole of epoch 2000.0, which is calculated by the initial pointing of epoch 1984.0 given by the International Time Bureau. The directional time evolution ensures that there is no residual global rotation relative to the crust. The X-axis points from the origin to the intersection of the Greenwich reference meridian and the earth’s equatorial plane (epoch 2000.0), and the Y-axis, z-axis and X-axis form the right-handed orthogonal coordinate system. Use the general relativistic scale.

2.1.6 Transformation of geographic coordinate systems

Both GCJ-02 and BD-09 are used to encrypt geographic data, so the reverse conversion method is not disclosed. Theoretically, the encryption process of GCJ-02 is irreversible, but the original coordinates can be approximated by some methods, and the accuracy of this method is very high. The correction method used by GCOORD has reached the accuracy of centimeter level, which can satisfy most cases.

2.2 Projected Coordinate Systems

A projection coordinate system that defines how to transform a three-dimensional model into a two-dimensional plane (which is easier to carry than a globe) is mathematically known as a projection.

Geographical coordinates are three-dimensional, and we need to convert them to two-dimensional in order to display them on a Map or screen. This is called a Map projection. Obviously, the transformation from three to two dimensions will inevitably lead to distortion and distortion. Distortion is inevitable, but different projections will have different distortions, which gives us a choice. Common projection is equal rectangle projection (Platte Carre) and Mercator projection (Mercator), below from Mercator vs. well… Not Mercator (Platte Carre), vividly illustrates the distortion under these two projections:

The image on the left shows an equally sized circle on the surface of the Earth, and on the top right is a Mercator projection, which is still circular but greatly magnified at higher latitudes. At the bottom right is an isometric projection, where the size of the object changes less dramatically, but the image is elongated. Platte Carre is not suitable for navigation and other activities because of the distortion in the projection, but because the corresponding relationship between coordinates and pixels is very simple, it is very suitable for the display of grid maps. Platte Carre is the default projection of many GIS software.

It is important to note that the Mercator projection is distorted at higher latitudes, and is placed at infinity at the poles, so the Mercator projection cannot show the polar regions. Below, from Wikipedia, you can see the difference between the Mercator projection and the actual size of each country. However, conformality and straight rhumb lines make it very suitable for sea navigation.

The forms of projection deformation: Angle deformation, length deformation and area deformation.

Map projection:

  • Equiangular projection — the angles before and after the projection are the same, but the length and area are distorted;
  • Equidistant projection — the length before and after the projection is the same, but the Angle and area are deformed;
  • Equal area projection – the area before and after the projection is the same, but the Angle and length are distorted.

One more thing to understand is that the basis of the projection coordinate system is the geographic coordinate system. Without the geographic coordinate system, there is no so-called projection coordinate system. The projection coordinate system is the result of the object on the geographic coordinate system being projected onto the specific projection plane.

2.2.1 Enumeration of projection coordinate system

  • Mercator projection
  • Gauss-kruger projection
  • Universal transverse Mercator projection
  • Web Mercator EPSG:3857

3. Implications for Web Map developers

The most familiar ones to Web Map developers are EPSG:4326 (WGS84) and EPSG:3857(pseudo-Mercator), but what is this?

For the most part, Web maps use the WGS84 coordinate system for storing data (in some systems, this specification is called “unprojected” data) and EPSG:3857 (pseudo-Mercator) for visualization.

GPS is based on WGS84, so usually we get coordinate data from WGS84. Generally, when we store data, we still store it by WGS84. WGS84 usually uses GeoJSON as the unit of the coordinate system, which uses numbers as the units of longitude and latitude. Most of the time, when you describe a latitude and longitude coordinate, it is based on the EPSG:4326 coordinate system. This is how we store data in Mapbox.

In order to visualize the GeoJSON data in WGS84 format, three-dimensional data needs to be displayed on a two-dimensional plane, which requires pseudo-Mercator projection, also known as spherical Mercator, Web Mercator projection, Web Mercator, EPSG:3857. It is based on Mercator projection, projecting the WGS84 coordinate system onto a square.

We already know that WGS84 is based on an ellipsoid, but the pseudo-Mercator projection projects coordinates onto the sphere, which results in larger distortions at the poles, but is easier to calculate. Maybe that’s why it’s called a “pseudo” Mercator. In addition, the pseudo-Mercator projection also cuts off the area above 85.051129° north and south latitude to ensure that the entire projection is square. Because of conformal features such as Mercator projection, where the shape of an object remains the same across different layers, a square can be constantly divided into more and smaller squares to show clearer details.

Obviously, the pseudo-Mercator coordinate system is very good for displaying data, but it is not suitable for storing data. Usually we use WGS84 to store data and use the pseudo-Mercator to display data. (This is why mapBox uses EPSG:4326 when storing data but EPSG:3857 when displaying it).

4. Reference

  • EPSG 4326 vs EPSG 3857 (projections, data sets, coordinate systems, etc.)
  • GIS basic knowledge – coordinate system, projection, EPSG:4326, EPSG:3857
  • Projection coordinates (PCS)