【发布时间】:2020-08-05 08:24:09
【问题描述】:
我不知道为什么 SQL 没有在我的多边形中检测到这个点
select geography::STGeomFromText('POLYGON ((51.561283 -0.199251
,51.562136 -0.045443
,51.468985 -0.045443
,51.472407 -0.197878
,51.561283 -0.199251))', 4326).STIntersects(geography::Point(51.519425,-0.127029, 4326))
我的多边形在STIsValid() 的结果中有效,并且在 SSMS 显示多边形的方向上也是正确的:
通过谷歌地图,我的点也位于多边形的中心:
这是我用来检测我的观点是否正确的工具: https://www.doogal.co.uk/polylines.php
在文本输入中使用这些数据:
51.561283,-0.199251
51.562136,-0.045443
51.468985,-0.045443
51.472407,-0.197878
51.561283,-0.199251
51.519425,-0.127029
奇怪的是,当我将 lat 和 long 更改为 geography::Point 函数时,结果为 true。
select geography::STGeomFromText('POLYGON ((51.561283 -0.199251
,51.562136 -0.045443
,51.468985 -0.045443
,51.472407 -0.197878
,51.561283 -0.199251))', 4326).STIntersects(geography::Point(-0.127029,51.519425, 4326))
【问题讨论】:
标签: sql-server tsql polygon point geography