FAQ: What algorithm is used by ArcGIS for Desktop to determine the area of a polygon?
What algorithm is used by ArcGIS for Desktop to determine the area of a polygon?
The algorithm used in ArcGIS to calculate the area of a polygon is called 'Area Calculation by Gauss'. Esri uses a normalized form of it to preserve numeric precision. This is a common algorithm.
The algorithm calculates the area for each ring (part) in a polygon. If the ring is clockwise (outer ring) the area is positive, and if the ring is counterclockwise (inner ring) the value will be negative.
A partial sum of a trapezoid's area is used where:
cPoints - Number of points in the ring
points - Array of point structure, the structure as X and Y as attributes
yOrigin - Double equal to the Y value of the last point (cpoints-1)
The first trapezoid's area is:
For each point starting at index 1:
partialSums[j] = (points[j+1].x - points[j-1].x) * (points[j].y - yOrigin)
If the ring contains non-linear segments, such as Circular Arc, Elliptic Arc, and Bezier Curve, a correction of the area is applied for each trapezoid.
The final area of the ring is:
The final area of the polygon is:
Here is an example with the following points (one square ring) zz:
X0 = 0 ; Y0 = 0
X1 = 0 ; Y1 = 10
X2 = 10 ; Y2 = 10
X3 = 10 ; Y3 = 0
X4 = 0 ; Y4 = 0
partialSums(0) = (X0 - X4) * (Y0 - Y4) = (0 - 0) * (0 - 0) = 0
partialSums(1) = (X2 - X0) * (Y1 - Y4) = (10 - 0) * (10 - 0) = 100
partialSums(2) = (X3 - X1) * (Y2 - Y4) = (10 - 0) * (10 - 0) = 100
partialSums(3) = (X4 - X2) * (Y3 - Y4) = (0 - 10) * (0 - 0) = 0
There is no correction to apply in this case because only lines are used.
For ArcObjects developers, area is defined as IArea::Area.