- Categories:
ST_AREA¶
Returns the area in square meters of the polygon(s) in a GEOGRAPHY object.
Syntax¶
ST_AREA( <geography_expression> )
Arguments¶
geography_expression
The argument must be of type GEOGRAPHY.
Returns¶
Returns a REAL value, which represents the area in square meters.
Usage Notes¶
If
geography_expression
is not a Polygon, MultiPolygon, or GeometryCollection containing polygons, ST_AREA returns 0.If
geography_expression
is a GeometryCollection, ST_AREA returns the sum of the areas of the polygons in the collection.
Examples¶
This uses the ST_AREA function to calculate the area of Earth’s surface 1 degree on each side with the bottom of the area on the equator:
SELECT ST_LENGTH(TO_GEOGRAPHY('LineString(0 0, 0 1)')) AS height, ST_LENGTH(TO_GEOGRAPHY('LineString(0 0, 1 0)')) AS width, ST_LENGTH(TO_GEOGRAPHY('LineString(0 0, 0 1)')) * ST_LENGTH(TO_GEOGRAPHY('LineString(0 0, 1 0)')) AS height_times_width, ST_AREA(TO_GEOGRAPHY('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))')) AS area; +------------------+------------------+--------------------+------------------+ | HEIGHT | WIDTH | HEIGHT_TIMES_WIDTH | AREA | |------------------+------------------+--------------------+------------------| | 111195.101177484 | 111195.101177484 | 12364350525.8709 | 12364036567.0764 | +------------------+------------------+--------------------+------------------+