Condividi tramite


STIntersection (tipo di dati geometry)

Restituisce un oggetto che rappresenta i punti in cui un'istanza geometry interseca un'altra istanza geometry.

Sintassi

.STIntersection ( other_geometry )

Argomenti

  • other_geometry
    Altra istanza geometry da confrontare con l'istanza sulla quale STIntersection() è richiamato per determinare il punto di intersezione.

Tipi restituiti

Tipo SQL Server restituito: geometry

Tipo CLR restituito: SqlGeometry

Osservazioni

STIntersection() restituisce sempre Null se gli identificatori SRID delle istanze geometry non corrispondono.

Esempi

Nell'esempio seguente viene utilizzato STIntersection() per calcolare l'intersezione di due poligoni.

DECLARE @g geometry;
DECLARE @h geometry;
SET @g = geometry::STGeomFromText('POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))', 0);
SET @h = geometry::STGeomFromText('POLYGON((1 1, 3 1, 3 3, 1 3, 1 1))', 0);
SELECT @g.STIntersection(@h).ToString();

Vedere anche

Altre risorse