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?

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.

Greasemonkey and microformats (5)

Leaving so soon? I was hoping to interest you on yet another release of my famous series Greasemonkey and Microformats! No, wait! Please, oh please, just a little more…

Well, for the few of you still there, here I am again at it. Today, let’s talk about something I fancy calling microformat lifecycle. It’s easy enough: you and a dozen more geeks gather around a table to despise all committee-designed monstrosities of the world and come up with a shiny new microformat. After 34 meetings. All is well and parsers flourish, but for the newfangled microformat to gain any traction, there must be some content producers slapping it into their, well, whatever is that they might be producing. Or, as Web 2.0 3.0 advocates would rather say, ‘semantically enhancing their creations’.

The key to microformats adoption would be then, to bootstrap an healthy ecosystem of both producers and consumers. Live examples can be found for the best example in established microformats: hCard. A vehicle for contact details, hCard has seen quite an adoption for several reasons:

  • It’s a semantic HTML implementation of an already established standard: RFC 2426.
  • There are readily available consumers for it. The Operator Firefox extension, which makes hCard embedded data available as vCards readable by most contact management applications, among other interesting features.
  • There are several hCard producers, the simplest one being hCard Creator. A wide sampling of the hCard ecosystem can be found in the hCard implementations page.

A main concern of microformat supporters ought to be helping the non-HTML literate masses of the world to add semantic information to their markup. But there’s a catch-22 in there, as ‘non-HTML literate masses’, as per their definition, have at best a hazy understanding of markup, and well intended pages like this hCard authoring guide aren’t to be of much help but for the most dedicated of hobbyists (well, us geeks can do with just a formal hCard description, XMDP-way, can’t we?)

As a matter of example, I’m putting my money where my mouth is and release a Greasemonkey script that adds measurement unit microformat support to Blogger‘s new post (and edit post) pages. It’s creatively called InsertUnit, and after installation (just point your Greasemonkey enabled Firefox browser to the previous link, thank you) will add a button to the Edit Html editor tab just for your measurement unit microformatting pleasure. To illustrate its workflow here are some screenshots. Who doesn’t like screenshots?

  1. First of all, select some text to denote as a measurement unit. You may skip this step and just press the damn button, already.
  2. That’s it: press the uF button. I should have come up with a better glyph, but that one (as ‘microformat’ abbreviation) is way economical, byte-wise (and not an image, if I may add).
  3. Here you can see the microformat description dialog. Any text selected in step 1 will appear into the corresponding text box, saving you some keystrokes and thus helping you avoid those dreaded RSIs.
  4. After filling the rest of the text boxes (you’ll need a scalar value for the measurement, a name for the unit —to Google’s liking— and a name for a suggested target unit —same way) you may click on the Test conversion link to do just that. If an error shows up, adjust your unit names until you get the desired result. There is no documentation on expected unit names, but Google did much work to keep it a matter of common sense.
  5. And here is the result after tapping on the OK button, in all its semantic HTML glory. Nifty, isn’t it?

Before calling it quits for the day, two remarks: you are not forced to specify a target unit name (but you should state at least a value and a unit name; the OK button doesn’t enable itself until after you’ve done so). You might be interested in marking up your units, but not keen on any particular conversion. InsertUnit is a good match with UnitFormat (as described in the third part of this post series), but by no means is a required match. You might come up with a better parser, for instance (hint, hint) one that is able to suggest target units —out of the blue, or reading from some preferences file.

Last one: now you can get this script and its natural fit from, here: UnitFormat ( and here: InsertUnit (