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?
|
PostGIS 1.5 introduced a new GEOGRAPHY type. The
The following query outputs the area of all polygons using the spheroid (currently only the
The algorithm used to calculate area on a spheroid can be derived from the source-code. |
||||
|
Here's a link to some code that'll yield the area of a simple polygon (originally from the World Wind Forum): http://forum.worldwindcentral.com/showthread.php?t=20724. This solves the problem on a sphere, roughly based on the relationship:
S = area of polygon; theta is the sum of interior angles in radians; n is the number of vertices; r is the radius of the sphere. See also (source of formula image): http://www.geom.uiuc.edu/docs/reference/CRC-formulas/node59.html I would be delighted to see links and/or code for polygon area on an oblate spheroid. |
|||||||||
|
|
You'll need to convert your geographic coordinates into a projection that has a coordinate system that allows you to use Cartesian math to calculate area. I believe UTM is the accepted standard projection, as it is very simple to select a zone based on your latitude and longitude, and also the distortion is minimal, even across zones. So, if you have a polygon the size of Texas, you can use UTM Zone 14 N and it will still be fairly accurate. If your polygons are over the North or South pole, then you should use UPS instead, as the UTM projections are less accurate over the poles, and you will quickly traverse them as the boundaries get smaller (since they follow lines of longitude) Once your points are in a Cartesian-friendly coordinate system, you can treat them like polygons on a grid and calculate area. |
|||
|
|
|
Here's the source for the simplified calculation that we make in OpenLayers. This method comes from "Some Algorithms for Polygons on a Sphere" (Robert. G. Chamberlain and William H. Duquette, NASA JPL Publication 07-03). The code linked to above is for determining the area of a linear ring (with geographic coordinates). Areas for Polygons and MultiPolygons are summed up from the rings.
Ring components are two element arrays of x, y (lon, lat) coords in the above code. The OpenLayers.Util.rad method just converts degrees to radians (deg * PI / 180). |
|||
|
|
|
A PolygonArea class was added to GeographicLib in 2011-07. This computes the true ellipsoidal area of a polygon whose edges are geodesics. Unlike PostGIS, The method does not entail numerical integration. For documenation (and a link to the paper where the formulas are derived), see http://geographiclib.sf.net/html/classGeographicLib_1_1PolygonArea.html |
|||
|
|
