3 Free Ways to Geolocate By IP

Adam DuVander
Mar. 31 2009, 02:37AM EDT

Dating websites don't have anything on you now. Convert an Internet user's current IP address (like 208.75.242.38) to a city name, or even geo coordinates with these IP lookup APIs. And do it for free.

Hostip.info is a community-powered database of IP mapping. Its REST API is easy to incorporate into server-side code, with several options for the type of output. Check out our hostip.info API profile, where you can see the mashups already using this API.

Blogama (now IPInfoDB) is a new IP geolocation API with streamlined data based on the MaxMind API. Marc-Andre Caron reduced duplication and surprisingly has a database of only 1.2 million records that is still incredibly accurate to the city level. Even better, as Make pointed out, you can load the data into your own database for speedier access. Our IPInfoDB API profile.

MaxMind is an API of a different sort. Rather than call to a web service, its free version is distributed as a binary. There are open source libraries for common programming languages to access the IP data. Find out more in our MaxMind GeoIP API profile.

Now that you can find your user's location, what can you do? For starters, how about centering your map mashup automatically on the user's city? If your site requires registration, why not help fill out that profile?

How will you use this geo data? Is it cool, or a little creepy?

Adam DuVander -- Adam heads developer relations at Orchestrate, a database-as-a-service company. He's spent many years analyzing APIs and developer tools. Previously he worked at SendGrid, edited ProgrammableWeb and wrote for Wired and Webmonkey. Adam is also the author of mapping API cookbook Map Scripting 101.

Comments

Comments(20)

[...] Marc-Andre Caron compiled a MySQL IP database that you can install on your own server. Read on for some basic instructions to roll your own geocoder. If you’d rather use a web service to get at the data, check out my post at ProgrammableWeb. [...]

Larry

The SpamID.net IP locator is also programmable and free. It doesn't use a large database, but instead locates in real time. Its main advantage over hostip.info is that it returns a lot more locations. Its main advantage over Maxmind's free product is that it is not affected by newly routable or reassigned IP addresses, which Maxmind often takes months to update. Its main disadvantage is that some queries take longer to run -- the tradeoff of not maintaining a large database that can have out of date entries at any particular moment.

dave

Actually their all rather uninteresting as the location given is the registered address of the IP block register assignee - typically the tier 2 or 3 internet provider. As a result the results are generally useless if you actually want to know with any degree of certainty where the user is. As an example choose some SingTel IPs in the continental US. All three GeoIP sources (which use the same source data anyway) will claim that the host is in Singapore - useless.

I would like to show some appreciation to the writer just for bailing me out of such a crisis. Right after surfing around through the the web and seeing thoughts that were not powerful, I was thinking my life was over. Living without the presence of answers to the problems you've fixed as a result of your main guideline is a crucial case, and ones which might have adversely affected my career if I hadn't encountered your blog post. Your training and kindness in handling a lot of stuff was precious. I am not sure what I would have done if I had not come across such a solution like this. It's possible to now look forward to my future. Thanks for your time very much for this skilled and effective guide. I won't think twice to recommend your site to anybody who should have support on this problem.

Today, I went to the beach front with my children.

I found a sea shell and gave it to my 4 year old daughter and said "You can hear the ocean if you put this to your ear." She

put the shell to her ear and screamed. There was a hermit crab inside and it pinched her ear.

She never wants to go back! LoL I know this is completely

off topic but I had to tell someone!

Cool, not creepy. I am required to post certain statutory notices on sales pages by the laws of the country where my business operates. If I am serving a page outside that country I do not want the statutory notice as it is just plain annoying. Geolocation of IPs is the way to go!