Skip to content

Latest commit

 

History

History
64 lines (48 loc) · 1.94 KB

starea-geometry-data-type.md

File metadata and controls

64 lines (48 loc) · 1.94 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs monikerRange
STArea (geometry Data Type)
STArea (geometry Data Type)
MladjoA
mlandzic
03/14/2017
sql
t-sql
reference
STArea (geometry Data Type)
STArea_TSQL
STArea (geometry Data Type)
TSQL
=azuresqldb-current||>=sql-server-2016||>=sql-server-linux-2017||=azuresqldb-mi-current||=fabric

STArea (geometry Data Type)

[!INCLUDE SQL Server Azure SQL Database Azure SQL Managed Instance FabricSE FabricDW]

Returns the total surface area of a geometry instance.

Syntax

  
.STArea ( )  

[!INCLUDEsql-server-tsql-previous-offline-documentation]

Return Types

[!INCLUDEssNoVersion] return type: float

CLR return type: SqlDouble

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.

Examples

A. Computing the area of a Polygon instance

The following example creates a Polygon``geometry instance and computes the area of the polygon.

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();  

B. Computing the area of a CurvePolygon instance

The following example computes the area of a CurvePolygon instance.

 DECLARE @g geometry;  
 SET @g = geometry::Parse('CURVEPOLYGON(CIRCULARSTRING(0 2, 2 0, 4 2, 4 2, 0 2))');  
 SELECT @g.STArea() AS Area;

See Also

OGC Methods on Geometry Instances