Geocoding while blogger (2)

Welcome! As promised in my previous post, today I am releasing a Greasemonkey script that allows geocoding, using the geo microformat, in Blogger‘s interface. Remember my previous fit of creativity concerning names? Well, I’ve decided to name this one InsertGeo (don’t laugh at me, just click on this link if you want to install it without reading any further; of course, this assumes Greasemonkey is already installed and in good working order on your Firefox). The screen capture next to this paragraph gives an idea about what to expect after installation.

This script will add a button to the Edit Html editor tab on Blogger’s new post and edit post pages. You may select some text in the editing area before pressing the button; the text box will appear filled with the selected text, which may be edited. Or you might prefer not to select anything beforehand: just enter in the text box the address you want to have geocoded. Press OK, and after a (hopefully) short wait you will see the geo microformat code entered in your post.

This is the kind of code the script generates for a certain address (incidentally, where I spent my much remembered last vacations):

  • Address to geocode:

Avenida de la Mojarra, Ayamonte, Huelva, Spain

  • Microformat generated:
<span class="geo">Avenida de la Mojarra, Ayamonte, Huelva, Spain (
  <abbr class="latitude" title="37.186030">37º11'10" N</abbr> 
  <abbr class="longitude" title="-7.338429">7º20'18" W</abbr>)

Avenida de la Mojarra, Ayamonte, Huelva, Spain (37º11’10” N 7º20’18” W)

The actual geocoding is performed by Yahoo Pipes. There are other services available on the Net, but the flexibility and extensibility of Pipes is as hard a match as you could find. The pipe I am using (also by yours truly) is called geoloc_pipe; if you take a peek at it, you will notice that there is more data built into the feed than it’s needed to compose a geo microformat. In fact, just enough to generate an adr microformat. An idea for further development?

Geocoding while blogger

Suppose you go somewhere cool on vacation —it has to be cool enough so as to trigger show-off reflexes. Blogging about it, you’d think how nice would be that your mother readers could click on something to have the location displayed on a mapping service (Google Maps, Yahoo Maps and the like). Let’s envision some scenarios:

  1. You look up your vacation spot on some of those mapping services, and link the result page from your blog. This has the drawback of denying your readers of their choice concerning mapping providers; moreover, it’s not always trivial to discover the URL to link to (hint: with Yahoo Maps, you have to copy&paste the URL from your browser’s direction box; Google Maps offers a Link to this page tool).
  2. Same as before, but getting (somehow) longitude and latitude and paste those in your blog. This is not trivial with both main mapping providers: coordinates are there, but they are hidden in plain sight. You have to rip them off from the result page URL:

    There you are: coordinates in decimal degrees. You have more work to do if you want to show your location in a more readable format, i.e., DMS. Plus, you have to rely on your readers introducing manually the data into their mapping provider of choice, which could be more hassle than it’s worth.

  3. Use a geo microformat to mark up your location data. You still have to obtain geographic coordinates from somewhere, plus you have to insert appropriate HTML to compose a valid geo microformat. On the other side, your readers can benefit from having the microformat automatically parsed for them and available on their mapping tool of choice (just be sure to direct them towards the Operator Firefox extension, for instance).

There is a lot of work to be done in order to geoenable your content. For one, manually composing a microformat, even a simple one like geo, is a hassle (this example was lifted straight from wiki):

<div class="geo">
 <abbr class="latitude" title="37.408183">N 37° 24.491</abbr> 
 <abbr class="longitude" title="-122.13855">W 122° 08.313</abbr>

Then there is the issue of extracting latitude and longitude for your location-based content. This process, termed , can be automated with a high reliability level. Furthermore, there are several APIs available as services all over the Net. This begs the question: is it possible to tie up every piece together, geocoding and microformat composition? A tool to close the geo microformat lifecycle would be a boon to a wide geo microformat adoption.

Now you know what I am about to release in the next post…

Script updates

UnitFormat and InsertUnit, the sibling scripts from the series Greasemonkey and Microformats have been updated to reflect a little addition to the underlying measurement unit microformat: now, null units are supported (with unit name null) when converting among bases or from/to roman numerals.

This is only a convenience measure to account for the fact that Google Calculator does not understand queries with a source unit when the target one is a number base or ‘roman’: the expected

255 decimal in hex

does not work, and instead

255 in hex

must be used. The measurement unit microformat accomodates this quirk by adding a null unit that can be used as source whenever such a conversion should take place.

The updated dialog of InsertUnit looks now like this:

Of course, nothing forces you not to declare yourself a purist and specify your source units as decimal, hex, octal, binary or even roman, but for now UnitFormat, the other side of the coin, won’t properly handle those values (that’s it, by ignoring them). I’ll post an update as soon as this issue is properly handled. See you!

Update (20070816163700) It’s done now.