If I have polygons in geographic coordinates (WGS84), how do I measure the total area each takes on the surface of the earth, taking into account the curvature of the earth?
Answer
PostGIS 1.5 introduced a new GEOGRAPHY type. The GEOGRAPHY
type allows for unprojected coordinates on a spheroid to be stored in a PostGIS table, and some analysis functions to be performed upon them.
ST_Area
queries can be performed upon GEOGRAPHY type polygons in order to calculate their area in square meters.
The following query outputs the area of all polygons using the spheroid (currently only the WGS-84
spheroid is supported), assuming they are stored using the GEOGRAPHY
type:
SELECT ST_Area(the_geom) FROM table_of_polygons;
The algorithm used to calculate area on a spheroid can be derived from the source-code.
No comments:
Post a Comment