ST_Area

Determine the surface area of a geometry.

This function returns the surface area of a polygon, multipolygon, or geometry collection that is in WKB format.

  • If Cartesian coordinates are used, this function returns an accurate value.
  • If spherical coordinates are used, the area is calculated by dividing the geometry into spherical triangles and calculating their areas using spherical excess (Huiller's formula). It can handle geometries that cross the 180 meridian or contain the pole. In the spheroidal case, the geometry is projected into a Cartesian coordinate system using a Behrmann equal area projection, and its area is calculated in the same way as in the Cartesian case.

Syntax

ST_Area(geo[, unit[, cSys]]);
geo
The input geometry.

Type: VARCHAR(ANY)

unit
The units (squared) of the output area. Possible values include 'meter', 'kilometer', 'foot', 'mile', and 'nautical mile'.

Type: VARCHAR(ANY)

Default: 'meter'

cSys
The coordinate system of the input geometry.

Type: VARCHAR(ANY)

Default: The coordinate system of the input geometry's SRID or, if the input geometry has no SRID, 'WGS84'.

Returns

A value of type DOUBLE that contains the area of the input geometry.

Examples

SELECT inza..ST_Area(inza..ST_WKTToSQL('POLYGON((1 1, 1 2, 2 2, 2 1, 1 1))', 1234));

ST_AREA
---------
1
(1 row)
SELECT inza..ST_Area(inza..ST_WKTToSQL('POLYGON((1 1, 1 2, 2 2, 2 1, 1 1))', 1111));

ST_AREA
---------
12367196844.731
(1 row)
SELECT inza..ST_Area(inza..ST_WKTToSQL('POLYGON((1 1, 1 2, 2 2, 2 1, 1 1))', 4326));

ST_AREA
---------
12304814950.073
(1 row)
SELECT inza..ST_Area(inza..ST_WKTToSQL('POLYGON((1 1, 1 2, 2 2, 2 1, 1 1))', 1234), 'foot');
ST_AREA
---------
10.76391041671
(1 row)
SELECT inza..ST_Area(inza..ST_WKTToSQL('POLYGON((1 1, 1 2, 2 2, 2 1, 1 1))', 1234), 'meter', 'sphere');

ST_AREA
---------
12367196844.731
(1 row)
SELECT inza..ST_Area(inza..ST_WKTToSQL('POLYGON((1 1, 1 2, 2 2, 2 1, 1 1))'), 'meter', 1111);

ST_AREA
---------
12367196844.731
(1 row)