Nathan Esquenazi
2007-Aug-30 05:41 UTC
Being able to search for nearby items based on zip code
Hello everyone, I am building a site which is a searchable directory of doctors. Basically, doctors can register where their clinic is (address) and then patients can search and find clinics. I have the tables set up and everything with a Doctor containing a street, zip code, state, etc. I simply need a method of allowing a patient to type in a zip code or city and the have all the nearest doctors in the database displayed to them sorted by distance. So basically, I have a database of doctors with their addresses and I want to have the patient type in a zip code or city (and a radius) and then I need to perform a query which will give me a list of the closest X doctors in order by distance from that zip code. Problem is I wouldn''t know where to begin to actually code the algorithm myself. I assume you would need a huge table of every zip code and maybe the latitiude and longitude and then calculate the distances or something. I would much prefer to use a library or purchase a package that can do this. This has GOT to be a hugely common requirement to be able to search for "X''s close to address Y within Z radius sorted by distance". This seems like a very common configuration and I would love an experts advice on whats the "best" route to use for this. Obviously I want it to be efficient as possible but also be easy to implement. Thanks in advance for your suggestions. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
gene.tani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Aug-30 05:51 UTC
Re: Being able to search for nearby items based on zip code
On Aug 29, 10:41 pm, Nathan Esquenazi <rails-mailing-l...@andreas- s.net> wrote:> Hello everyone, > > I am building a site which is a searchable directory of doctors. > Basically, doctors can register where their clinic is (address) and then > patients can search and find clinics. I have the tables set up and > everything with a Doctor containing a street, zip code, state, etc. I > simply need a method of allowing a patient to type in a zip code or city > and the have all the nearest doctors in the database displayed to them > sorted by distance. > > So basically, I have a database of doctors with their addresses and I > want to have the patient type in a zip code or city (and a radius) and > then I need to perform a query which will give me a list of the closest > X doctors in order by distance from that zip code. > > Problem is I wouldn''t know where to begin to actually code the algorithm > myself. I assume you would need a huge table of every zip code and maybe > the latitiude and longitude and then calculate the distances or > something. I would much prefer to use a library or purchase a package > that can do this. > > This has GOT to be a hugely common requirement to be able to search for > "X''s close to address Y within Z radius sorted by distance". This seems > like a very common configuration and I would love an experts advice on > whats the "best" route to use for this. Obviously I want it to be > efficient as possible but also be easy to implement. > > Thanks in advance for your suggestions. > -- > Posted viahttp://www.ruby-forum.com/.look at the Apress books on Google maps apps (one for Rails, one for PHP) --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Nathan Esquenazi
2007-Aug-30 06:00 UTC
Re: Being able to search for nearby items based on zip code
Will that book have a very clear guide to doing a search for items in my database that are near a certain zip code? Is this the book? http://www.amazon.com/Beginning-Google-Maps-Applications-Rails/dp/1590597877 Anyone willing to help me get started without having to purchase a book? Surely there is some open source project or code snippet for this common behavior? gene.tani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> On Aug 29, 10:41 pm, Nathan Esquenazi <rails-mailing-l...@andreas- > s.net> wrote: >> So basically, I have a database of doctors with their addresses and I >> This has GOT to be a hugely common requirement to be able to search for >> "X''s close to address Y within Z radius sorted by distance". This seems >> like a very common configuration and I would love an experts advice on >> whats the "best" route to use for this. Obviously I want it to be >> efficient as possible but also be easy to implement. >> >> Thanks in advance for your suggestions. >> -- >> Posted viahttp://www.ruby-forum.com/. > > look at the Apress books on Google maps apps (one for Rails, one for > PHP)-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Anthony Richardson
2007-Aug-30 07:08 UTC
Re: Being able to search for nearby items based on zip code
Nathan Esquenazi wrote:> Hello everyone, > > I am building a site which is a searchable directory of doctors. > Basically, doctors can register where their clinic is (address) and then > patients can search and find clinics.Geocoding is the magic term you want to plug into Google. A quick search results in this http://geokit.rubyforge.org/ which may do what you want. There are many providers (free and commercial) of the postcode/zipcode lat/long details you will need as well. Cheers, Anthony --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Aaron Sheriff
2007-Aug-30 07:12 UTC
Re: Being able to search for nearby items based on zip code
> > Anyone willing to help me get started without having to purchase a book? > Surely there is some open source project or code snippet for this common > behavior? >Maybe take a look at: http://www.sanisoft.com/phpziplocator It''s PHP, Lesser GNU General Public License. It''s been a while (year''s?), but if I recall it wasn''t too difficult to take the database table provided and use the PHP examples as a basis for what I was trying to accomplish. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Nathan Esquenazi
2007-Aug-30 08:26 UTC
Re: Being able to search for nearby items based on zip code
Anthony, thank you. Thanks you again. You are truly a gentleman and a scholar. Geokit is EXACTLY what I need. For posterity, GeoKit allows you to perform distance based queries on any table with a lat/lon. For instance if every doctor has a lat, lon attribute then I can simply perform this query: Doctor.find(:all, :origin=>''92453'', :within=>10) Thanks again. Anthony Richardson wrote:> Nathan Esquenazi wrote: >> Hello everyone, >> >> I am building a site which is a searchable directory of doctors. >> Basically, doctors can register where their clinic is (address) and then >> patients can search and find clinics. > Geocoding is the magic term you want to plug into Google. A quick search > results in this http://geokit.rubyforge.org/ which may do what you want. > There are many providers (free and commercial) of the postcode/zipcode > lat/long details you will need as well. > > Cheers, > > Anthony-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
unimatrixZxero
2007-Aug-30 12:01 UTC
Re: Being able to search for nearby items based on zip code
If what you are doing is OpenSource Nathan would you be so kind to write a blog entry about it? On Aug 30, 10:26 am, Nathan Esquenazi <rails-mailing-l...@andreas- s.net> wrote:> Anthony, thank you. Thanks you again. You are truly a gentleman and a > scholar. Geokit is EXACTLY what I need. For posterity, GeoKit allows you > to perform distance based queries on any table with a lat/lon. For > instance if every doctor has a lat, lon attribute then I can simply > perform this query: > > Doctor.find(:all, :origin=>''92453'', :within=>10) > > Thanks again. > > Anthony Richardson wrote: > > Nathan Esquenazi wrote: > >> Hello everyone, > > >> I am building a site which is a searchable directory of doctors. > >> Basically, doctors can register where their clinic is (address) and then > >> patients can search and find clinics. > > Geocoding is the magic term you want to plug into Google. A quick search > > results in thishttp://geokit.rubyforge.org/which may do what you want. > > There are many providers (free and commercial) of the postcode/zipcode > > lat/long details you will need as well. > > > Cheers, > > > Anthony > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
David Andrew Thompson
2007-Aug-30 17:05 UTC
Re: Being able to search for nearby items based on zip code
I came across http://zipcodesearch.rubyforge.org/ but geokit looks like it may be a more robust solution. On 8/30/07, unimatrixZxero <unimatrixZxero-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> > > If what you are doing is OpenSource Nathan would you be so kind to > write a blog entry about it? > > On Aug 30, 10:26 am, Nathan Esquenazi <rails-mailing-l...@andreas- > s.net> wrote: > > Anthony, thank you. Thanks you again. You are truly a gentleman and a > > scholar. Geokit is EXACTLY what I need. For posterity, GeoKit allows you > > to perform distance based queries on any table with a lat/lon. For > > instance if every doctor has a lat, lon attribute then I can simply > > perform this query: > > > > Doctor.find(:all, :origin=>''92453'', :within=>10) > > > > Thanks again. > > > > Anthony Richardson wrote: > > > Nathan Esquenazi wrote: > > >> Hello everyone, > > > > >> I am building a site which is a searchable directory of doctors. > > >> Basically, doctors can register where their clinic is (address) and > then > > >> patients can search and find clinics. > > > Geocoding is the magic term you want to plug into Google. A quick > search > > > results in thishttp://geokit.rubyforge.org/which may do what you want. > > > There are many providers (free and commercial) of the postcode/zipcode > > > lat/long details you will need as well. > > > > > Cheers, > > > > > Anthony > > > > -- > > Posted viahttp://www.ruby-forum.com/. > > > > >-- David Andrew Thompson http://dathompson.blogspot.com --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Nathan Esquenazi
2007-Aug-30 20:34 UTC
Re: Being able to search for nearby items based on zip code
Thank you for finding an alternative david. The big difference between geokit and this one is that geokit is using google api''s to do everything behind the scenes while this method you linked to does it all from my own server. Once my application begins to scale, I may very well switch to this method because it allows me to do it all without requiring external api''s. So, again, thanks for finding me exactly what I needed! As for writing a blog entry, I doubt you would be interested. I have only been working with rails for a month or so now and this is my first project I am doing in it which will to be deployed to the public. Not to mention that right now all I have is paper prototypes and a set of milestones for the project. I appreciate the offer though! David Andrew Thompson wrote:> I came across http://zipcodesearch.rubyforge.org/ but geokit looks like > it > may be a more robust solution. > > On 8/30/07, unimatrixZxero <unimatrixZxero-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> > instance if every doctor has a lat, lon attribute then I can simply >> > >> I am building a site which is a searchable directory of doctors. >> > >> > > Anthony >> > >> > -- >> > Posted viahttp://www.ruby-forum.com/. >> >> >> > >> > > > -- > David Andrew Thompson > http://dathompson.blogspot.com-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---