SQL SERVER 空间数据
我正在努力寻找一种有效的方法来找到与多边形相交的点与该多边形的边界之间的距离。我能够使用 STDistance 将该点与构成多边形的每个点进行比较,但这需要花费大量时间。使用 SPatial 索引并没有多大帮助,因为 STDistance 不是任何约束的一部分,即使我确实放置了约束,索引也没有多大帮助。
我很感激任何反馈。
谢谢。
I am struggling finding an efficient way to find a distance between a Point that intersects a polygon and the border of that polygon. I was able to use the STDistance comparing the point to every point that made up the polygon but that is taking a lot of time. Using SPatial indexed wasn't much helpful because the STDistance is not part of any constraint and even when I did put the constraint, the index didn't help much.
I appreciate any feedback.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试“扩展盒模型” - 您的搜索会不断增长,直到找到最近的点。
在此处查看各种解决方案和更多说明: http ://blogs.msdn.com/isaac/archive/2008/10/23/nearest-neighbors.aspx
Try the "expanding box model" - your search grows until it finds the nearest point.
Check out a variety of solutions and more explanations here: http://blogs.msdn.com/isaac/archive/2008/10/23/nearest-neighbors.aspx
由于您想要找到到边界的距离,因此可以查询到多边形外环的距离,该距离定义为线串。
选择@polygon.STExteriorRing().STDistance(@point)
Since you want to find the distance to the border, you can query for the distance to the exterior ring of the polygon, which is defined as a linestring.
select @polygon.STExteriorRing().STDistance(@point)