Frequently asked question

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:

partialSums[0] - Array of double

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)

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:

partialSums[0] = (points[1].x - points[cPoints-1].x) * (points[0].y - yOrigin)

For each point starting at index 1:

for j = 1 to j < cPoints-1

partialSums[j] = (points[j+1].x - points[j-1].x) * (points[j].y - yOrigin)

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:

SUM(PartialSums)/2

The final area of the polygon is:

SUM(Area of each ring)

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.

sum (partialSums)/2 = 200/2 = 100

Note:

For ArcObjects developers, area is defined as IArea::Area.

Get help from ArcGIS experts

Download the Esri Support App