Re: RoR App - Location Search Gem/Algorithm?

42 views
Skip to first unread message

ddoherty03

unread,
Aug 28, 2012, 5:00:26 PM8/28/12
to rubyonra...@googlegroups.com
Take a look at this:  http://en.wikipedia.org/wiki/Great-circle_distance

On Tuesday, August 28, 2012 11:15:51 AM UTC-5, William Moss wrote:
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

 

Jeffrey L. Taylor

unread,
Aug 28, 2012, 8:09:15 PM8/28/12
to rubyonra...@googlegroups.com
Quoting William Moss <willm...@gmail.com>:
> 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.
>

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
Reply all
Reply to author
Forward
0 new messages