如何使用MySQL空间查询来查找X半径内的所有记录?

发布于 2024-09-09 02:08:49 字数 151 浏览 1 评论 0原文

我在 MySQL 数据库中有一个表,其中包含 POINT 类型的空间几何列。我希望能够在地图中心取一个点,并找到该点 X 英里(或任何距离)内的所有记录。我似乎找不到一个很好的例子或解释来说明如何做到这一点,而不需要深入几何数学。我很高兴走这条路,但首先想尝试用真正的空间数据库来解决它。

I have a table in a MySQL database with a spatial geometry column of type POINT. I'd like to be able to take a point at the center of a map and find all records within X miles (or whatever distance) of it. I can't seem to find a good example or explanation of how to do this that doesn't get heavily into geometric math. I'm happy to go that route, but would first like to try and solve it with a true spatial database.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

听,心雨的声音 2024-09-16 02:08:49

它不会工作,因为 MySQL 还没有真正实现代码来使其工作。他们只使用边界框查询。

请注意,此处没有列出任何函数:
http: //dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations- Between-geometric-objects.html

我建议使用 PostGIS 或 Spatialite 代替。

It won't work because MySQL hasn't actually implemented the code to make this work. They only use bounding box queries.

Notice there are no functions listed here:
http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html

I would reccomend using PostGIS or Spatialite instead.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文