MS SQL Server: Filter Using Geospatial Data
Introduction
The _st_contains, _st_crosses, _st_equals, _st_intersects, _st_overlaps, _st_touches, _st_within operators
are used to filter based on geometry like columns.
_st_intersects usage_st_intersects can be used on geography columns also.
Use JSON representation (see GeoJSON) of geometry and geography values in
variables as shown in the following examples:
_st_contains
Fetch a list of geometry values that are contained within the given polygon value:
_st_crosses
Fetch a list of geometry values which cross the given line value:
_st_equals
Fetch a list of geometry values which are equal to the given polygon value:
_st_intersects
Fetch a list of geometry values which intersect the given polygon value:
_st_overlaps
Fetch a list of geometry values which overlap with the given polygon value:
_st_touches
Fetch a list of geometry values which touch the given polygon value:
_st_within
Fetch a list of geometry values which are within the given polygon value: