keepwalking keepwalking - 20 days ago 9
Node.js Question

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

Answer

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

Comments