Forum: Ruby on Rails geolocation db?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
496ed7f402fc56b1f997855941272ad4?d=identicon&s=25 Pete Forde (Guest)
on 2006-04-19 17:37
(Received via mailing list)
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
Cb610750ee94ca103aef4b2dc7b1b768?d=identicon&s=25 Nick Stuart (Guest)
on 2006-04-20 01:16
(Received via mailing list)
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
49c4935f50f26608ba704f29da8e93b4?d=identicon&s=25 bttman (Guest)
on 2006-04-20 01:29
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
A4a8fefcbd2cd6d2370609a5e2a3a389?d=identicon&s=25 Rob Merrell (Guest)
on 2006-04-20 02:02
(Received via mailing list)
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/calculat...

There are some obvious optimizations that could be done that the nature
of
my app didn't warrant them being done.

Rob
00973881979aa0a660ffbbb2f7a907fb?d=identicon&s=25 Peter De Berdt (Guest)
on 2006-04-20 12:08
(Received via mailing list)
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:

> 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
E8d4e155929363bd22a7852494d18c25?d=identicon&s=25 Nicholas Tollervey (Guest)
on 2006-04-20 13:01
(Received via mailing list)
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
A77873df3a9766b208e009248a2a9a56?d=identicon&s=25 Hampton (Guest)
on 2006-04-20 14:55
(Received via mailing list)
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.
D5145c421cd25af6fa577c15219add90?d=identicon&s=25 unknown (Guest)
on 2006-04-24 12:58
(Received via mailing list)
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
F15fdc7cb2e911b3808837f2be244add?d=identicon&s=25 Adam Denenberg (Guest)
on 2006-04-24 14:24
(Received via mailing list)
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
D5145c421cd25af6fa577c15219add90?d=identicon&s=25 unknown (Guest)
on 2006-05-08 22:11
(Received via mailing list)
Would you mind sending me that code? It'd save me from reinventing the
wheel. Thanks.
-Nathan
This topic is locked and can not be replied to.