STOverlaps (geography Data Type)
Applies to: SQL Server Azure SQL Database Azure SQL Managed Instance
Returns 1 if a geography instance spatially overlaps another geography instance, or 0 if it does not.
Syntax
.STOverlaps ( other_geography )
Note
To view Transact-SQL syntax for SQL Server 2014 (12.x) and earlier versions, see Previous versions documentation.
Arguments
other_geography
Is another geography instance to compare against the instance on which STOverlaps()
is invoked.
Return Types
SQL Server return type: bit
CLR return type: SqlBoolean
Remarks
This method always returns null if the spatial reference IDs (SRIDs) of the geography instances do not match.
Examples
The following example uses STOverlaps()
to test two geography instances for overlap.
DECLARE @g geography;
DECLARE @h geography;
SET @g = geography::Parse('POLYGON ((-120.533 46.566, -118.283 46.1, -122.3 47.45, -120.533 46.566))');
SET @h = geography::Parse('CURVEPOLYGON (COMPOUNDCURVE (CIRCULARSTRING (-122.200928 47.454094, -122.810669 47.00648, -122.942505 46.687131, -121.14624 45.786679, -119.119263 46.183634), (-119.119263 46.183634, -119.273071 47.107523), CIRCULARSTRING (-119.273071 47.107523, -120.640869 47.569114, -122.200928 47.454094)))');
SELECT @g.STOverlaps(@h);
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