# How can EPSG:3857 be in meters?

It is said that unit of measure for EPSG:3857 is the metre.

How it can be, if the range of these coordinates is

Projected bounds:
-20,026,376.39 -20,048,966.10
20,026,376.39 20,048,966.10


(from the same source).

This means approximately a square of 40,000 x 40,000 kilometers. This length is correct for the equator, but how can it be in general if the circumference at high latitudes is smaller?

UPDATE

The length of the parallel at latitude 85.06 is

$R_earth * cos(85.06) * 2 * \pi$ = 3454 kilometers and it is << 40000

My question is: is this parallel projected onto the entire upper edge of the 40000 x 40000 square or onto part of it 3453m long?

In the first case the unit of measure IS NOT METRES, since it varies from metres at the origin to 3453/40000 = 9 centimeters at parallel 85.05.

• Do you doubt that the unit of measure is meters, or the extent of the projected bounds? Jun 2 '17 at 10:34
• I don't understand, how is it projected.
– Dims
Jun 2 '17 at 11:37
• 3454 meters are projected into full width as it were 40000 meters. Because of projection error those projected meters are very far from ground truth meters. Jun 2 '17 at 12:01
• @user30184 which implies, that statement, that EPSG:3857 is in meters is just FALSE.
– Dims
Jun 2 '17 at 12:26
• It is true that near the poles length measurements in EPSG:3857 give results which do not match at all with ground truth. That is because of distortion in the transformation. However, projections have well defined mathematics for forward/backward transformations and you can trust that meter is the right unit and that pixel is not a unit at all. All projected coordinate systems have the same behavious with distance measured from the map not being the same as distance along the ellipsoid's surface but usually the difference is not that big. Jun 2 '17 at 15:03

It is a projection of a spheroid on a flat surface. Every projection has strengths and weaknesses and will preserve some elements of direction, distance or area better or worse than others (which is why careful selection of a suitable, that is local where possible, projection is so important).

So, while the unit of measurement in EPSG:3857 is indeed meters, as you have correctly spotted, distance measurements become increasingly inaccurate away from the equator. All Mercator-style projections have the same defect as they move away from their reference point. But, where they are not global, the error can be minimized by appropriate positioning of this point. It is for this reason there are so many UTM zones for instance. Other projections have different strengths and weaknesses depending on use (e.g. navigation vs cartography).

So what's the point of EPSG:3875? To understand that, you must understand that it was designed for web mapping and is square so that the map tiles fit nicely into a powers-of-two schema as you prgress through each sucessive zoom-level. This is EPSG:3857's particular strength. It is not designed for distance and area calculations. There are many much better alternatives. If you are not using the data for web mapping, I would strongly encourage you to consider some other projection that is more suitable to your use-case, especially if you intend to do distance calculations (or, in that event, cast your data in geographic coordinates and not Cartesian coordinates and use the Haversine formula to calculate distances on a sphere).

The diagram added to the OP's question basically is a diagram of my first paragraph, viz that the project introduces distortion. For more information on how the Earth is projected in this case see here. The unit of measurement for Web Mercator is NOT pixels but meters. The OP's question results from a misunderstanding. Vector data can also be projected in Web Mercator. In this case there are no pixels. So you see, the concept of a unit of measurement as pixels has no relationship to the real world. However, pixels-per-meter is relevant for a raster as this tells us the resolution of the image. BUT the unit of measurement is still meters (in this case) and not pixels.

Where the confusion for the OP possibly arises is the use of Web Mercator at various zoom levels where tiles are usually set to be 256x256 pixels and a given zoom level has a certain nominal ground resolution, so some web mapping applications use screen pixels as a means of calculating distance. But, the pixels are interpreted as a meters-distance in relation to the zoom level (and possibly latitude).

• I understand all this but don't understand the answer. As far as I know, the unit of measurement of web mercator is pixel, not meter.
– Dims
Jun 2 '17 at 11:36
• I would not say 10 times error as "inaccurate", it is irrelevant.
– Dims
Jun 2 '17 at 11:55
• How would your theory handle different pixel sizes? Jun 2 '17 at 12:04
• @user30184 who's theory: mine or @MappaGnosis?
– Dims
Jun 2 '17 at 13:43
• @Dims, please see my edits and follow the link. The units definitely are meters and the discrepancy your diagram demonstrates is the result of projecting the Earth onto a cylinder that is then unwrapped to a flat map (other projections can work in different ways, but this is how the Mercator projection works). Jun 2 '17 at 15:50

There is a question in a comment "what is the distance between points (0; 20,000,000) and (0; 20,000,001)? Hint: it is one unit of x. Is it also 1 meter?"

The answer is Yes, the cartesian distance between those points is 1 meter.

Do you still consider that it is wrong? Do you expect that the correct answer is about 8.7 centimeters, which result you can get with this procedure:

Find the long/lat coordinates for the EPSG:3857 coordinates:

gdaltransform -s_srs epsg:3857 -t_srs epsg:4326
0 20000000
0 85.0219764762329 0
0 20000001
0 85.0219772557337 0


Insert the long/lat coordinates into the ST_Length example that is using geography type in http://postgis.net/docs/ST_Length.html

SELECT ST_Length(the_geog) As length_spheroid,  ST_Length(the_geog,false) As length_sphere
FROM (SELECT ST_GeographyFromText(
'SRID=4326;LINESTRING(0 85.0219764762329, 0 85.0219772557337)') As the_geog) as Foo;

Length_spheroid;length_sphere
0.0870589221287747;0.0866766564153779


The cartesian distance for the poins is 1 also for PostGIS

SELECT ST_Length(the_geom) As length
FROM (SELECT ST_GeomFromText(
'SRID=3857;LINESTRING(0 20000000, 0 20000001)') As the_geom) as Foo;

length
1