Filter (geography Data Type)
Applies to: SQL Server Azure SQL Database Azure SQL Managed Instance
A method that offers a fast, index-only intersection method to determine if a geography instance intersects another geography instance, assuming an index is available.
Returns 1 if a geography instance potentially intersects another geography instance. This method may produce a false-positive return, and the exact result may be plan-dependent. Returns an accurate 0 value (true negative return) if there is no intersection of geography instances found.
In cases where an index is not available, or is not used, the method will return the same values as STIntersects() when called with the same parameters.
Syntax
.Filter ( 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 Filter() is invoked.
Return Types
SQL Server return type: bit
CLR return type: SqlBoolean
Remarks
This method is not deterministic and is not precise.
Examples
The following example uses Filter()
to determine if two geography
instances intersect each other.
CREATE TABLE sample (id int primary key, g geography);
INSERT INTO sample VALUES
(0, geography::Point(45, -120, 4326)),
(1, geography::Point(45, -120.1, 4326)),
(2, geography::Point(45, -120.2, 4326)),
(3, geography::Point(45, -120.3, 4326)),
(4, geography::Point(45, -120.4, 4326));
CREATE SPATIAL INDEX sample_idx on sample(g);
SELECT id
FROM sample
WHERE g.Filter(geography::Parse(
'POLYGON((-120.1 44.9, -119.9 44.9, -119.9 45.1, -120.1 45.1, -120.1 44.9))')) = 1;
See Also
Extended Methods on Geography Instances
STIntersects (geography Data Type)
Athugasemdir
https://aka.ms/ContentUserFeedback.
Væntanlegt: Á árinu 2024 munum við hætta með GitHub-mál sem ábendingaleið fyrir efni og skipta því út fyrir nýtt ábendingakerfi. Frekari upplýsingar er að finna hér:Senda inn og skoða endurgjöf fyrir