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.

I have a table with polygons in EPSG 4326. These polygons are distributed all over the world, for example:

POLYGON((10.7324632658845 59.9253049236956,10.7331908150806 59.9244876816042,10.7342435821189 59.9247242537529,10.7335237442742 59.9255414900176,10.7324632658845 59.9253049236956))

Now I'd like to get the areas of these polygons in square meters. With ST_Area(the_geom) I get the area in square degrees, right? So I have to do something with ST_Transform. I got a good result for the above mentioned polygon with the following transformation:

ST_AREA(ST_Transform(ST_GeomFromText(the_geom,4326),31467))

However, the calculation (of course) fails when calculating the area of a polygon outside of the coverage of EPSG 31467 (Fatal error...).

Is there a "universal" area accurate projection for this purpose? Or do I have to check the location of every polygon and individually apply a suitable projection to calculate its area properly?

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

As alluded to in this previous answer, the ST_GeogFromText method will create a geography data type. This method expects your input data to be in 4326 (a geographic coordinate system) and measurements on this type are in meters. This will work world-wide. Here's an example:

SELECT
ST_Area(
    ST_GeogFromText(
        'POLYGON((10.7324632658845 59.9253049236956,10.7331908150806 59.9244876816042,10.7342435821189 59.9247242537529,10.7335237442742 59.9255414900176,10.7324632658845 59.9253049236956))'
    )
)

The 31467 projection uses a projected coordinate system that is only defined for a portion of Germany (and small parts of France, Austria and Switzerland). That's why you get an error when transforming data from another region into this projection (of course!).

share|improve this answer
    
Thanks again, katahdin! –  Mark Dec 30 '12 at 13:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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