18

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?

enter image description here

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.

psmears
  • 109
  • 1
Dims
  • 571
  • 1
  • 6
  • 16
  • 3
    Do you doubt that the unit of measure is meters, or the extent of the projected bounds? – nmtoken Jun 02 '17 at 10:34
  • I don't understand, how is it projected. – Dims Jun 02 '17 at 11:37
  • 1
    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. – user30184 Jun 02 '17 at 12:01
  • 1
    @user30184 which implies, that statement, that EPSG:3857 is in meters is just FALSE. – Dims Jun 02 '17 at 12:26
  • 1
    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. – user30184 Jun 02 '17 at 15:03
  • @user30184 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? – Dims Jun 02 '17 at 17:40
  • 1
    Mercator is conformal, which maintains angles and shapes. That means the north-south extent is lengthed/distorted to match the east-west extent. – mkennedy Jun 02 '17 at 21:01

3 Answers3

23

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 limitation 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:3857? 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 progress through each successive 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).

EDIT (re comments):
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).

jdmcbr
  • 904
  • 1
  • 6
  • 10
MappaGnosis
  • 33,857
  • 2
  • 66
  • 129
  • 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 02 '17 at 11:36
  • I would not say 10 times error as "inaccurate", it is irrelevant. – Dims Jun 02 '17 at 11:55
  • 1
    How would your theory handle different pixel sizes? – user30184 Jun 02 '17 at 12:04
  • @user30184 who's theory: mine or @MappaGnosis? – Dims Jun 02 '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). – MappaGnosis Jun 02 '17 at 15:50
  • @MappaGnosis probably my misunderstanding was that I was thinking there is only one meter. But probably the point is there are two worlds: real Earth surface and Mercator world, which is a strip 2D space which width is 40,000 km and inifinite heigh. And meter is used in both worlds although 1 meter from one world can be projected onto million of kilometers in another. Okay. – Dims Jun 02 '17 at 18:04
  • Think that you have a round piece of rubber sheet and you stretch in into a square. What was originally 1 cm at the edge of the round sheet is longer in the square-stretched sheet. Would you say that you have different centimeters now, or would you say that you the square sheet is not the same as it used to be? What if you blow a balloon? – user30184 Jun 02 '17 at 20:19
  • @user30184 okay, then what is the reason to specify that unit is meter? imagine rubber sheet yourself: you can stretch it whatever you want (=all EPSG pages and more), and the meter will always be meter; why would someone specify it? – Dims Jun 03 '17 at 16:02
3

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
user30184
  • 65,331
  • 4
  • 65
  • 118
0

I can agree with the OP that the EPSG:3857 coordinate values are not in meters, except at the Equator. Of course, there are clear conversion rules to get the coordinates into ground truth meters. But in my opinion, that doesn't justify the claim of them being in meters. They could as well similarly be converted into Imperial units like feet or miles.

In my application, I need to convert EPSG:3857 coordinates into WGS84 (lat, long) in order to measure distances between coordinates using haversine formula. Instead, if EPSG:3857 would be in meters as such, the calculation would just be with Pythagorian sqrt(dx^2 + dy^2). - But that kind of coordinate system is actually not possible, as the Earth is a sphere.

Kadir Şahbaz
  • 76,800
  • 56
  • 247
  • 389
jarmniku
  • 1
  • 2