如何使用MySQL空间查询查找X半径内的所有记录? [英] How do you use MySQL spatial queries to find all records in X radius?

查看:100
本文介绍了如何使用MySQL空间查询查找X半径内的所有记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在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.

推荐答案

它无法正常工作,因为MySQL尚未实际实现实现此目的的代码.他们只使用边界框查询.

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

请注意,此处未列出任何功能: http: //dev.mysql.com/doc/refman/5.5/zh-CN/functions-for-testing-spatial-relations-between-geometric-objects.html

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

我建议改用PostGIS或Spatialite.

I would reccomend using PostGIS or Spatialite instead.

这篇关于如何使用MySQL空间查询查找X半径内的所有记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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