GetPolygonArea()
Summary
Computes the area of a closed polygon.
Syntax
result = GetPolygonArea(array coords)
| Argument | Contents |
|---|---|
| coords | An array of coordinates that define an area |
Returns
A real number indicating the area of the polygon in map units.
Notes
-
The polygon is defined by an array of coordinates that begins and ends with the same point.
-
GetPolygonArea() handles only simple polygons. If the polygon is made up of separate islands or has holes, each island or hole must be treated as a separate polygon.
-
The area calculation is a spherical calculation that is performed on the surface of earth.
Example
// Use this code in a toolbox tool or the immediate execution
s = ClickShape()
a = GetPolygonArea(s)
ShowMessage("Your area is " + r2s(a) + " square " + GetMapUnits())
Error Codes
| Error Type | Meaning |
|---|---|
| Error | The polygon is invalid |
See Also
| Function | Summary |
|---|---|
| GetArea() | Gets the coordinates that describe an area feature |
| GetDistance() | Computes the great circle distance between two coordinates |
| GetFeatureArea() | Returns the area of the feature in current map units |