2

I have a database of 20k+ cities with latitude and longitude and I need to make lot of nearest point queries (which city is the nearest to certain lat,long point) against this dataset.

I guess an R-Tree or QuadTree would be a perfect data structure for this, but I haven't been able to find a working ruby implementation. Do you know any?

esad
  • 2,660
  • 1
  • 27
  • 23

2 Answers2

3

I've found the kd-tree gem which helped me solve the above task

esad
  • 2,660
  • 1
  • 27
  • 23
2

Or try:

https://github.com/iterationlabs/rquad

yomero
  • 41
  • 1