views:

412

answers:

4

I need a client side API in either Java or Ruby. I would much prefer need this to be LOCAL only. Infact this might not even be an IP, but more of a database import. The thing is that I cannot make use of a web service based one as that is too much heavy I/O for me.

Note: By geolocation, all I really need is country/region at best. I would accept actual lat/long cordinates as well.

+3  A: 

I was looking at these guys a couple months ago: http://www.maxmind.com/app/geolitecountry

It seemed OK, for my limited purposes.

Pointy
They offer a free light-weight CSV file which for me, is perfect. 30mb, all I needed and seems up to date. Thanks. They also offer API's for most all common languages.
Zombies
+1  A: 

a quick google search yielded this result: http://www.hostip.info/dl/index.html

I think it is what you are looking for.

João Portela
Nice find. It might be really out dated, looking through the sql file i see time stamps from 2003. Also oddly enough 1 line had to be commented out for it to compile. it is a 300mb sql file, and it is taking awhile to exectue (been running for an hour so far).
Zombies
so, did i work? i downloaded it but just had a look and didn't install. even if it is from 2003 most IP addresses will be correct :)
João Portela
A: 

For a web based one you can use: http://code.google.com/apis/ajaxsearch/. All you do is have:

<script type="text/javascript" src="http://www.google.com/jsapi?key=yourapikey"&gt;&lt;/script&gt;

and now Google populates some javascript variables and in your other js scripts you can now access geographic location using: google.loader.ClientLocation.address.city, google.loader.ClientLocation.address.region, google.loader.ClientLocation.address.country.

For a very rough and local solution you can get the IP ranges of countries here: http://www.countryipblocks.net/continents/. You can basically store this locally and reference it to get a rough geographic location.

jcmoney
A: 

You can program a small Javascript function to utilize AJAX to connect to a web service such as http://www.ip2location.com/ip-country-web-service.aspx which will return the country to you. This way, all the work is done by the client side.

Alternatively, you can get the database from IP2Location and then check the visitor’s IP on the server side.

Souless