This is likelly old news to some, but Google Maps has an API that can return location coordinates. I’ve always wanted to know what the longitude and latitude of my house is, and short of going out and getting a GPS device, I hadn’t really tried to figure it out (yes i am lazy, or rather just too busy :)). Well today I did, and i also wanted to have a quick command line way to find other locations. The Google API has a REST HTTP interface. One easy way to call this, is to use wget. But I wanted Ruby. So i wrote a little script which at its core has:

open(’http://maps.google.com/maps/geo?q=’ + q + ‘&output=’ + format + ‘&key=’ + key) {|f|
f.each_line {|line|
result = line.split(’,')
}
}

The output option is nice. I default to ‘csv’ which ruby handles easely since I am only interested in the longitude and latitude, but you can get XML and JSON.

The rest of the script is just picking up command line options and output. Which by the way, it looks like Ruby could really use a nice command line options interface. It has 2, but it would be nice to have something built in that is stupid simple. GetoptLong is identical to get_optlong(), and and OptionParser seems to be the new kid on the block, but the documentation is horrid. Or maybe its just too rubish for my understanding at this time. But back to the topic…
Geotagging appears to be a growing trend, but it appears that there is no standard format of specifyinc this information. Any clues out there of what are the best options to geotag pages? Or even blog posts (that would be cooler then a page since you can write a blog from almost anywhere).

Update:

Interesting links:
geocoder.us
geocoder.ca
feedmap
plazes