You have reached the end of the internet; turn back now.

GeoIP Perl scripts

Here's some fun with GeoIP. First, the whereami perl script can tell you where you're at (sometimes). When this CGI script recieves a request, it will output a map to show you where you're at. Try it out.

I recently wrote a perl script for Xchat that can perform all kinds of nifty GeoIP goodness, including generating maps of the world with indications of where everyone you are talking to is at.

It can simply tell you where someone is at:

/geo-lookup ScribbleJ
 ScribbleJ GeoIP Lookup
 ScribbleJ @ il.comcast.net
 City: Carol Stream State/Region: IL Country: United States 
 Postal Code: 
 Latitude: 41.9153 Longitude: -88.1287

Or, it can create a complete map, with everyone's locations nicely plotted out.

Here's a sample map, created from #postgresql and #perl on irc.freenode.net. Note that the output from the script is a nice png, but I had to compress the heck out of it and turn it into a jpg before I posted it on my site. You will probably have to zoom in over the US or Europe to see the labels.

All the documentation is inside the script.

Image::WorldMap

Image::WorldMap has been a great help to me, but it's got some pretty severe "limitations." I haven't had the time yet to update it as fully as it needs. When I do, shall upload it to CPAN. Until then, you may want my patched version.

Patched Image::WorldMap

MaxMind Database

Although I am not distibuting the MaxMind GeoIP database on which this script relies, I believe I am obligated to inform you that: "This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com/."

And while it's not true that this "product" includes the data, it is true that you're going to have to get it to make this work. Thanks to the people at MaxMind for the dataset!

Please see the documentation in the script for info on MaxMind, WorldMap, the default settings, etc.

Fonts?

You may also want the font I used for testing?

Rationale

Although it may be popular and easier and cooler to do this kind of thing through, for example, google's web APIs, I needed a way to work with GeoIP data that was completely Free and wouldn't require the delay for a web request for each lookup. This little script is a spin-off of that project. I hope you can use it - send me an e-mail if you like it.