find nearest geo point from big list of lat long points
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

I need a high performance method that I can pass a lat long to and it will find the closest match against a big list of 450K lat longs. This will need to be really performant code since we will be executing it a lot of times. Code should be in node or python. it would be fine to make the code have this dataset loaded in memory so that we can use it for multiple queries. im also fine if you want to change the structure of the data to something better suited to query.

for the deliverable we will want code running on it should take a lat long input. and then output the closest point as well as the total time spent on the operation.

first place will get the bounty, second place will get 50$. we will base the winner

here is sample dataset of the 450K points -

Crowdsource coding tasks.

3 Solutions


here's my solution in Node.js using node-csv and haversine packages:

(fork the and open shell)

The code takes CSV file, latitude and longitude as arguments, so an example would be this:

node index.js National_Transit_Map_Stops.csv 47.6727932 -122.2929058

This will return nearest point from the CSV file, in this example that would be:

  '35th Ave NE & NE 60th St',

Let me know if this solves your problem or if there's anything else I can do for you.

Thank you,


Can you check yours. It’s dying for me on initialization.
Qdev 1 month ago

If these points are local transit routes, I can't imagine the distances you'd be comparing would be larger than the size of a city. A simple euclidean distance calculation is accurate to <10 miles and rougly 4 times faster than using haversine distance.

Winning solution
Qdev 1 month ago
So how is it going, does my solution help? @Qdev
farolanfaisal 1 month ago
View Timeline