<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://www.dankarran.com" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>SimplePie</title>
 <link>http://www.dankarran.com/blog/tags/simplepie</link>
 <description>Latest items from dankarran.com</description>
 <language>en</language>
<item>
 <title>GeoRSS in the wild</title>
 <link>http://www.dankarran.com/blog/2007/02/georss-in-the-wild</link>
 <description>&lt;p&gt;I&#039;ve been working today to try and get Drupal&#039;s &lt;a href=&quot;http://drupal.org/project/georss&quot;&gt;GeoRSS module&lt;/a&gt; listening to more than just the deprecated Aggregator2 module to extract geographic locations from aggregated feed items. &lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;http://drupal.org/project/feedparser&quot;&gt;Feedparser module&lt;/a&gt; is the next on the list to support and as far as I&#039;m aware is the only one of Drupal&#039;s aggregation modules to use an external parsing library, &lt;a href=&quot;http://simplepie.org&quot;&gt;SimplePie&lt;/a&gt;. By using an external library it means that we don&#039;t need to deal with the sometimes complex task of parsing different types of feeds on the Drupal side, which is a bonus because efforts can be concentrated elsewhere whilst keeping the code nice and simple.&lt;/p&gt;
&lt;p&gt;SimplePie is still in development stages but appears to have a good community around it as well as a couple of active developers. They&#039;re gearing up to their 1.0 release which includes functions to extract geodata from feeds using the &lt;a href=&quot;http://www.w3.org/2003/01/geo/&quot;&gt;W3C Geo&lt;/a&gt; and &lt;a href=&quot;http://georss.org/1&quot;&gt;GeoRSS Simple&lt;/a&gt; encodings, the former being the most widespread of methods at present and the latter the one we should be moving towards using. &lt;/p&gt;
&lt;p&gt;SimplePie&#039;s code is very much based around namespaces (e.g., &lt;i&gt;xmlns:geo=&quot;http://www.w3.org/2003/01/geo/wgs84_pos#&quot;&lt;/i&gt;), which a lot of other aggregator systems will often disregard in favour of the simpler method of parsing out just the individual element names from that vocabulary (e.g., &lt;i&gt;geo:lat&lt;/i&gt; or &lt;i&gt;geo:long&lt;/i&gt;) to identify the tags. Now that namespaces have suddenly become important (at least for SimplePie&#039;s code to work), it&#039;s interesting to see how easily overlooked they have been in the past.&lt;/p&gt;
&lt;p&gt;Take, for example, the &lt;a href=&quot;http://www.geograph.org.uk&quot;&gt;Geograph&lt;/a&gt; GeoRSS feed of their latest photos: they had a trailing slash after the GeoRSS namespace URI (&lt;i&gt;http://www.georss.org/georss/&lt;/i&gt; instead of &lt;i&gt;http://www.georss.org/georss&lt;/i&gt; as it&#039;s defined in the spec). It was there because many namespaces do have the trailing slash, and simply left in by mistake, but because that&#039;s not what SimplePie was expecting, it didn&#039;t pick up the geodata in the feed. It&#039;s been fixed now (Thanks for the quick fix &lt;a href=&quot;http://www.nearby.org.uk/blog/&quot;&gt;Barry&lt;/a&gt;!). There is also the case of the &lt;a href=&quot;http://flickr.com&quot;&gt;Flickr&lt;/a&gt; GeoRSS feeds that use the wrong namespace URI (using the one for W3C Geo instead of the GeoRSS one). Hopefully &lt;a href=&quot;http://www.geobloggers.com&quot;&gt;Rev Dan Catt&lt;/a&gt; or someone else at Yahoo will be able to fix that one up.&lt;/p&gt;
&lt;p&gt;Even besides namespaces, some elements are often misused, and possibly the most widespread of those is &lt;i&gt;geo:lon&lt;/i&gt; which should in fact be &lt;i&gt;geo:long&lt;/i&gt; according to the spec. SimplePie doesn&#039;t understand the non-standard one and so can&#039;t pull the location information out of the feed. In this case, because it is so widespread, the parsing code should probably be &lt;a href=&quot;http://simplepie.org/support/viewtopic.php?id=728&quot;&gt;extended&lt;/a&gt; to look for the non-standard element if it can&#039;t find the standard one.&lt;/p&gt;
&lt;p&gt;Anyway, just some random observations of GeoRSS in the wild and how what seem like the smallest of differences can mean that the embedded location information will simply be missed by feed consumers. &lt;/p&gt;
&lt;p&gt;If you&#039;ve got a GeoRSS feed from your site, please do the right thing and make sure it&#039;s sending out the right information  :)&lt;/p&gt;
</description>
 <comments>http://www.dankarran.com/blog/2007/02/georss-in-the-wild#comments</comments>
 <category domain="http://www.dankarran.com/blog/geographic">Geographic</category>
 <category domain="http://www.dankarran.com/blog/tags/georss">georss</category>
 <category domain="http://www.dankarran.com/blog/tags/namespaces">Namespaces</category>
 <category domain="http://www.dankarran.com/blog/tags/simplepie">SimplePie</category>
 <category domain="http://www.dankarran.com/blog/tags/xml">XML</category>
 <pubDate>Tue, 13 Feb 2007 16:43:11 -0500</pubDate>
 <dc:creator>dankarran</dc:creator>
 <guid isPermaLink="false">275 at http://www.dankarran.com</guid>
</item>
</channel>
</rss>
