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>)
</span>

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:

    http://maps.yahoo.com/#mvt=m&trf=0&lon=-3.682276
    &lat=40.471706&mag=2

    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 microformats.org 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>
</div>

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…