MySQL Find Polygon Nearest to Point

拈花ヽ惹草 提交于 2019-12-19 09:22:31

问题


I have a MySQL database that contains geo-tagged objects. The objects are tagged by using a bounding polygon that the user draws and my program exports into the database. The bounding polygon is stored in the database as a Polygon (the MySQL spatial extensions kind).

I can think of a couple ways to do this, but I'm not very pleased with any of them, as this needs to be an efficient process that will execute fairly often, although on probably only < 50,000 records in the pertinent table.

I need a way to, given any point on the earth, find the record that corresponds to the closest geo-tagged/bounded object. It doesn't need to be correct in all cases but, let's say (just to invent a number), 95% of the time. Manual correction is acceptable if it doesn't need to be done very frequently.


回答1:


It appears as though this question is very similar Get polygons close to a lat,long in MySQL.

I am going to write some application-level code to do an interatively-widening search on the distance in the linked question.



来源:https://stackoverflow.com/questions/4879337/mysql-find-polygon-nearest-to-point

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