I'm trying to write a code which will tell me whether point is inside polygon or not
DECLARE @Latitude varchar(20) = '41.694110' DECLARE @Longitude varchar(20) = '44.833680' DECLARE @g geography; DECLARE @p geography; DECLARE @PolygonString varchar(500) = 'POLYGON((41.711921 44.658505, 41.851703 44.773175, 41.763158 44.972302, 41.654421 44.843083, 41.711921 44.658505))' SET @g = geography::STGeomFromText(@PolygonString, 4326); SET @p = geography::Point(@Latitude, @Longitude, 4326) SELECT @g.STIntersects(@p)
It always return 0. Here is visual representation of scenario.
Any ideas what is wrong with my code?
Thanks.
Please Mark as Answer and Vote as Helpful if I helped.
Also please visit my blog http://msguy.net/