哪个功能可以很好地检查给定的纬度和经度. lng在多边形内部? [英] which function is good to check whether the given lat & lng is inside the polygon?

查看:117
本文介绍了哪个功能可以很好地检查给定的纬度和经度. lng在多边形内部?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现了以下 mysql空间函数,它们可以检查给定的经度和纬度是否在多边形内部.

I have found the following mysql spatial functions which can check a given lattitude and longtitude is inside the polygon or not.

1- MBR_包含

2- MBR_Within

请指导我,这将给出 快速 准确 的结果,以检查给定点在内部还是内部查询本身在MySql服务器中的多边形之外.

Please guide me, which will give fast and accurate result to check a given point is inside or outside of the polygon in MySql server by the query itself.

还建议我,如果您找到了比此更好的解决方案(应通过Mysql Server中的查询进行检查)?

Also Suggest me, If you found any better solution than this ( It should be checked by query in Mysql Server.)?

关于, 阿伦·拉杰(ArunRaj)

Regards, ArunRaj

推荐答案

它们可能是相同的(在速度方面),但是您应该使用这两个函数运行自己的测试.

They're likely the same (in terms of speed), but you should run your own tests using both functions.

也就是说,假设您可以使用MySQL 5.6.1,则应避免使用MBR函数并使用ST函数:

That said, Assuming you can use MySQL 5.6.1, you should refrain from the MBR functions and use the ST functions:

ST_Contains()
ST_Within()

原因是,MBR代表最小边界矩形,因此,一个点可以在最小边界矩形内,但实际上不在多边形内. ST方法精确到形状,将为您提供更精确的答案.

The reason, MBR stands for minimum bounding rectangle, therefore a point can be within the minimum bounding rectangle, but not actually within the Polygon. The ST methods are exact to the shape and will give you a more precise answer.

编辑,解决我应该使用哪一个?我相信您可以在测试多边形内的一个点时使用,也可以再次对已知位于多边形中的点进行测试,以确保安全.

Edit, Addressing which one should I use? I believe you can use either as you're testing a point within a polygon, but again test on a point you know to be in a polygon for safety.

这篇关于哪个功能可以很好地检查给定的纬度和经度. lng在多边形内部?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆