ST_AREA()
All functions > GEOSPATIAL > ST_AREA()
Returns the area of a geometry or geography.
Signatures
Area
Returns: Area of the input
ST_AREA(geo: T) → DOUBLE sql
| Parameter | Type | Required | Description |
|---|---|---|---|
geo | T | Yes | Geometry or geography value |
With:
T: Custom types: GEOM_POINT | GEOM_LINESTRING | GEOM_POLYGON | GEOM_MULTIPOINT | GEOM_MULTILINESTRING | GEOM_MULTIPOLYGON | GEOM_MULTIANY | GEOG_POINT | GEOG_LINESTRING | GEOG_POLYGON | GEOG_MULTIPOINT | GEOG_MULTILINESTRING | GEOG_MULTIPOLYGON | GEOG_MULTIANY
Signature notes:
- On GEOMETRY: returns planar area in SRID coordinate units squared
- On GEOGRAPHY: returns the area in square meters on a sphere of radius 6 371 008.8 m (the mean Earth radius), with great-circle edges; this differs from the WGS84 ellipsoid by up to about 0.5 %
- On GEOGRAPHY, Postgres refuses: the spherical area of PostGIS is not on this sphere
- Returns 0.0 for Point, LineString, MultiPoint, and MultiLineString (not NULL)
- On GeometryCollection: returns the sum of areas of areal children
- Returns NULL if the input is NULL
Availability
| Status | Backends |
|---|---|
| Not available | clickhouse, mysql |
Examples
Geometry (planar area)
FeatureQL
RETURN
-- Area of a 10x10 square
f1 := ST_AREA(ST_GEOMFROMTEXT('POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))'))
;Result
| f1 DECIMAL |
|---|
| 100.0 |
Geography (area in square meters)
FeatureQL
RETURN
-- Area of a point is 0
f1 := ST_AREA(ST_GEOMPOINT(1.0, 2.0))
;Result
| f1 DECIMAL |
|---|
| 0.0 |