The POLY_AREA function returns the area of a polygon given the coordinates of its vertices.

It is assumed that the polygon has n vertices with n sides and the edges connect the vertices in the order:

[(x1,y1), (x2,y2), ... , (xn,yn), (x1,y1)]

such that the last vertex is connected to the first vertex.

This routine is written in the IDL language. Its source code can be found in the file in the lib subdirectory of the IDL distribution.


Result = POLY_AREA( X, Y [, /DOUBLE] [, /SIGNED] )

Return Value

If either of the input arguments is double-precision or if the DOUBLE keyword is set, the result is a double-precision value, otherwise, the result is single-precision.



An n-element vector of X coordinate locations for the vertices.


An n-element vector of Y coordinate locations for the vertices.



Set this keyword to use double-precision for computations and to return a double-precision result. Explicitly set DOUBLE=0 to use single-precision for computations and to return a single-precision result. By default, if either of the arguments to POLY_AREA is double-precision, computations are done in double-precision; if both arguments are single-precision, computations are done in single-precision.


If set, returns a signed area. Polygons with edges traversed in counterclockwise order have a positive area; polygons traversed in the clockwise order have a negative area.

Version History



See Also