# Calculating area of an EPSG:4326 Polygon [duplicate]

In our Postgres/Postgis database we store polygons in a column defined as lonlat/EPSG:4326, as it may contain data from anywhere in the world.

We have a requirement to calculate the surface area (i.e. in square meters or hectares). The method ST_Area can perform the calculation but returns the answer in the used coordinate systems units. That is, it returns the area as what I believe is "square degrees". As the size of a degree is variable depending on the location in the world, this does not make much sense.

One solution is to transform (ST_Transform) the polygon to another crs before calculating the area, perhaps the appropriate UTM32 zone, but that will require us to dynamically determine the zone first. Alternatively we could always transform to the Google Mercator (EPSG:900913), but we fear for the precision.

Any inputs?

• try `SELECT ST_Area(geom::geography)` May 30, 2012 at 19:40

I found a function to return the UTM zone for any point on the PostGIS wiki: utmzone()

Using that you could do:

``````SELECT
ST_Area(
ST_Transform(the_geom, utmzone(ST_Centroid(the_geom))
))
FROM polygons
WHERE...
``````

HTH, Micha

• Could you tell me what unit the result is? (km^2, or hecta, or m^2) Thanks! Dec 3, 2014 at 10:05
• The calculations of ST_Area (and other functions) will always be in the same units as the Coordinate System. The above refers to UTM, with units in meters, so the area will be sq meters. Dec 4, 2014 at 12:31