ST_WITHIN
Updated: February 1, 2017
Applies To: Azure
Returns 1 if a geography is within another, if not it will return 0.
Syntax
ST_WITHIN (geography, polygon)
Geography
The geography that could be inside the polygon. Can be either a point or a polygon.
Polygon
The polygon that could contain the geography.
Returns 1 if either a point or polygon is within another polygon, if not it will return 0.
SELECT
ST_WITHIN(input.deliveryDestination, input.warehouse)
FROM input
Input Example
| deliveryDestination | warehouse |
|---|---|
| {“type”:”Point”, “coordinates”: [76.6, 10.1]} | {“type”:”Polygon”, “coordinates”: [ [0.0, 0.0], [10.0, 0.0], [10.0, 10.0], [0.0, 10.0], [0.0, 0.0] ]} |
| {“type”:”Point”, “coordinates”: [15.0, 15.0]} | {“type”:”Polygon”, “coordinates”: [ [10.0, 10.0], [20.0, 10.0], [20.0, 20.0], [10.0, 20.0], [10.0, 10.0] ]} |
Output Example
0
1
Show: