Skip to content

Latest commit

 

History

History
85 lines (64 loc) · 3.18 KB

File metadata and controls

85 lines (64 loc) · 3.18 KB
title STIntersection (geography Data Type)
description STIntersection (geography Data Type)
author MladjoA
ms.author mlandzic
ms.date 03/14/2017
ms.service sql
ms.subservice t-sql
ms.topic reference
ms.custom
ignite-2024
f1_keywords
STIntersection_TSQL
STIntersection (geography Data Type)
helpviewer_keywords
STIntersection method
dev_langs
TSQL

STIntersection (geography Data Type)

[!INCLUDE SQL Server Azure SQL Database Azure SQL Managed Instance FabricSQLDB]

Returns an object that represents the points where a geography instance intersects another geography instance.

Syntax

  
.STIntersection ( other_geography )  

Arguments

other_geography
Is another geography instance to compare with the instance on which STIntersection() is being invoked.

Return Types

[!INCLUDEssNoVersion] return type: geography

CLR return type: SqlGeography

Remarks

The intersection of two geography instances is returned.

STIntersection() always returns null if the spatial reference identifiers (SRIDs) of the geography instances do not match.

[!INCLUDEssNoVersion] supports spatial instances that are larger than a hemisphere. [!INCLUDEssNoVersion] may include FullGlobe instances in the set of possible results returned on the server.

The result may contain circular arc segments only if the input instances contain circular arc segments.

Examples

A. Computing the intersection of a Polygon and a LineString

The following example uses STIntersection() to compute the intersection of a Polygon and a LineString.

DECLARE @g geography;  
DECLARE @h 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);  
SET @h = geography::STGeomFromText('LINESTRING(-122.360 47.656, -122.343 47.656)', 4326);  
SELECT @g.STIntersection(@h).ToString();  

B. Computing the intersection of a Polygon and a CurvePolygon

The following example returns an instance that contains a circular arc segment.

DECLARE @g geography;  
DECLARE @h 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);  
SET @h = geography::STGeomFromText('CURVEPOLYGON(CIRCULARSTRING(-122.351 47.656, -122.341 47.656, -122.341 47.661, -122.351 47.661, -122.351 47.656))', 4326);  
SELECT @g.STIntersection(@h).ToString();  

C. Computing the symmetric difference with FullGlobe

The following example compares the symmetric difference of a Polygon with FullGlobe.

DECLARE @g geography = 'POLYGON((-122.358 47.653, -122.348 47.649, -122.348 47.658, -122.358 47.658, -122.358 47.653))';  
SELECT @g.STIntersection('FULLGLOBE').ToString();  

See Also

OGC Methods on Geography Instances