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: http://en.wikipedia.org/wiki/Great-circle_distance

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
https://github.com/chip-rosenthal/findit. It is a Sinatra app, not
Rails but
should give you working code to learn from.

HTH,
Jeffrey

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs