Partage via


STIntersects (type de données geography)

S’applique à : SQL Server Azure SQL Database Azure SQL Managed Instance Base de données SQL dans Microsoft Fabric

Retourne 1 si une instance geography entre en intersection avec une autre instance geography. Retourne 0 dans le cas contraire.

Syntaxe

.STIntersects ( other_geography )  

Arguments

other_geography
Autre instance geography à comparer à l’instance sur laquelle STIntersects() est appelé.

Types de retour

Type de retour SQL Server : bit

Type de retour CLR : SqlBoolean

Remarques

Cette méthode retourne toujours NULL si les SRID (ID de référence spatiale) des instances geography ne correspondent pas.

Exemples

L'exemple suivant utilise STIntersects() pour déterminer si deux instances geography se croisent.

 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 CASE @g.STIntersects(@h) 
WHEN 1 THEN '@g intersects @h'  
ELSE '@g does not intersect @h'  
END;

Voir aussi

Méthodes OGC sur des instances Geography