Geolocation db?

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

Pete F. 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

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

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 S. wrote:

see how far you are from everyone else.
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

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

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

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.

Would you mind sending me that code? It’d save me from reinventing the
wheel. Thanks.
-Nathan