ip location database

Hi,

We just got a new client who wants to personalize the content of his site's pages based on user's geographical location (using the user's IP for determining the location).

I came across http://geokit.rubyforge.org/ and it seems to be a pretty good tool, however it has one downside:

It uses hostip.info's ip location database which seems somewhat incomplete (i.e. it knows my office's ip address but did not know my San Francisco home ip address - i'm thinking that if they can't recognize a San Francisco ip address it is probably worse for places outside US).

I was wondering if anyone has came across some good ip location databases (free or not) that can be easily queried from ruby and/or rails. Once user's geo coordinates are known (lat/long), I could use geokit.rubyforge.org for distance calculations using Google or Yahoo's APIs (supported by geokit.rubyforge.org from what I could see).

Thanks,

Gabor

We just got a new client who wants to personalize the content of his site's pages based on user's geographical location (using the user's IP for determining the location).

I came across http://geokit.rubyforge.org/ and it seems to be a pretty good tool, however it has one downside:

It uses hostip.info's ip location database which seems somewhat incomplete (i.e. it knows my office's ip address but did not know my San Francisco home ip address - i'm thinking that if they can't recognize a San Francisco ip address it is probably worse for places outside US).

I was wondering if anyone has came across some good ip location databases (free or not) that can be easily queried from ruby and/or rails. Once user's geo coordinates are known (lat/long), I could use geokit.rubyforge.org for distance calculations using Google or Yahoo's APIs (supported by geokit.rubyforge.org from what I could see).

Don't know about ruby integration, but maxmind is what openads (an open source ad serving package) uses...

Just checked maxmind. Seems to fit the bill in terms of ip coverage, but they require the installation of a C API and then a Ruby API on top of it to work. Quite a hassle, given that there are many very straightforward php solutions out there.

I'm basically trying to convince my company to use RoR as opposed to PHP on this project and so far the lack of a RoR solution as straightforward as PHP makes RoR loose the game :(.

Any other suggestions of a Ruby / RoR friendly way to detect users' geolocation based on their IP address?

MaxMind has a REST web API -- it would be straightforward to call it from Ruby code. Examples in a few other languages are here:

If you use MaxMind, think about implementing it as a GeoKit Geocoder. We can then incorporate MaxMind into GeoKit.