开发者

MySQL Find Polygon Nearest to Point

开发者 https://www.devze.com 2023-02-08 09:05 出处:网络
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 store

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 thi开发者_JAVA百科s, 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消