Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Possible Duplicate:
What is the most accurate coordinate system for calculating areas of polygons?

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?

share|improve this question
    
try SELECT ST_Area(geom::geography) –  Mike T May 30 '12 at 19:40
add comment

marked as duplicate by whuber May 30 '12 at 15:11

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

up vote 3 down vote accepted

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

share|improve this answer
add comment

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