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 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/ZAG3KdiApG0J. For more options, visit https://groups.google.com/groups/opt_out.
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 > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/2E8C1U5MvjsJ. For more options, visit https://groups.google.com/groups/opt_out.
Quoting William Moss <willmoss26-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> 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 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.