STArea (geography Data Type)
Applies to: SQL Server (all supported versions) 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.
.STArea ( )
To view Transact-SQL syntax for SQL Server 2014 and earlier, see Previous versions documentation.
SQL Server return type: float
CLR return type: SqlDouble
STArea() returns 0 if a geography instance contains only zero- and one-dimensional figures, or if it's empty.
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).
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();