Here are two easy ways to add location tags to your weblog entries or RSS feed items.
Weblogs and RSS syndication are drastically changing the way people read, write, and experience the Web. As could be predicted, location figures heavily into many of the sort of things people like to blog about: vacations, sporting events, concerts, and so on. We'll examine two simple methods to add location tags to your weblog, using plug-ins for Movable Type and Radio Userland, but the same principles apply to any RSS feed.
First, let's have a closer look at geotagged RSS. RSS 1.0, 2.0 (http://blogs.law.harvard.edu/tech/rss), and Atom are extendable with XML namespaces. There are two commonly used namespaces to represent location: the RDF Interest Group Geo vocabulary (http://www.w3.org/2003/01/geo/) and the ICBM namespace (http://postneo.com/icbm/). The examples here will use RSS 2.0 with the RDFIG Geo vocabulary, but other combinations are possible. Here's what RSS2+Geo looks like:
Taqueria Vallartahttp://www.taqueria-vallarta.com This taqueria in Santa Cruz, CA is an excellent value. Get the Super Vegetarian with extra guacamole. 36.9716 -122.0253
That's all there is to it. Now, mapping applications that know how to speak RDFIG Geo will able to make use of this information when reading your blog feeds, while RSS readers and aggregators that don't will simply read the item as normal.
|
4.5.1. Adding Location Tags to Movable Type
To publish RSS2+Geo with Movable Type, we'll build on Timothy Appnel's Meta plug-in (http://mt-plugins.org/archives/entry/meta.php). It's described as "a simple lightweight Movable Type plugin for displaying embedded meta data in either keywords or text_more fields represented in a basic XML format." The plug-in uses an XML format with a meta root element and a single layer of XML elements and values, which are then available as key-value pairs to any Movable Type template.
Install the plug-in on your Movable Type server, and choose either the keywords or text_more field for entering geographic metadata. (We'll assume keywords from here on.) Make sure that field is visible on the Edit Entry screen, via the "Customize the display of this page" link. When writing an entry, you can specify the location of the entry with a small bit of markup, indicating its latitude and longitude:
36.9716 -122.0253
In order for this meta markup to show up in your RSS feed, you'll next need to edit the RSS 2.0 template on the Edit Templates screen, adding the following code. There are several Movable Type tags implemented by the Meta plug-in. Used as follows within an RSS item, a latitude and longitude will be added to the RSS feed whenever they are present:
<$MTMetaValue name="lat"$> <$MTMetaValue name="lon"$>
Finally, don't forget to declare the geo namespace, by adding the following attribute to the root element:
xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">
|
4.5.2. Adding Location Tags to Radio Userland
For Radio Userland, it's a bit of an easier ride to get to RSS2+Geo. The Location tool (http://radio.weblogs.com/0100875/location/) uses Radio's callback mechanisms to add latitude and longitude inputs to the post form and includes those entries in the RSS file. Simply download and install the tool, and you're all set.
The Location tool also defines a <%locationlink%> tag, which displays a small globe linking to a map of the location specified. You can add it to your itemTemplate.txt like so:
<%locationlink(<%itemNum%>)%>
Congratulations, your weblog posts are now location-enabled and ready to be mapped, for example, with RDFMapper [Hack #21] ! See http://www.mapbureau.com/rdfmapper/ for more on this, or the next hack [Hack #39] for a related hack.
Mikel Maron
Mapping Your Life
Mapping Your Neighborhood
Mapping Your World
Mapping (on) the Web
Mapping with Gadgets
Mapping on Your Desktop
Names and Places
Building the Geospatial Web
Mapping with Other People