How do you use MySQL spatial queries to find all records in X radius? [closed]

半城伤御伤魂 提交于 2019-11-30 15:50:40

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/3209093/how-do-you-use-mysql-spatial-queries-to-find-all-records-in-x-radius

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!