{"id":753,"date":"2010-04-22T22:37:45","date_gmt":"2010-04-22T21:37:45","guid":{"rendered":"http:\/\/www.meanboyfriend.com\/overdue_ideas\/?p=753"},"modified":"2010-04-22T22:37:45","modified_gmt":"2010-04-22T21:37:45","slug":"putting-warwickshire-libraries-on-the-map","status":"publish","type":"post","link":"http:\/\/www.meanboyfriend.com\/overdue_ideas\/2010\/04\/putting-warwickshire-libraries-on-the-map\/","title":{"rendered":"Putting Warwickshire Libraries on the map"},"content":{"rendered":"<p>I was very pleased to see earlier this week that <a href=\"http:\/\/warwickshireopendata.wordpress.com\/\">Warwickshire County Council had started to release data sets openly on the web<\/a>. The data is <a href=\"http:\/\/opendata.warwickshire.gov.uk\/pages\/license\">released under a Creative Commons Attribution-Share alike license<\/a>, and I guess builds on the <a href=\"http:\/\/data.gov.uk\/\">central government data.gov.uk initiative<\/a>. While at the moment there are only a few datasets, <a href=\"http:\/\/warwickshireopendata.wordpress.com\/\">the blog promises<\/a> more in the very near future. You can see the data that has been released so far at <a href=\"http:\/\/opendata.warwickshire.gov.uk\/categories\">http:\/\/opendata.warwickshire.gov.uk\/categories<\/a><\/p>\n<p>Today I saw an announcement from their <a href=\"http:\/\/twitter.com\/WCCOpenData\">@wccopendata\u00a0twitter feed<\/a> that they had put an xml feed of Warwickshire libraries on the site. I took a quick look, and saw it included location coordinates I thought I&#8217;d do a really quick map mashup. This is entirely based on something I&#8217;d seen <a href=\"http:\/\/twitter.com\/psychemedia\">Tony Hirst<\/a> do a while back which he blogged at <a href=\"http:\/\/arcadiamashups.blogspot.com\/2009\/11\/open-library-training-materials-and.html\">http:\/\/arcadiamashups.blogspot.com\/2009\/11\/open-library-training-materials-and.html<\/a>.<\/p>\n<p>The mashup uses Yahoo Pipes, and makes use of the fact that if you include location information in the right place in the Yahoo Pipes output it will automatically show a map of the results.<\/p>\n<p>The first thing you need to do is get the xml data using the Pipes &#8216;Fetch Data&#8217; module &#8211; this just needs the URL of the xml file:<\/p>\n<p><a href=\"http:\/\/www.meanboyfriend.com\/overdue_ideas\/wp-content\/uploads\/2010\/04\/fetch-data.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-754\" title=\"fetch data\" src=\"http:\/\/www.meanboyfriend.com\/overdue_ideas\/wp-content\/uploads\/2010\/04\/fetch-data.jpg\" alt=\"\" width=\"328\" height=\"88\" srcset=\"http:\/\/www.meanboyfriend.com\/overdue_ideas\/wp-content\/uploads\/2010\/04\/fetch-data.jpg 328w, http:\/\/www.meanboyfriend.com\/overdue_ideas\/wp-content\/uploads\/2010\/04\/fetch-data-300x80.jpg 300w\" sizes=\"auto, (max-width: 328px) 100vw, 328px\" \/><\/a><\/p>\n<p>I&#8217;ve also had to put the &#8216;path to item list&#8217; &#8211; in this case if you look at the xml file you can see the structure is something like:<\/p>\n<p>&lt;libraries&gt;<br \/>\n&lt;library&gt;<br \/>\n&lt;&#8230; name, address, stuff &#8230;&gt;<br \/>\n&lt;\/library&gt;<br \/>\n&lt;library&gt;<br \/>\n&lt;&#8230; name of second library, address, stuff &#8230;&gt;<br \/>\n&lt;\/library&gt;<br \/>\n&lt;\/libraries&gt;<\/p>\n<p>Since the details of each library are within the &#8216;library&#8217; tag, and I want each library to appear as an individual item in the list, this is what goes in the &#8216;Path to item list&#8217;.<\/p>\n<p>An important aspect of using pipes is that getting the output to display as you want, you have to put the relevant information in specific fields (or give the relevant fields the right names). In this case, I want the library name to appear as the main heading in the output &#8211; which means it has to be in the &#8216;title&#8217; field. In the original XML file, the name of the library is in a &lt;name&gt; tag, so this needs to be renamed &#8211; and pipes provide a function that does this:<\/p>\n<p><a href=\"http:\/\/www.meanboyfriend.com\/overdue_ideas\/wp-content\/uploads\/2010\/04\/rename-name.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-755\" title=\"rename name\" src=\"http:\/\/www.meanboyfriend.com\/overdue_ideas\/wp-content\/uploads\/2010\/04\/rename-name.jpg\" alt=\"\" width=\"417\" height=\"84\" srcset=\"http:\/\/www.meanboyfriend.com\/overdue_ideas\/wp-content\/uploads\/2010\/04\/rename-name.jpg 417w, http:\/\/www.meanboyfriend.com\/overdue_ideas\/wp-content\/uploads\/2010\/04\/rename-name-300x60.jpg 300w\" sizes=\"auto, (max-width: 417px) 100vw, 417px\" \/><\/a><\/p>\n<p>There are two bits of &#8216;location&#8217; information in the original feed &#8211; the address (including postcode) and some &#8216;coordinates&#8217;. I guess these are OS coordinates, but I haven&#8217;t really checked &#8211; luckily Pipes is cleverer than me, and has a way of automatically understanding some types of &#8216;location&#8217; information. In this case I can just push the coordinates through a &#8216;location builder&#8217;:<\/p>\n<p><a href=\"http:\/\/www.meanboyfriend.com\/overdue_ideas\/wp-content\/uploads\/2010\/04\/location.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-756\" title=\"location\" src=\"http:\/\/www.meanboyfriend.com\/overdue_ideas\/wp-content\/uploads\/2010\/04\/location.jpg\" alt=\"\" width=\"461\" height=\"168\" srcset=\"http:\/\/www.meanboyfriend.com\/overdue_ideas\/wp-content\/uploads\/2010\/04\/location.jpg 461w, http:\/\/www.meanboyfriend.com\/overdue_ideas\/wp-content\/uploads\/2010\/04\/location-300x109.jpg 300w\" sizes=\"auto, (max-width: 461px) 100vw, 461px\" \/><\/a><\/p>\n<p>The place you &#8216;assign results&#8217; to is important &#8211; it is putting the location information in this field that makes the output automatically appear as a map. This was a trick copied directly from <a href=\"http:\/\/pipes.yahoo.com\/pipes\/pipe.info?_id=fb5ef40222bc84ae6a23446438a4a307\">Tony&#8217;s pipe<\/a>.<\/p>\n<p>Finally I noticed there was a link to an image for each library in the xml, and thought it would be nice to include this in the output. I knew that this would need to go as an HTML Image tag in a &#8216;description&#8217; field, so I used a loop and &#8216;string builder&#8217; function to do this:<\/p>\n<p><a href=\"http:\/\/www.meanboyfriend.com\/overdue_ideas\/wp-content\/uploads\/2010\/04\/description.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-757\" title=\"description\" src=\"http:\/\/www.meanboyfriend.com\/overdue_ideas\/wp-content\/uploads\/2010\/04\/description.jpg\" alt=\"\" width=\"443\" height=\"208\" srcset=\"http:\/\/www.meanboyfriend.com\/overdue_ideas\/wp-content\/uploads\/2010\/04\/description.jpg 443w, http:\/\/www.meanboyfriend.com\/overdue_ideas\/wp-content\/uploads\/2010\/04\/description-300x140.jpg 300w\" sizes=\"auto, (max-width: 443px) 100vw, 443px\" \/><\/a><\/p>\n<p>The first line and last line puts the image tag stuff in, and the item.image pulls the link from the XML file.<\/p>\n<p>That&#8217;s it &#8211; the whole pipe:<\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/www.meanboyfriend.com\/overdue_ideas\/wp-content\/uploads\/2010\/04\/whole-pipe.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-758\" title=\"whole pipe\" src=\"http:\/\/www.meanboyfriend.com\/overdue_ideas\/wp-content\/uploads\/2010\/04\/whole-pipe.jpg\" alt=\"\" width=\"682\" height=\"354\" srcset=\"http:\/\/www.meanboyfriend.com\/overdue_ideas\/wp-content\/uploads\/2010\/04\/whole-pipe.jpg 974w, http:\/\/www.meanboyfriend.com\/overdue_ideas\/wp-content\/uploads\/2010\/04\/whole-pipe-300x155.jpg 300w\" sizes=\"auto, (max-width: 682px) 100vw, 682px\" \/><\/a><\/p>\n<p>If you look at the <a href=\"http:\/\/pipes.yahoo.com\/ostephens\/bf4617d9599c19dd15ff49f8f9b9e586\">results of the pipe<\/a> you can see that because all the data is in the right fields, the results automatically appear on a map:<\/p>\n<p><a href=\"http:\/\/www.meanboyfriend.com\/overdue_ideas\/wp-content\/uploads\/2010\/04\/warwickshire-library-pipe.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-760\" title=\"warwickshire library pipe\" src=\"http:\/\/www.meanboyfriend.com\/overdue_ideas\/wp-content\/uploads\/2010\/04\/warwickshire-library-pipe.jpg\" alt=\"\" width=\"705\" height=\"664\" srcset=\"http:\/\/www.meanboyfriend.com\/overdue_ideas\/wp-content\/uploads\/2010\/04\/warwickshire-library-pipe.jpg 705w, http:\/\/www.meanboyfriend.com\/overdue_ideas\/wp-content\/uploads\/2010\/04\/warwickshire-library-pipe-300x282.jpg 300w\" sizes=\"auto, (max-width: 705px) 100vw, 705px\" \/><\/a><\/p>\n<p>I&#8217;m hoping that I might get a chance to play a bit more with this data &#8211; perhaps at the upcoming <a href=\"http:\/\/www.mashedlibrary.com\/wiki\/index.php?title=Liver_and_Mash\">Mashed Library event &#8216;Liver and Mash&#8217;<\/a>. If anyone is interested in a &#8216;take away&#8217; exercise, you could try to do the same thing with the <a href=\"http:\/\/opendata.warwickshire.gov.uk\/datasets\/museums-and-galleries\">Warwickshire Museums and Art Galleries data<\/a> \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was very pleased to see earlier this week that Warwickshire County Council had started to release data sets openly on the web. The data is released under a Creative Commons Attribution-Share alike license, and I guess builds on the central government data.gov.uk initiative. While at the moment there are only a few datasets, the [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[43,42],"class_list":["post-753","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-mashups","tag-pipes"],"_links":{"self":[{"href":"http:\/\/www.meanboyfriend.com\/overdue_ideas\/wp-json\/wp\/v2\/posts\/753","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.meanboyfriend.com\/overdue_ideas\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.meanboyfriend.com\/overdue_ideas\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.meanboyfriend.com\/overdue_ideas\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.meanboyfriend.com\/overdue_ideas\/wp-json\/wp\/v2\/comments?post=753"}],"version-history":[{"count":5,"href":"http:\/\/www.meanboyfriend.com\/overdue_ideas\/wp-json\/wp\/v2\/posts\/753\/revisions"}],"predecessor-version":[{"id":767,"href":"http:\/\/www.meanboyfriend.com\/overdue_ideas\/wp-json\/wp\/v2\/posts\/753\/revisions\/767"}],"wp:attachment":[{"href":"http:\/\/www.meanboyfriend.com\/overdue_ideas\/wp-json\/wp\/v2\/media?parent=753"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.meanboyfriend.com\/overdue_ideas\/wp-json\/wp\/v2\/categories?post=753"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.meanboyfriend.com\/overdue_ideas\/wp-json\/wp\/v2\/tags?post=753"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}