Created
February 18, 2020 20:54
-
-
Save fxcosta/718078d48371ab57ce8e9e6eb7349f75 to your computer and use it in GitHub Desktop.
SQL Server query to check if a polygon contains a specific point (coordinates)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @g geometry; | |
DECLARE @h geometry; | |
SET @g = geometry::STGeomFromText('POLYGON ((-4583852.3559951019 -1744384.5747652152, -4511274.7500624815 -1744384.5747652152, -4511274.7500624815 -1637044.6921474137, -4583852.3559951019 -1637044.6921474137, -4583852.3559951019 -1744384.5747652152))', 4326); | |
SET @h = geometry::STGeomFromText('POINT (-4546586.20608064 -1672720.54193957)', 4326); | |
SELECT @g.STContains(@h); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment