STWithin (tipo di dati geography)
Restituisce 1 se un'istanza geography si trova a livello spaziale all'interno di un'altra istanza geography. In caso contrario, restituisce 0.
Sintassi
.STWithin ( other_geography )
Argomenti
- other_geography
Altra istanza geography da confrontare con l'istanza sulla quale STWithin() viene richiamato.
Tipi restituiti
SQL Server tipo restituito: bit
Tipo CLR restituito: SqlBoolean
Osservazioni
Questo metodo restituisce sempre Null se gli identificatori SRID delle istanze geography non corrispondono.
Esempi
Nell'esempio seguente viene utilizzato STWithin() per verificare se per due istanze geography la prima è completamente all'interno della seconda.
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.STWithin(@h);