Returns the area of the Polygon(s) in a GEOGRAPHY or GEOMETRY object.
Syntax¶ST_AREA( <geography_or_geometry_expression> )
Copy
Arguments¶geography_or_geometry_expression
The argument must be of type GEOGRAPHY or GEOMETRY.
Returns a REAL value, which represents the area:
For GEOGRAPHY input values, the area is in square meters.
For GEOMETRY input values, the area is computed with the same units used to define the input coordinates.
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.
This uses the ST_AREA function with GEOGRAPHY objects to calculate the area of Earth’s surface 1 degree on each side with the bottom of the area on the equator:
GEOMETRY examples¶SELECT ST_AREA(TO_GEOGRAPHY('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))')) AS area; +------------------+ | AREA | |------------------| | 12364036567.0764 | +------------------+Copy
The following example calls the ST_AREA function with GEOMETRY objects that represent a Point, LineString, and Polygon.
SELECT ST_AREA(g), ST_ASWKT(g) FROM (SELECT TO_GEOMETRY(column1) as g from values ('POINT(1 1)'), ('LINESTRING(0 0, 1 1)'), ('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))'));Copy
+------------+--------------------------------+ | ST_AREA(G) | ST_ASWKT(G) | |------------+--------------------------------| | 0 | POINT(1 1) | | 0 | LINESTRING(0 0,1 1) | | 1 | POLYGON((0 0,0 1,1 1,1 0,0 0)) | +------------+--------------------------------+Copy
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4