MySQL Find Polygon Nearest to Point

2019-02-19 05:07发布

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条回答
闹够了就滚
2楼-- · 2019-02-19 05:32

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.

查看更多
登录 后发表回答