0

We are saving our drawn polygons in our database with the coordinate system 4326. The polygons drawn are all in Spain (where I came to find out the adequate coordinate system for Spain is EPSG:2062).

This been said, which one will calculate with more accuracy the area of the polygon?

"st_area(polygon)" or "ST_area(ST_Transform(polygon::geometry, 2062))"?

I know that using the one related to my country will give me (in theory) the most accurate results/georeferencing, but is it really true? Also, and since we are drawing in a map that only supports 4326, will we have a more accurate calculated area by converting the coordinate system and calculating afterwards, or should we calculate the area with the current coordinate system?

5
  • The ST_Area() call won't work unless the polygon is in geography. Have you tried a systematic comparison in four or five valid projections, to determine the difference, then chosen a selection of features for further evaluation? Without detailed information of the geometries involved (including numbers of vertices and precision and accuracy of the sources), there's no way to make a determination of which is more accurate.
    – Vince
    Feb 15, 2021 at 20:25
  • Do you want to know the area in the map, or the area in reality?
    – CL.
    Feb 16, 2021 at 10:37
  • @Vince postgis.net/docs/ST_Area.html Says here that can also accept geometry, where a "2D Cartesian (planar) area is computed, with units specified by the SRID". Still, i think i'm not working with number of precision or anything. We just have an web application where we have a map and allow users to draw polygons and save them in database using geoserver.
    – tester_sig
    Feb 16, 2021 at 10:39
  • @CL. I want to know the area in reality, not the map. The map is just an helper for the users to geoferecence their polygon.
    – tester_sig
    Feb 16, 2021 at 10:41
  • 1
    If your SRID is 4326, and your type is geometry the result is square Cartesian degrees, which is useless. The inaccuracies introduced by either geodesic or projected area calculation are three to five orders of magnitude less significant than your vertex collection precision.
    – Vince
    Feb 16, 2021 at 13:03

1 Answer 1

1

When you calculate the area of a geometry with SRID 4326 (ST_Area(polygon::geometry)), the implied projection is plate carrée, which has large distortions the farther away you are from the equator.

When you calculate the area of a geography object (ST_Area(polygon::geography)), the calculation takes the curvature of the earth's surface into account, which is the most correct method. This is complex and slow, but for polygons drawn by hand, the user is slower anyway.

When you calculate the area in SRID 2062 (ST_Area(ST_Transform(polygon::geometry, 2062))), you get the area of a flat polygon in that projection. This will introduce small errors, but those are probably too small to matter.

For calculating the area in 2D, you should use an equal-area projection (such as SRID 3035), which makes the area correct at the cost of distorting the shape. This does not matter if you do not use this projection for drawing. (If you care, you have to test yourself whether the transformation to 3035 or the ST_Area on a geography object is faster.)

1
  • Your first paragraph implies that the Cartesian area in decimal degrees has value anywhere. It doesn't.
    – Vince
    Feb 16, 2021 at 12:59

Your Answer

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

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