I''m currently planning a social app in Rails that relies on being able to see how far you are from everyone else. It''s my intention to store rough geo-coordinates as part of the sign up process. My intention is to capture their zipcode or postal code, and then be able to query a webservice once for that data. It''s also possible that there might be a database or even a CSV somewhere that contains this information for every zip/postalcode... I don''t want to reinvent the wheel. The geocode APIs that I''ve seen seem to be slow and US-only. Yet dozens of sites give me quasi-accurate "your are 1251 miles from Bob" type metrics - and it works across continents. How do they do this? Pete
This should get you started: http://glytch.org/blog/2006/01/locationrb.html (no affiliation or anything, but I''ve used it personally and haven''t had any issues with it so far) -Nick On 4/19/06, Pete Forde <pete@unspace.ca> wrote:> > I''m currently planning a social app in Rails that relies on being able to > see how far you are from everyone else. > > It''s my intention to store rough geo-coordinates as part of the sign up > process. My intention is to capture their zipcode or postal code, and then > be able to query a webservice once for that data. It''s also possible that > there might be a database or even a CSV somewhere that contains this > information for every zip/postalcode... > > I don''t want to reinvent the wheel. The geocode APIs that I''ve seen seem > to > be slow and US-only. Yet dozens of sites give me quasi-accurate "your are > 1251 miles from Bob" type metrics - and it works across continents. How do > they do this? > > Pete > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060419/ba12e025/attachment.html
Pete Forde wrote:> I''m currently planning a social app in Rails that relies on being able > to > see how far you are from everyone else. > > It''s my intention to store rough geo-coordinates as part of the sign up > process. My intention is to capture their zipcode or postal code, and > then > be able to query a webservice once for that data. It''s also possible > that > there might be a database or even a CSV somewhere that contains this > information for every zip/postalcode... > > I don''t want to reinvent the wheel. The geocode APIs that I''ve seen seem > to > be slow and US-only. Yet dozens of sites give me quasi-accurate "your > are > 1251 miles from Bob" type metrics - and it works across continents. How > do > they do this? > > PeteIf you want to code it yourself you might check these sites: http://www2.nau.edu/~cvm/latlongdist.html http://www2.nau.edu/~cvm/latlon_formula.html -- Posted via http://www.ruby-forum.com/.
I rolled my own solution based off of zipdy. You can find a blog entry about it at: http://www.migrob.com/articles/2006/04/10/calculate-distance-between-zip-codes There are some obvious optimizations that could be done that the nature of my app didn''t warrant them being done. Rob On 4/19/06, bttman <bttman@bigtreestech.com> wrote:> > Pete Forde wrote: > > I''m currently planning a social app in Rails that relies on being able > > to > > see how far you are from everyone else. > > > > It''s my intention to store rough geo-coordinates as part of the sign up > > process. My intention is to capture their zipcode or postal code, and > > then > > be able to query a webservice once for that data. It''s also possible > > that > > there might be a database or even a CSV somewhere that contains this > > information for every zip/postalcode... > > > > I don''t want to reinvent the wheel. The geocode APIs that I''ve seen seem > > to > > be slow and US-only. Yet dozens of sites give me quasi-accurate "your > > are > > 1251 miles from Bob" type metrics - and it works across continents. How > > do > > they do this? > > > > Pete > > If you want to code it yourself you might check these sites: > http://www2.nau.edu/~cvm/latlongdist.html > http://www2.nau.edu/~cvm/latlon_formula.html > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- c++: the power, elegance and simplicity of a hand grenade http://www.migrob.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060419/5fa90a96/attachment.html
Anyone out there that has a database with all European (or Benelux) cities (or even better streets) and their latitude and longitude values? On 20 Apr 2006, at 01:14, Nick Stuart wrote:> This should get you started: > > http://glytch.org/blog/2006/01/locationrb.html > (no affiliation or anything, but I''ve used it personally and > haven''t had any issues with it so far) > > -Nick > > On 4/19/06, Pete Forde <pete@unspace.ca> wrote: I''m currently > planning a social app in Rails that relies on being able to > see how far you are from everyone else. > > It''s my intention to store rough geo-coordinates as part of the > sign up > process. My intention is to capture their zipcode or postal code, > and then > be able to query a webservice once for that data. It''s also > possible that > there might be a database or even a CSV somewhere that contains this > information for every zip/postalcode... > > I don''t want to reinvent the wheel. The geocode APIs that I''ve seen > seem to > be slow and US-only. Yet dozens of sites give me quasi-accurate > "your are > 1251 miles from Bob" type metrics - and it works across continents. > How do > they do this?Best regards Peter De Berdt
A quick hack with Google maps might be one possible solution to this problem. IIRC, the Google maps API will return the long/lat position for a selected point on the map when the user clicks the map. I suppose you could embed the Google map (satellite view) and ask your user to pin-point where they are and grab the figure you need. Pros: 1. Covers the whole world. 2. Google maps is very easy to use 3. It looks very cool Cons. 1. Only works in US/UK for actual street maps. 2. Pin pointing on the map is perhaps not as accurate as a zip/post code (although this isn''t always the case). 3. The definition of some of the satellite images on Google maps is pretty fuzzy only allowing an approximate point to be selected. Comments and suggestions? Perhaps this could be wrapped up into a plugin / engine? Nicholas Peter De Berdt wrote:> Anyone out there that has a database with all European (or Benelux) > cities (or even better streets) and their latitude and longitude values? > > On 20 Apr 2006, at 01:14, Nick Stuart wrote: > >> This should get you started: >> >> http://glytch.org/blog/2006/01/locationrb.html >> (no affiliation or anything, but I''ve used it personally and haven''t >> had any issues with it so far) >> >> -Nick >> >> On 4/19/06, Pete Forde <pete@unspace.ca> wrote: I''m currently >> planning a social app in Rails that relies on being able to >> see how far you are from everyone else. >> >> It''s my intention to store rough geo-coordinates as part of the sign up >> process. My intention is to capture their zipcode or postal code, and >> then >> be able to query a webservice once for that data. It''s also possible >> that >> there might be a database or even a CSV somewhere that contains this >> information for every zip/postalcode... >> >> I don''t want to reinvent the wheel. The geocode APIs that I''ve seen >> seem to >> be slow and US-only. Yet dozens of sites give me quasi-accurate "your >> are >> 1251 miles from Bob" type metrics - and it works across continents. >> How do >> they do this? > > > Best regards > > Peter De Berdt > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
I recently wrote an application that did just that. It used the cartographer plugin for handling the geocoding requests. http://cartographer.rubyforge.org/ However, I had to extend it to deal with Canadian addresses http://geocoder.ca/ Anyhow, roughly what happens is that pepole would enter their address (not zipcode) and then in an AJAX call the system would hit the geocoder and return the lat/lon of the address (zip/postalcodes work too, just not as effective). Then, it would store that lat/lon in the @user object that was being created, and show the user a map where they could see their location visually and confirm that that was their location in the world. Then, when the user clicks "register", I now forever have their lat/lon which makes it quite easy to do really great distance calcuations (down to meters if need be). -hampton. On 4/19/06, Pete Forde <pete@unspace.ca> wrote:> > I''m currently planning a social app in Rails that relies on being able to > see how far you are from everyone else. > > It''s my intention to store rough geo-coordinates as part of the sign up > process. My intention is to capture their zipcode or postal code, and then > be able to query a webservice once for that data. It''s also possible that > there might be a database or even a CSV somewhere that contains this > information for every zip/postalcode... > > I don''t want to reinvent the wheel. The geocode APIs that I''ve seen seem > to > be slow and US-only. Yet dozens of sites give me quasi-accurate "your are > 1251 miles from Bob" type metrics - and it works across continents. How do > they do this? > > Pete > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060420/73acf233/attachment.html
Erm, the Post Office for the UK. (www.postoffice.co.uk). The postcode address file (PAF) is what you want. Trouble is, you have to subscribe to regular updates and it costs over GB?300 per year. http://homepage.ntlworld.com/r.monks/postcodes.zip has a CSV of co-ordinates in metres for each postcode area (only the SE27, not SE27 0NB). Hope this helps. -N On 20/04/06, Peter De Berdt <peter.de.berdt@pandora.be> wrote:> Anyone out there that has a database with all European (or Benelux) > cities (or even better streets) and their latitude and longitude values? > > On 20 Apr 2006, at 01:14, Nick Stuart wrote: > > > This should get you started: > > > > http://glytch.org/blog/2006/01/locationrb.html > > (no affiliation or anything, but I''ve used it personally and > > haven''t had any issues with it so far) > > > > -Nick > > > > On 4/19/06, Pete Forde <pete@unspace.ca> wrote: I''m currently > > planning a social app in Rails that relies on being able to > > see how far you are from everyone else. > > > > It''s my intention to store rough geo-coordinates as part of the > > sign up > > process. My intention is to capture their zipcode or postal code, > > and then > > be able to query a webservice once for that data. It''s also > > possible that > > there might be a database or even a CSV somewhere that contains this > > information for every zip/postalcode... > > > > I don''t want to reinvent the wheel. The geocode APIs that I''ve seen > > seem to > > be slow and US-only. Yet dozens of sites give me quasi-accurate > > "your are > > 1251 miles from Bob" type metrics - and it works across continents. > > How do > > they do this? > > > Best regards > > Peter De Berdt > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
since i do a lot of work with geocoding i can say that yahoo has a tool that replaces the free Geocoder.us tool. However it is limited in how many queries you can make per day (5000 i believe) but returns way more results. Check out this link http://developer.yahoo.com/maps/rest/V1/geocode.html I just wrote some ruby to query yahoo, read in the XML yahoo returns, parse out the latitude and longitude, and then do whatever with it. adam On 4/24/06, njmacinnes@gmail.com <njmacinnes@gmail.com> wrote:> > Erm, the Post Office for the UK. (www.postoffice.co.uk). The postcode > address file (PAF) is what you want. Trouble is, you have to subscribe > to regular updates and it costs over GB?300 per year. > http://homepage.ntlworld.com/r.monks/postcodes.zip has a CSV of > co-ordinates in metres for each postcode area (only the SE27, not SE27 > 0NB). Hope this helps. > -N > > On 20/04/06, Peter De Berdt <peter.de.berdt@pandora.be> wrote: > > Anyone out there that has a database with all European (or Benelux) > > cities (or even better streets) and their latitude and longitude values? > > > > On 20 Apr 2006, at 01:14, Nick Stuart wrote: > > > > > This should get you started: > > > > > > http://glytch.org/blog/2006/01/locationrb.html > > > (no affiliation or anything, but I''ve used it personally and > > > haven''t had any issues with it so far) > > > > > > -Nick > > > > > > On 4/19/06, Pete Forde <pete@unspace.ca> wrote: I''m currently > > > planning a social app in Rails that relies on being able to > > > see how far you are from everyone else. > > > > > > It''s my intention to store rough geo-coordinates as part of the > > > sign up > > > process. My intention is to capture their zipcode or postal code, > > > and then > > > be able to query a webservice once for that data. It''s also > > > possible that > > > there might be a database or even a CSV somewhere that contains this > > > information for every zip/postalcode... > > > > > > I don''t want to reinvent the wheel. The geocode APIs that I''ve seen > > > seem to > > > be slow and US-only. Yet dozens of sites give me quasi-accurate > > > "your are > > > 1251 miles from Bob" type metrics - and it works across continents. > > > How do > > > they do this? > > > > > > Best regards > > > > Peter De Berdt > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060424/a2b219bc/attachment.html
Would you mind sending me that code? It''d save me from reinventing the wheel. Thanks. -Nathan On 24/04/06, Adam Denenberg <straightflush@gmail.com> wrote:> since i do a lot of work with geocoding i can say that yahoo has a tool that > replaces the free Geocoder.us tool. However it is limited in how many > queries you can make per day (5000 i believe) but returns way more results. > Check out this link > > http://developer.yahoo.com/maps/rest/V1/geocode.html > > I just wrote some ruby to query yahoo, read in the XML yahoo returns, parse > out the latitude and longitude, and then do whatever with it. > > adam > > > On 4/24/06, njmacinnes@gmail.com <njmacinnes@gmail.com > wrote: > > Erm, the Post Office for the UK. (www.postoffice.co.uk ). The postcode > > address file (PAF) is what you want. Trouble is, you have to subscribe > > to regular updates and it costs over GB?300 per year. > > http://homepage.ntlworld.com/r.monks/postcodes.zip has a > CSV of > > co-ordinates in metres for each postcode area (only the SE27, not SE27 > > 0NB). Hope this helps. > > -N > > > > On 20/04/06, Peter De Berdt <peter.de.berdt@pandora.be > wrote: > > > Anyone out there that has a database with all European (or Benelux) > > > cities (or even better streets) and their latitude and longitude values? > > > > > > On 20 Apr 2006, at 01:14, Nick Stuart wrote: > > > > > > > This should get you started: > > > > > > > > http://glytch.org/blog/2006/01/locationrb.html > > > > (no affiliation or anything, but I''ve used it personally and > > > > haven''t had any issues with it so far) > > > > > > > > -Nick > > > > > > > > On 4/19/06, Pete Forde <pete@unspace.ca> wrote: I''m currently > > > > planning a social app in Rails that relies on being able to > > > > see how far you are from everyone else. > > > > > > > > It''s my intention to store rough geo-coordinates as part of the > > > > sign up > > > > process. My intention is to capture their zipcode or postal code, > > > > and then > > > > be able to query a webservice once for that data. It''s also > > > > possible that > > > > there might be a database or even a CSV somewhere that contains this > > > > information for every zip/postalcode... > > > > > > > > I don''t want to reinvent the wheel. The geocode APIs that I''ve seen > > > > seem to > > > > be slow and US-only. Yet dozens of sites give me quasi-accurate > > > > "your are > > > > 1251 miles from Bob" type metrics - and it works across continents. > > > > How do > > > > they do this? > > > > > > > > > Best regards > > > > > > Peter De Berdt > > > > > > _______________________________________________ > > > Rails mailing list > > > Rails@lists.rubyonrails.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >