| title | STConvexHull (geometry Data Type) | ||
|---|---|---|---|
| description | STConvexHull (geometry Data Type) | ||
| author | MladjoA | ||
| ms.author | mlandzic | ||
| ms.date | 08/03/2017 | ||
| ms.service | sql | ||
| ms.subservice | t-sql | ||
| ms.topic | reference | ||
| ms.custom |
|
||
| f1_keywords |
|
||
| helpviewer_keywords |
|
||
| dev_langs |
|
||
| monikerRange | =azuresqldb-current || >=sql-server-2016 || >=sql-server-linux-2017 || =azuresqldb-mi-current || =fabric-sqldb |
[!INCLUDE SQL Server Azure SQL Database Azure SQL Managed Instance FabricSQLDB]
Returns an object representing the convex hull of a geometry instance.
.STConvexHull ( )
[!INCLUDEssNoVersion] return type: geometry
CLR return type: SqlGeometry
STConvexHull() returns the smallest convex polygon that contains the given geometry instance. Points or co-linear LineString instances will produce an instance of the same type as that of the input.
The following example uses STConvexHull() to find the convex hull of a non-convex Polygon``geometry instance.
DECLARE @g geometry;
SET @g = geometry::STGeomFromText('POLYGON((0 0, 0 2, 1 1, 2 2, 2 0, 0 0))', 0);
SELECT @g.STConvexHull().ToString();