STArea (geometry)

STArea (geometry)#

Syntax#

.STArea ()

Return type#

float

Remarks#

STArea() returns 0 if a geometry instance contains only 0- and 1-dimensional figures, or if it is empty. STArea() returns NULL if the geometry instance has not been initialized.

Example#

Computing the area of a Polygon instance

DECLARE @g geometry;
SET @g = geometry::STGeomFromText('POLYGON((0 0, 3 0, 3 3, 0 3, 0 0),(2 2, 2 1, 1 1, 1 2, 2 2))', 0);
SELECT @g.STArea();

See Also#