STArea (geography Data Type)

Applies to: SQL Server Azure SQL Database Azure SQL Managed Instance

Returns the total surface area of a geography instance. Results for STArea() are the squared unit of measure used by the geography instance's spatial reference identifier. For example, if the SRID of the instance is 4326, STArea() returns results in square meters.

Syntax

  
.STArea ( )  

Return Types

SQL Server return type: float

CLR return type: SqlDouble

Remarks

STArea() returns 0 if a geography instance contains only zero- and one-dimensional figures, or if it's empty.

Note

Methods on the geography data type that produce a metric return value will have different results based on the SRID of the instance used in the method. For more information on SRIDs, see Spatial Reference Identifiers (SRIDs).

Examples

The following example uses STArea() to create a Polygon geography instance and computes the area of the polygon.

DECLARE @g geography;  
SET @g = geography::STGeomFromText('POLYGON((-122.358 47.653, -122.348 47.649, -122.348 47.658, -122.358 47.658, -122.358 47.653))', 4326);  
SELECT @g.STArea();  

See Also

OGC Methods on Geography Instances