# Ip location database

**URL:** <https://www.ruby-forum.com/t/ip-location-database/105524>\
**Category:** Rails\
**Created:** [May 30, 2007, 7:29pm UTC](https://www.ruby-forum.com/t/ip-location-database/105524 "2007-05-30T19:29:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gabordemeter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/9de053/32.png) [@gabordemeter](https://www.ruby-forum.com/u/gabordemeter)\
**Post date:** [May 30, 2007, 7:29pm UTC](https://www.ruby-forum.com/t/ip-location-database/105524/1 "2007-05-30T19:29:03Z")

</div>

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/](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](http://geokit.rubyforge.org) for distance calculations using Google or Yahoo’s  
APIs (supported by [geokit.rubyforge.org](http://geokit.rubyforge.org) from what I could see).

Thanks,

Gabor

---

<div class="post-metadata">

**Author:** ![gabordemeter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/9de053/32.png) [@gabordemeter](https://www.ruby-forum.com/u/gabordemeter)\
**Post date:** [May 30, 2007, 7:49pm UTC](https://www.ruby-forum.com/t/ip-location-database/105524/2 "2007-05-30T19:49:07Z")

</div>

> 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](http://geokit.rubyforge.org) for distance calculations using Google or Yahoo’s  
> APIs (supported by [geokit.rubyforge.org](http://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…

> **[Industry leading IP Geolocation databases and web services
 | MaxMind](https://www.maxmind.com/en/solutions/ip-geolocation-databases-api-services)**
>
> GeoIP® - the industry standard for IP geolocation. Covers 99.9999% of IP
> addresses. Trusted by businesses and developers globally for high accuracy and
> reliability.

---

<div class="post-metadata">

**Author:** ![gabordemeter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/9de053/32.png) [@gabordemeter](https://www.ruby-forum.com/u/gabordemeter)\
**Post date:** [May 30, 2007, 11:02pm UTC](https://www.ruby-forum.com/t/ip-location-database/105524/3 "2007-05-30T23:02:37Z")

</div>

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

> **[GeoIP Legacy Web Services](https://dev.maxmind.com/geoip/docs/web-services/legacy)**
>
> Develop applications using industry-leading IP intelligence and risk scoring.

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

---

<div class="post-metadata">

**Author:** ![gabordemeter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/9de053/32.png) [@gabordemeter](https://www.ruby-forum.com/u/gabordemeter)\
**Post date:** [May 30, 2007, 10:34pm UTC](https://www.ruby-forum.com/t/ip-location-database/105524/4 "2007-05-30T22:34:31Z")

</div>

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?
