MySQL Find the polygon closest to a point

I have a MySQL database containing objects with geotags. Objects are marked with a bounding polygon, which the user draws, and my program is exported to the database. The bounding polygon is stored in the database as a polygon (spatial extensions of MySQL).

I can come up with a couple of ways to do this, but I'm not very happy with any of them, as this should be an efficient process that will be performed quite often, although there are probably only <50,000 entries in the corresponding table.

I need a way, if any point on the earth is given, find the record corresponding to the nearest geo-tagged / restricted object. This does not have to be correct in all cases, but let's say (just reinvent the number), 95% of the time. Manual correction is acceptable if it does not need to be done very often.

+3
source share
1 answer

This question seems to be very similar. Get polygons close to lat long in MySQL .

I am going to write some code at the application level to do a mutually expanding distance search in a related question.

+1
source

Source: https://habr.com/ru/post/1789584/


All Articles