0

Consider the following SQL:

DECLARE @g1 AS GEOGRAPHY;
DECLARE @g2 AS GEOGRAPHY;
DECLARE @g3 AS GEOGRAPHY;

SET @g1 = GEOGRAPHY::STGeomFromText('POLYGON ((-97.5 33.0, -97.5 34.0, -96.5 34.0, -96.5 33.0, -97.5 33.0))', 4326);
SET @g2 = GEOGRAPHY::STGeomFromText('POINT (-97.5 33.5)', 4326);
SET @g3 = GEOGRAPHY::STGeomFromText('POINT (-98.0 35.0)', 4326);

SELECT @g1.STIntersects(@g2);
SELECT @g1.STIntersects(@g3);

I would expect that the first result would be 1 (true) as the point (@g2) is on the line of the rectangle. However, I would expect that the second result would be 0 (false) as the point (@p3) is nowhere near the region (@p1). However, both results are 1 (true).

I feel as though there is something I am missing fundamentally. If someone can explain, I would greatly appreciate it.

Jason Richmeier
  • 1,595
  • 3
  • 19
  • 38
  • This post helped me: https://stackoverflow.com/questions/11054149/sql-server-2008-spatial-find-a-point-in-polygon – user3254766 Mar 27 '18 at 20:20

1 Answers1

0

Having not received any responses to this question, we posted the question on Reddit and received a response explaining the issue there. This post can be viewed here.

Jason Richmeier
  • 1,595
  • 3
  • 19
  • 38