Вопрос

I'm thinking of building an application that helps you find local businesses (just an example). You might enter your zip code (or GPS if this is on a phone) and find the closest business within 10 miles, etc. My question is how can I achieve this type of logic? Is there a library or service that I will need to use? Or can this be done with math? I'm not familiar with how this sort of thing usually works, so let me know how I need to store the records so I can query them later. Note: I will be using Ruby and MongoDB.

Это было полезно?

Решение

It should be easy to find the math to solve that, providing lat/long coordinates.

Or you could use some full featured gem to do that for you like Geocoder, that supports Mongoid or MongoMapper.

Next time you need some feature that might be a commun world problem, first check if there is a gem for that at ruby-toolbox, for this case here are some other gems for geocoding

Другие советы

One more solution here...

http://geokit.rubyforge.org/

I think, this topic is already discussed here..

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top