Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find the closest coordinate from a set of coordinates

I have about 1000 set of geographical coordinates (lat, long). Given one coordinate i want to find the closest one from that set. My approach was to measure the distance but on hundreds requests per second can be a little rough to the server doing all that math.

What is the best optimized solution for this?

Thanks

like image 368
keepwalking Avatar asked Nov 25 '25 09:11

keepwalking


1 Answers

You will want to use the 'Nearest Neighbor Algorithm'.

like image 60
ppovoski Avatar answered Nov 27 '25 22:11

ppovoski



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!