Midgard and geotagging via email
Midgard is becoming smarter about tags. Now it not only supports tagging any objects and making tags contextual, but also machine tags:
You know those funky tags like
cell:cellid=197216005
,geo:tool=GMiF
and evencamel:size=medium
you see around the place? Well yeah, we’ve been watching them very closely too, and by “we’ve” I mean a few of us here in the office that care very much about these things, Aaron probably more than most of us.
The first application for machine tags is geotagging. We were discussing the problem of geotagging entries by email with Andrew Turner and trying to come up with a solution that would work in both Midgard and GeoPress. The decision was to support the Flickr email-based tagging format.
This means that to geotag a blog entry, just include the following to the end of email body:
tags: geo:long=24.9419260025024 geo:lat=60.1587851399795
Tools like Flickr email import, Geopress and Midgard will be able to parse this information and position your blog entry accordingly, on both site and GeoRSS feeds.
Of course, the same format can be used for regular tagging:
tags: waterpipe n800 canola sabrage
Machine tags as a record extension
Now that machine tags are in, pulling information from them is quite easy. Here’s an example using the camel:size=medium
tag from Dan Catt’s post:
<?php
// Load a camel photo
$photo = new org_routamc_photostream_photo_dba('GUID');
// Load camel-related data from the tags
$data = net_nemein_tag_handler::get_object_machine_tags_in_context($photo, 'camel');
// Show the data
echo "{$photo->title} is a {$data['size']} sized camel.";
?>
As is visible from this example, machine tags can be used in a bit similar way as parameters are used in the Midgard world. The advantage machine tags have however is that they are compatible with any system that supports tagging.
Updated: There is even a wiki for formalizing machine tagging conventions.