### Maps on the Web

In a nutshell:  In web maps, geographical coordinates are projected as if the Earth were a perfect sphere. The results are great for general use but not for high-precision applications.

Mercator’s Projection

Cartographers have devised numerous projections, each having advantages and drawbacks. No one projection is ideal. Mercator’s projection is based on a cylinder tangent to the Earth at the Equator. It gives an accurate representation of land-masses in the tropics, but distorts them greatly in polar regions. For example, Africa has an area of about 30 million km², while Greenland’s area is just 2 million km². Yet, on the Mercator projection, Greenland looks about the same size as Africa.

Mercator projection with Tissot‘s indicatrices showing the areal distortion: all disks are of equal area on the globe. [Image: Wikimedia Commons. Author Stefan Kühn].

The Earth is only approximately spherical. For Ordnance Survey maps, its ellipsoidal shape is taken into account. However, for web applications, the additional computation is a disadvantage. Thus, an approximation called the Web Mercator projection is used. The Earth is approximately an oblate spheroid, flattened at the poles [see Earth’s Shape and Spin Won’t Make You Thin. The use of a spheroid as a base for the map allows for the slight polar flattening, which makes the Earth more like an orange than a lemon.

For the Mercator projection, the transformation of coordinates from latitude and longitude ${(\lambda,\phi)}$ to map easting and northing coordinates ${(x,y)}$ is

$\displaystyle \begin{array}{rcl} x &=& a\lambda \\ y &=& a \log\left[\tan\left(\frac{\phi}{2}+\frac{\pi}{4}\right) \left(\frac{1-e\sin\phi}{1+e\sin\phi}\right)^{e/2}\right] \\ &=& a \tanh^{-1}(\sin\phi) - ae \tanh^{-1}(e\sin\phi) \end{array}$

where ${e}$ is the eccentricity. The map scale factor is ${h=\sqrt{1-e^2\sin^2\phi}/\cos\phi}$. The Earth’s radius is ${a=6,378,137\,}$m and its eccentricity is ${e=8.1819\times10^{-2}}$

The Web Mercator (WM) projection

Web Mercator (WM) is a variant of the standard ellipsoidal or spheroidal Mercator projection, and has become the de facto standard for application on the world wide web. It is used by leading providers of online maps, like Google Maps, Bing Maps and OpenStreetMap. It has a number of alternative names, including the Google projection and the spherical Mercator projection.

Web Mercator is the same as the standard Mercator except for the omission of terms involving the Earth’s eccentricity. Thus, it treats Earth as a perfect sphere, ignoring the flattening towards the poles. The underlying geographic coordinates are used (allowing for eccentricity), but projected as if the Earth were a perfect sphere. The benefit is a great reduction in computation as the transformation formulae are much simplified.

Putting ${e=0}$ in the above transformations, the WM coordinates of a point with longitude and latitude ${(\lambda,\phi)}$, on a ${256\times256}$ grid are

$\displaystyle \begin{array}{rcl} x &=& 128 \left( 1 + \frac{\lambda}{\pi} \right)\,, \quad - \pi \le \lambda < \pi \\ y &=& 128 \left[ 1 - \log\left(\tan \left( \frac{\phi}{2}+\frac{\pi}{4} \right) \right) \right]\,, \quad -\frac{\pi}{2}\le \phi < \frac{\pi}{2} \,. \end{array}$

where ${x}$ and ${y}$ are in pixels. At the equator, ${y = 128}$. On the prime meridian, ${x = 128}$. The map scale factor is ${h=\sec\phi}$. Because the Mercator projects the poles to infinity, WM cannot show the poles. Google Maps cuts off coverage at 85.05º north and south, such that the world map is square.

Web Mercator projection of the world [from maps.google.com].

Errors in WM

For most purposes, the errors in WM are negligible, but they become pronounced in high latitudes. The discrepancy in position can be significant relative to the more accurate Mercator projection. The approximations also mean that WM is not precisely conformal. The US Department of Defense has stated that WM is not sufficiently accurate for official use. All GPS positions use WGS84 coordinates. The errors become apparent when GPS data is overlaid on a WM map. Then discrepancies of more than 40 km can occur. The illustration below is from a recent report of the National Geospatial Intelligence Agency:

Example of overlaying Ellipsoidal Mercator (blue) and Web Mercator (red). [Image from National Geospatial Intelligence Agency Report, 2014]

Conclusions

The distortion in the standard Mercator projection at high latitudes has caused some cartographers to vilify it. It gives undue prominence to geographical regions at high latitudes and, in relative terms, greatly diminishes the size of tropical regions in Africa, South America and South-East Asia, creating a seriously flawed impression of the sizes of the continents.

Mercator was on the way out until, about a decade ago, a modified version of it (WM) became the standard for web maps. It was considered a “good enough compromise” and quickly gained wide acceptance. It has some significant advantages; for example, it allows continuous panning and zooming at all locations and scales, and it is not too computationally demanding. It is excellent for most web applications, but not for high-precision work.

Sources

“WGS 84 and the Web Mercator Projection NGA Office of Geomatics” ( PDF ). National Geospatial Intelligence Agency. 2014-05-16.