STConvexHull (geography Data Type)
Applies to: SQL Server Azure SQL Database Azure SQL Managed Instance
Returns an object that represents the convex hull of a geography instance.
Syntax
.STConvexHull ( )
Note
To view Transact-SQL syntax for SQL Server 2014 (12.x) and earlier versions, see Previous versions documentation.
Return Types
SQL Server return type: geography
CLR return type: SqlGeography
Remarks
Returns a FullGlobe
object for geography instance which has an envelope angle larger than 90 degrees.
Returns an empty geography collection for an empty geography instance.
Returns null for an uninitialized geography instance.
Examples
A. Using STConvexHull() on an uninitialized geography instance
The following example uses STConvexHull()
on an uninitialized geography instance.
DECLARE @g geography;
SELECT @g.STConvexHull();
B. Using STConvexHull on an empty geography instance
The following example uses STConvexHull()
on an empty Polygon
instance.
DECLARE @g geography = 'POLYGON EMPTY';
SELECT @g.STConvexHull().ToString();
C. Finding the convex hull of a non-convex Polygon instance
The following example uses STConvexHull()
to find the convex hull of a non-convex Polygon
instance.
DECLARE @g geography;
SET @g = geography::Parse('POLYGON((-120.533 46.566, -118.283 46.1, -122.3 47.45, -120.533 46.566))');
SELECT @g.STConvexHull().ToString();
D. Finding the convex hull on a geography instance with an envelope angle larger than 90 degrees
The following example uses STConvexHull()
on a geography instance with an envelope angle larger than 90 degrees.
DECLARE @g geography = 'POLYGON((20.533 46.566, -18.283 46.1, -22.3 47.45, 20.533 46.566))';
SELECT @g.STConvexHull().ToString();
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for