문제

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