ST_Area()¶
Returns a polygonal geometry’s area: Cartesian square units by default, or square meters for SRID 4326.
Syntax¶
ST_Area(geom)
ST_Area(geom, srid)
Aliases: none.
Arguments¶
geom is GEOMETRY or GEOMETRY32; srid is an INT64 computation override.
Return Value¶
Returns FLOAT64 for GEOMETRY and FLOAT32 for GEOMETRY32.
Usage Notes¶
Input must be POLYGON or MULTIPOLYGON; other geometry types are rejected. Interior rings reduce the area.
SRID 4326 uses geodesic square meters; other supported SRIDs use Cartesian square units. The optional SRID overrides the geometry SRID and is range-checked.
Examples¶
DROP DATABASE IF EXISTS geo_area_demo;
CREATE DATABASE geo_area_demo;
USE geo_area_demo;
SELECT ST_Area(ST_GeomFromText('POLYGON((0 0, 3 0, 3 4, 0 4, 0 0))')) AS cartesian_area,
ST_Area(ST_GeomFromText('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))'), 4326) AS geodesic_square_meters;
DROP DATABASE geo_area_demo;
See Also¶
ST_Length(), ST_Distance().