# How to calculate polygon area considering slopes?

I am looking for an accurate algorithm or a service to calculate surface area on earth where points are calculated on the basis of GPS Coordinates.

I am using Google Map Api version 3 and are drawing polygons based on recorded coordinates but I don't think the standard ways of calculating area of the polygon will take into account of slopes(hills). Do I need to work on contours for such thing?

Are there any third party services may be ArcGis or some other that takes into account of slopes as well

• Not only are slopes not taken into account, but you must also consider that you cannot calculate areas based on decimal degrees (i.e. standard coordinate measurements) at all, since one degree of latitude is different from one degree of longitude, and a degree of longitude is a different length near the equator than it is near the poles. The coordinates will need to be projected into UTM or similar to obtain accurate area measurements. Jan 29, 2012 at 18:58
• @nmpeterson: well I guess that should apply for large areas. I am working on areas of not more than 1sq mile. Not sure about the error percentage by calculating using google.maps.geometry.spherical.computeArea(yourPolygon.getPath()); Jan 30, 2012 at 19:21
• Since Google has a method for it, it should be fine. I thought you intended to calculate the area yourself based on coordinates in degrees, and wanted to point out that 1 square-degree is not a meaningful measurement of area. Jan 30, 2012 at 19:38

Obviously, you need a digital elevation model in order to account for the slopes. One convenient form is a gridded DEM, because with it you can obtain the area as follows:

1. Compute the slope grid.

2. Calculate the secants of the slopes (these are the reciprocals of the cosines).

3. Obtain the zonal average of those secants, using the polygon(s) as zones.

4. Multiply each polygon's nominal (planar or spherical) area by the mean secant slope obtained in the previous step.

This works because it amounts to finding the area subtended by the surface over each grid cell within a polygon. That area equals the cell area multiplied by the secant of the slope. The workflow outlined here is a straightforward way to get all those areas at once and add them up. It gives you the flexibility to compute the nominal polygon areas as accurately as you want; any error from the discrete gridded representation of the slopes principally affects the mean secants. The biggest error will be due to imprecision in the DEM itself. For a (brief) discussion of how scale affects the accuracy of slopes, see How to Calculate Average Slope in a Grid.

This work can be done in any GIS that supports a small amount of "map algebra." In addition to commercial offerings like ArcGIS (+Spatial Analyst), Idrisi, and Manifold, you can use open-source solutions like GRASS or R. It's not hard to code these grid operations yourself in some lower-level language, either, such as Python, C, or Fortran.