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?
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?
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?
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:
Covers the whole world.
Google maps is very easy to use
It looks very cool
Cons.
Only works in US/UK for actual street maps.
Pin pointing on the map is perhaps not as accurate as a zip/post code
(although this isn’t always the case).
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?
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
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).