Have you ever wanted to determine geographical information about an IP address? There are a growing number of services to accomplish this goal that are a mix of on-demand and offline bulk database services.

Let’s take a look at the Quova API using Ruby.
Hello Visitor From {City}, {State}
So-called IP intelligence and geolocation companies provide a mapping database where IP addresses are associated with a specific collection of geographic information and other metadata. If you’ve ever visited a website that appears to know where you are located but without a browser prompt to allow you providing your location — you’ve experienced how these IP intelligence services are used.
Of course, these “Hi visitor from….” messages can be creepy and sometimes they are wrong. In many cases, the geographic information is based on the larger allocations of Internet addressing blocks and further refined based on a variety of lesser vetted databases that can be queried. Typically, the data returned is only as good as the Internet provider that maintains the block of IP addresses and their own metadata through the SWIP process and related country specific policies.
That said, there are very useful things gleaned from looking up IP addresses in this way. You might recall our RWH YQL example #4 a few articles ago to perform such a query on 8.8.8.8 (i.e. Google’s DNS service).
The Quova API
So what is the Quova API?
The Quova API lets you plug into the vast world of IP intelligence, allowing you to instantly build your own Quova-powered applications for the web, desktop and mobile devices.
[…]
You query the Quova database with an IP address and Quova returns the location, confidence and network intelligence information. Access to the Quova data can be through our GeoDirectory Server or on our On-Demand service. Installation is simple – in as little as 30 minutes you can be retrieving the data.
In our case, it took about 3 minutes to get our API key, confirm an email, then cut/paste from the examples provided. The Quova documentation includes sode samples for PHP, Python, Java, Ruby, Perl as well as C#.
In this Ruby example, we’ve simply expanded ip_address to accomplish another external call for testing from a given host (try this on your VPS for example).
Here is the response you would get (this example is from a WiFi connection in Boston)
So how did we do?
It we plot the provided LAT/LONG we get… an accurate (well, by 20 miles at least) representation of where this query was performed geographically. Of course, VPNs and poorly documented networks can fuzz up results but this was a just a simple IPv4 example. This was more than enough accuracy for basic visitor profiling by IP address. While not ideal for real time routing information in location based services applications, it is a nice hedge and another way to qualify where your visitors might be.
What are your favorite IP geolocation services? Let us know in the comments below!