An unofficial blog that watches Google's attempts to move your operating system online since 2005. Not affiliated with Google.

Send your tips to gostips@gmail.com.

August 1, 2007

Google Maps Adds Support for the hCard Microformat

Microformats "are simple conventions for embedding semantics in HTML". Microformats let you publish contact cards, events, addresses using a standard so that any software that implements the standard understands them. If publishers used microformats for contact cards and your browser could parse them, it would be easy to save that information and export it to another application.

Unfortunately, not many web sites use them (the most important sites that use them are owned by Yahoo: Flickr, Upcoming, Yahoo Local) and browsers need special plug-ins to understand them. But things are about to change since Firefox 3 will handle microformats natively and Google Maps started to support microformats for local search results. "Why should you care about some invisible changes to our HTML? By marking up our results with the hCard microformat, your browser can easily recognize the address and contact information in the page, and help you transfer it to an addressbook or phone more easily." Google Maps API supports this microformat as well, but developers have to change a few lines of code.

To export the results from Google Maps, you should install the Operator Firefox extension. For other browsers minus Internet Explorer, try this hCard bookmarklet. (If you know a cross-browser bookmarklet or an hCard parser that works in IE, post the URL in the comments.) These tools convert hCard to vCard, a file format that can be imported into many applications, like Outlook or the built-in Address Book from Windows and Mac. In fact, hCard is just an HTML representation of the vCard format that can be obtained by simply adding some standard class names.
<div class="vcard">
<span class="adr">
<span class="fn n">Googleplex<br />
<span class="street-address">1300 Amphitheatre Parkway</span><br />
<span class="locality">Mountain View</span>,
<abbr class="region" title="California">CA</abbr>
<span class="postal-code">94043</span>
</span>
</div>



Google could add support for microformats in its popular toolbar, which already tries to detect addresses and link them to Google Maps. Besides, if more people use microformats, Google has to do less guesswork to extract useful information and to make it searchable.

Jeremy Keith writes: "This is a huge leap in the number of published hCards on the Web. It would be interesting to get exact numbers but I'd guess that the amount of places returned in Google Maps searches runs into the millions. The beautiful thing about all this is that I suspect the change was trivially easy: just adding a few extra class names into a template."

4 comments:

  1. So what about my GMail Contacts?

    ReplyDelete
  2. For Gmail, use this vCard to CSV converter. Choose the Gmail (CSV) format and disable "vCards with e-mail only". Then import the CSV file to Gmail.

    It's funny that this microformat concept wanted to simplify things and, because of the lack of support, you need to do a lot of work to perform simple actions.

    Google Maps could have this option: "save as a Gmail contact", Gmail could understand vCards, your browser could support hCard.

    ReplyDelete
  3. I just added supports for hCard in Open Contacts program (http://www.fonlow.com/opencontacts). Actually I did not make any code change to the program, but simply wrote an XSLT file to transform Open Contacts' XML into HTML with hCard tags. Open Contacts is probably the first desktop program providing friendly supports to hCard. You may customize the XSLT file to export contact info you want to publish according your privacy policy. Please read more at
    hCard and Address Book Programs

    ReplyDelete
  4. I recently upgraded the Microformats Bookmarklet to support IE6 and IE7 - so now we've got a cross browser Microformats parser.

    ReplyDelete