RoR App - Location Search Gem/Algorithm?

Hi guys

Just a question… I need some advice

I am looking to put together a RoR app to interface with an iPhone app

The iPhone app will be like a ‘find the nearest’ app. When the user runs
it, it will take the user’s location, send a JSON request to the RoR app
running on a remote server with the location in the querystring

The RoR app should then send back a list of locations for a particular
location for the iPhone app to display on the map.

Is there any good gems that might help with this? I already have the
locations stored in the database along with and address, and can convert
the address into lat/long using geocoding.

The part I am stuck about is an algorithm to search the database for the
‘nearest’ locations given a particular lat/long.

Thanks
William

Take a look at this: Great-circle distance - Wikipedia

Quoting William M. [email protected]:

The RoR app should then send back a list of locations for a particular
location for the iPhone app to display on the map.

Is there any good gems that might help with this? I already have the
locations stored in the database along with and address, and can convert
the address into lat/long using geocoding.

The part I am stuck about is an algorithm to search the database for the
‘nearest’ locations given a particular lat/long.

PostgreSQL with the PostGIS can do this. Look at
GitHub - courtney-rosenthal/findit: A mobile-enabled web application and RESTful web service to find nearby facilities of interest around Austin.. It is a Sinatra app, not
Rails but
should give you working code to learn from.

HTH,
Jeffrey