0

I've been doing tests between projections with Postgis 2.3 and I was surprised by the result of the ST_area function with the Web Mercator projection (3857).

Here is a sample query and result on a PostgreSQL 9.6 database and Postgis 2.3 :

SELECT code,
       name,
       st_area(geom_wgs84::geography))/1000000 AS surface_km2_4326,
       st_area(st_transform(geom_wgs84,2154))/1000000 AS surface_km2_2154,
       st_area(st_transform(geom_wgs84,3857))/1000000 AS surface_km2_3857
FROM communes_www
WHERE numero = '45234'

Here is the result for the city of Orléans, France :

CODE    NAME      surface_km2_4326      surface_km2_2154    surface_km2_3857
------------------------------------------------------------------------------
45234   ORLEANS   27.624689491386977    27.587944000075932  61.377449120370805

As you can see, the area for projections 4326 and 2154 are correct, but the surface for 3857 is completely off.

Is this a bug in Postgis or am I doing something wrong ?

2
  • 5
    That is because 3857 is not an area preserving projection so it gets progressively more wrong the further north or south of the Equator. France is about half as bad as it could get (look at Greenland).
    – Ian Turton
    Commented Sep 4, 2018 at 14:19
  • 4
    ...to be a little more dramatic: EPSG:3857 is unsuitable for basically everything concerning cartographic analysis. it was designed for Googles map service, and a standard tile service is about the only place where you want to use it.
    – geozelot
    Commented Sep 4, 2018 at 14:34

1 Answer 1

4

@ThingumaBob mentioned that it is the projection used in many popular web mapping applications (Google/Bing/OpenStreetMap/etc). Sometimes also known as EPSG:900913.

EPSG 4326 uses a coordinate system the same as a Globe (curved surface) but EPSG 3857 uses a coordinate system the same as a MAP (flat surface).

ESPG 4326(WGS 84 ):The World Geodetic System of 1984 is the geographic coordinate system (the three-dimensional one) used by GPS to express locations on the earth. WGS84 is the defined coordinate system for GeoJSON, as longitude and latitude in decimal degrees. For the most part, when you describe a lon/lat coordinate location, it’s based on the EPSG:4326 coordinate system. This is how we store data at Mapbox.

There is no way to visualize the WGS84 coordinate system on a two-dimensional plane (map), so most software programs project these coordinates using an equirectangular projection (Plate-Carrée) (Esri uses EPSG:54001).

EPSG:3857 (Pseudo-Mercator): The projected Pseudo-Mercator coordinate system takes the WGS84 coordinate system and projects it onto a square. (This projection is also called Spherical Mercator or Web Mercator.) But not all of it – the bounds of Pseudo-Mercator are limited to approximately 85.06º North and South latitude. This projection was first introduced by Google and is used in almost 100% of web maps, but it’s a strange one: the projection uses the WGS84 coordinate system, which uses the WGS84 ellipsoid, but projects the coordinates onto a sphere.

This method results in a square-shaped map (which computers really want) but there is no way to programmatically represent a coordinate system that relies on two different ellipsoids, which means software programs have to improvise. And when software programs improvise, there is no way to know if the coordinates are consistent across programs. This makes EPSG:3857 great for visualizing on computers but not reliable for data storage or analysis.

For the most part, web maps rely on data stored with WGS84 coordinates (in some programs this is called “unprojected” data) and then visualize the data using Pseudo-Mercator.

https://alastaira.wordpress.com/2011/01/23/the-google-maps-bing-maps-spherical-mercator-projection/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.