<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Code: Flickr Developer Blog &#187; shapefiles</title>
	<atom:link href="http://code.flickr.com/blog/tag/shapefiles/feed/" rel="self" type="application/rss+xml" />
	<link>http://code.flickr.com/blog</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Thu, 19 Nov 2009 15:59:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Flickr Shapefiles Public Dataset 1.0</title>
		<link>http://code.flickr.com/blog/2009/05/21/flickr-shapefiles-public-dataset-10/</link>
		<comments>http://code.flickr.com/blog/2009/05/21/flickr-shapefiles-public-dataset-10/#comments</comments>
		<pubDate>Thu, 21 May 2009 23:58:53 +0000</pubDate>
		<dc:creator>aaron</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[clustr]]></category>
		<category><![CDATA[creativecommons]]></category>
		<category><![CDATA[geo]]></category>
		<category><![CDATA[shapefiles]]></category>

		<guid isPermaLink="false">http://code.flickr.com/blog/?p=904</guid>
		<description><![CDATA[
				

					photo by dp
				

The name sort of says it all, really, but here&#8217;s the short version:
We are releasing all of the Flickr shapefiles as a single download, available for use under the Creative Commons Zero Waiver. That&#8217;s fancy-talk for &#8220;public domain&#8221;.
The long version is:

To the extent possible under law, Flickr has waived all copyright and related [...]]]></description>
			<content:encoded><![CDATA[<div>
				<a href="http://www.flickr.com/photos/dianeperson/3356117774/" title="Yes, it is. by dp., on Flickr"><img src="http://farm4.static.flickr.com/3442/3356117774_d5b4d901a6.jpg" width="500" height="375" alt="Yes, it is." style="padding:10px;border:1px dotted #ccc;margin-top:20px;margin-bottom:10px;"/></a></p>
<div style="font-size:small;margin-bottom:20px;text-align:right">
					photo by <a href="http://www.flickr.com/photos/dianeperson/3356117774/">dp</a>
				</div>
</p></div>
<p>The name sort of says it all, really, but here&#8217;s the short version:</p>
<p>We are releasing all of <a href="http://code.flickr.com/blog/2008/10/30/the-shape-of-alpha/">the Flickr shapefiles</a> as a single download, available for use under the <a href="http://creativecommons.org/publicdomain/zero/1.0/">Creative Commons Zero Waiver</a>. That&#8217;s fancy-talk for &#8220;public domain&#8221;.</p>
<p>The long version is:</p>
<blockquote>
<p>To the extent possible under law, Flickr has waived all copyright and related or neighboring rights to the &#8220;Flickr Shapefiles Public Dataset, Version 1.0&#8221;. This work is published from the United States. <i>While you are under no obligation to do so, wherever possible it would be extra-super-duper-awesome if you would attribute <a href="http://www.flickr.com/">flickr.com</a> when using the dataset. Thanks!</i></p>
</blockquote>
<p>We are doing this for a few reasons.</p>
<ul>
<li style="margin-bottom:15px;">We want people (developers, researchers and anyone else who wants to play) to find new and interesting ways to use the shapefiles and we recognize that, in many cases, this means having access to the entire dataset.</li>
<li style="margin-bottom:15px;font-size:auto;">We want people to feel both comfortable and confident using this data in their projects and so we opted for a public domain license so no one would have to spend their time wondering about the issue of licensing. We also think the work that the <a href="http://www.creativecommons.org/">Creative Commons</a> crew is doing is valuable and important and so we chose to release the shapefiles under the <a href="http://wiki.creativecommons.org/CC0">CC0</a> waiver as a show of support.</li>
<li style="margin-bottom:15px;">We want people to create their own shapefiles and to share them so that other people (including us!) can find interesting ways to use them. We&#8217;re pretty sure there&#8217;s something to this &#8220;shapefile stuff&#8221; even if <a href="http://www.flickr.com/photos/junku/sets/303691/">we can&#8217;t always put our finger on it</a> so if publishing the dataset will encourage others to do the same then we&#8217;re happy to do so.</li>
</ul>
<div>
				<a href="http://www.flickr.com/photos/mbkepp/3205712102/"><img src="http://farm4.static.flickr.com/3344/3205712102_0997aa9218.jpg" height="500" width="500" alt="buster tries to solve our TV problems" style="padding:10px;border:1px dotted #ccc;margin-top:20px;margin-bottom:10px;"/></a></p>
<div style="font-size:small;margin-bottom:20px;text-align:right">
					photo by <a href="http://www.flickr.com/photos/mbkepp/3205712102/">mbkepp</a>
				</div>
</p></div>
<p>The dataset itself is pretty straightforward. It is a single 549MB XML file uncompressed (84MB when zipped). The data model is a simple, pared-down version of what you can already get via <a href="http://www.flickr.com/services/api/">the Flickr API</a> with an emphasis on the <i>shape</i> data.</p>
<p>Everything lives under a single root <code>places</code> element. For example:</p>
<pre style="margin-bottom:20px;">
&lt;place woe_id=&quot;26&quot; place_id=&quot;BvYpo7abBw&quot; place_type=&quot;locality&quot; place_type_id=&quot;7&quot; label=&quot;<a href="http://www.flickr.com/places/CA/QC/Arvida"">Arvida, Quebec, Canada</a>&quot;&gt;
	&lt;shape created=&quot;1226804891&quot; alpha=&quot;0.00015&quot; points=&quot;45&quot; edges=&quot;15&quot; is_donuthole=&quot;0&quot;&gt;
		&lt;polylines <b style="color:pink;">bbox=&quot;48.399932861328,-71.214576721191,48.444801330566,-71.157333374023&quot;</b>&gt;
			&lt;polyline&gt;
				<b style="color:pink;">&lt;!-- points go here--&gt;</b>
			&lt;/polyline&gt;
		&lt;/polylines&gt;
		&lt;shapefile url=&quot;<b style="color:pink;">http://farm4.static.flickr.com/3203/shapefiles/26_20081116_082a565562.tar.gz</b>&quot; /&gt;
	&lt;/shape&gt;

	&lt;!-- and so on --&gt;
&lt;/place&gt;
			</pre>
<p>Aside from the quirkiness of the shapes themselves, it is worth remembering that some of them may just be wrong. We work pretty hard to prevent Undue Wronginess &trade; from occurring but we&#8217;ve seen it happen in the past and so it would be, well, wrong not to acknowledge the possibility. On the other hand we don&#8217;t think we would have gotten this far if it wasn&#8217;t mostly right but if you see something that looks weird, <a href="http://tech.groups.yahoo.com/group/yws-flickr/">please let us know</a></p>
<p>The dataset is available for download, today, from:</p>
<p style="text-align:center;padding-top:20px;padding-bottom:20px;border:1px dotted #666;margin-top:30px;margin-bottom:30px;"><b style="font-family:sans-serif;font-size:large;"><a href="http://www.flickr.com/services/shapefiles/1.0/">http://www.flickr.com/services/shapefiles/1.0/</a></b></p>
<p>The other exciting piece of news is that the <a href="http://www.ygeoblog.com/">Yahoo! GeoPlanet</a> team has also released <a href="http://developer.yahoo.com/geo/">a public dataset of <i>all their WOE IDs</i></a> that include parent IDs, adjacent IDs and aliases (that&#8217;s just more fancy-talk for &#8220;different names for the same place&#8221;) under the <a href="http://creativecommons.org/licenses/by/2.0/">Creative Commons Attribution License</a>.</p>
<p>Which is pretty awesome, really.</p>
<div>
				<a href="http://www.flickr.com/photos/straup/3539879004/" title="Now &amp; Then by straup, on Flickr"><img src="http://farm3.static.flickr.com/2333/3539879004_af2c145472.jpg" width="500" height="338" alt="Now &amp; Then" style="padding:10px;border:1px dotted #ccc;margin-top:20px;margin-bottom:30px;"/></a>
			</div>
<p>They&#8217;ve also released the <a href="http://developer.yahoo.com/geo/placemaker/">GeoPlanet Placemaker API</a>. You feed it a big old chunk of free-form text and then &#8220;the service identifies places mentioned in text, disambiguates those places, and returns unique identifiers (WOEIDs) for each, as well as information about how many times the place was found in the text, and where in the text it was found.&#8221;</p>
<p>Again, <a href="http://www.flickr.com/photos/mbiddulph/2327731497/">Moar Awesome</a>.</p>
<p>And a bit dorky. It&#8217;s true. The data, all by itself, won&#8217;t tell a story. It needs <i>people and history</i> to make that possible but as you poke around all this stuff don&#8217;t forget the value of having a big giant, and now open, database of unique identifiers and what is possible when you use them as a bridge between other things. Without WOE IDs we wouldn&#8217;t have been able to <a href="http://code.flickr.com/blog/2008/10/30/the-shape-of-alpha/">generate the shapefiles</a> or do <a href="http://www.flickr.com/places/">the Places project</a> or provide a way to <a href="http://toys.lerdorf.com/archives/49-Select-from-World.html">search for photos by place, rather than location</a>.</p>
<p>Enjoy!</p>
<p>Oh, and those &#8220;unidentified&#8221; outliers, in New York City, that I mentioned in <a href="http://code.flickr.com/blog/2009/05/06/the-absence-and-the-anchor/">the last post about the donut hole shapefiles</a>: <i>The Bronx Zoo, Coney Island and Shea Stadium</i>. Of course!</p>
<div>
				<a href="http://www.flickr.com/photos/straup/3536471854/" title="(if you lived here) by straup, on Flickr"><img src="http://farm4.static.flickr.com/3297/3536471854_7e10436b3a.jpg" width="500" height="375" alt="(if you lived here)" style="padding:10px;border:1px dotted #ccc;margin-top:20px;margin-bottom:10px;"/></a></p>
<div style="font-size:small;margin-bottom:20px;text-align:right">photos by <a href="http://www.flickr.com/photos/ajagendorf25/3457595954/">ajagendorf25</a>, <a href="http://www.flickr.com/photos/auggie_tolosa/3025514778">auggie tolosa</a> and <i>the sky</i>
			</div>
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://code.flickr.com/blog/2009/05/21/flickr-shapefiles-public-dataset-10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Absence and the Anchor</title>
		<link>http://code.flickr.com/blog/2009/05/06/the-absence-and-the-anchor/</link>
		<comments>http://code.flickr.com/blog/2009/05/06/the-absence-and-the-anchor/#comments</comments>
		<pubDate>Wed, 06 May 2009 21:18:40 +0000</pubDate>
		<dc:creator>aaron</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[clustr]]></category>
		<category><![CDATA[geo]]></category>
		<category><![CDATA[shapefiles]]></category>

		<guid isPermaLink="false">http://code.flickr.com/blog/?p=885</guid>
		<description><![CDATA[
      
photo by selflesh

Back in January, I wrote a blog post about some experimental work that I&#8217;d been doing with the shapefile data we derive from geotagged photos. I was investigating the idea of generating shapefiles for a given location using not the photos associated with that place but, instead, [...]]]></description>
			<content:encoded><![CDATA[<div style="margin-top:20px; margin-bottom:30px;">
      <a href="http://www.flickr.com/photos/selflesh/3147200065/" title="Sketch | 12.28.08 by selflesh, on Flickr"><img src="http://farm4.static.flickr.com/3103/3147200065_cfc089d2d2.jpg" width="500" height="375" alt="Sketch | 12.28.08" style="border:1px dotted #ccc;padding:10px;margin-bottom:10px;"/></a></p>
<div style="font-size:small;text-align:right;"><a href="http://www.flickr.com/photos/selflesh">photo by selflesh</a></div>
</p></div>
<p>Back in January, I wrote a blog post about <a href="http://code.flickr.com/blog/2009/01/12/living-in-the-donut-hole/">some experimental work that I&#8217;d been doing with the shapefile data</a> we derive from geotagged photos. I was investigating the idea of generating shapefiles for a given location using not the photos associated with that place but, instead, from the photos associated with the <i>children</i> of that place. For example, London:</p>
<div style="margin-top:20px; margin-bottom:20px;">
<a href="http://www.flickr.com/photos/straup/3504862388/" title="London by straup, on Flickr"><img src="http://farm4.static.flickr.com/3561/3504862388_484a0b4d72.jpg"  width="500" height="405" alt="London" style="border:1px dotted #ccc;padding:10px;"/></a>
</div>
<p>The larger pink shape is what we (Flickr) think of as the &#8220;city&#8221; of London. The smaller white shapes are its neighbourhoods. The red shapes represent an entirely new shapefile that we created by collecting all the points for those neighbourhoods and running them through <a href="http://code.flickr.com/blog/2009/04/07/the-only-question-left-is/">Clustr</a>, the tool we use to generate shapes.</p>
<p>For lack of any better name I called these shapes &#8220;donut holes&#8221; because, well, because that&#8217;s what they look like. The larger shape is a pretty accurate reflection of the greater metropolitain area of London, the place that has grown and evolved over the years out of the city center that most people would recognize in the smaller red shape. Our goal with the shapefiles has always been to use them to better reverse-geocode people&#8217;s geotagged photos so these sorts of <a href="http://www.flickr.com/search/?q=timbits&#038;ss=2">variations on a theme</a> can better help us understand <a href="http://magicalnihilism.wordpress.com/2009/04/22/a-palimpsest-for-a-place/">where a place is</a>.</p>
<p>Like New York City. No one gets New York right including us try as we might (though, in fairness, it&#8217;s gotten better recently (no, really)) and even I am hard pressed to explain the giant pink blob, below, that is supposed to be New York City. On the other hand, the red donut hole shape even though (perhaps, because) it spills in to New Jersey a bit is actually a pretty good reflection of the way people move through the city as a whole.</p>
<div style="margin-top:20px; margin-bottom:20px;">
<a href="http://www.flickr.com/photos/straup/3505864039/" title="NYC by straup, on Flickr"><img src="http://farm4.static.flickr.com/3347/3505864039_7f71cdef4d.jpg" width="500" height="408" alt="NYC" style="border:1px dotted #ccc;padding:10px;"  /></a>
</div>
<p>It could play New York on TV, I think.</p>
<p>I&#8217;m not sure how to explain the outliers yet, either, other than to say the shapefiles for city-derived donut holes may contain up to 3 polygons (or &#8220;records&#8221; in proper <a href="http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf">Shapefile-speak</a>) compared to a single polygon for plain-old city shapes so if nothing else it&#8217;s an indicator of where people are taking photos.</p>
<p><i>If the shapefiles themselves are uncharted territory, the donut holes are the fuzzy horizon even further off in the distance. We&#8217;re not really sure where this will take us but we&#8217;re pretty sure there&#8217;s something to it all so we&#8217;re eager to share it with people and see what they can make of it too.</i></p>
<div style="margin-top:20px; margin-bottom:20px;">
<a href="http://www.flickr.com/photos/straup/3504858798/" title="Vietnam by straup, on Flickr"><img src="http://farm4.static.flickr.com/3556/3504858798_517fb8c448_b.jpg"  width="512" height="1024" alt="Vietnam" style="border:1px dotted #ccc;padding:10px;"/></a>
</div>
<p>(This is probably still my favourite shapefile ever.)</p>
<p>Starting today, the donut hole shapes are available for developers to use with their developer magic via the <a href="http://www.flickr.com/services/api">Flickr API</a>.</p>
<p>At the moment we are only rendering donut hole shapefiles for cities and countries. I suppose it might make sense to do the same for continents but we probably won&#8217;t render states (or provinces) simply because there is too much empty unphotographed space between the cities to make it very interesting.</p>
<p>There are also relatively few donut holes compared to the corpus of all the available shapefiles so rather than create an entirely new API method we&#8217;ve included them in the <a href="http://www.flickr.com/services/api/flickr.places.getShapeHistory.html">flickr.places.getShapeHistory</a> API method which returns all the shapefiles ever created for a place. Each <code>shape</code> element now contains an <b>is_donuthole</b> attribute. Here&#8217;s what it looks like for <a href="http://www.flickr.com/places/United+Kingdom/England/London">London</a>:</p>
<pre style="margin-top:20px; margin-bottom:30px;">
&lt;shapes total="6" woe_id="44418" place_id=".2P4je.dBZgMyQ"
	place_type="locality" place_type_id="7"&gt;

	&lt;shape created="1241477118" alpha="9.765625E-05" count_points="275464"
		count_edges="333" <b style="color:pink;">is_donuthole="1"</b>&gt;

		&lt;!-- shape data goes here... --&gt;

	&lt;/shape&gt;

	&lt;!-- and so on -&gt;

&lt;/shapes&gt;
</pre>
<p>Meanwhile, the <a href="http://www.flickr.com/services/api/flickr.places.getInfo.html">places.getInfo</a> API method has been updated to included a <b>has_donuthole</b> attribute, to help people decide whether it&#8217;s worth calling the <code>getShapeHistory</code> method or not. Again, using London as the example:</p>
<pre style="margin-top:20px; margin-bottom:30px;">

&lt;place place_id=".2P4je.dBZgMyQ" woeid="44418" latitude="51.506"
       longitude="-0.127" place_url="/United+Kingdom/England/London"
       place_type="locality" place_type_id="7" timezone="Europe/London"
       name="London, England, United Kingdom" <b style="color:pink;">has_shapedata="1"</b>&gt;

	&lt;shapedata created="1239037710" alpha="0.00029296875" count_points="406594"
                   count_edges="231" <b style="color:pink;">has_donuthole="1" is_donuthole="0"</b>&gt;

        &lt;!-- and so on --&gt;
&lt;/place&gt;
</pre>
<p>Finally, here&#8217;s another picture by <a href="http://selflesh.blogspot.com/">Shannon Rankin</a> mostly just because I like her work so much. Enjoy!</p>
<div style="margin-top:20px; margin-bottom:20px;">
<a href="http://www.flickr.com/photos/selflesh/2913186810/" title="Guardian by selflesh, on Flickr"><img src="http://farm4.static.flickr.com/3172/2913186810_2e8f3fd2d6.jpg" width="500" height="500" alt="Guardian" style="border:1px dotted #ccc;padding:10px;margin-bottom:10px;"/></a></p>
<div style="font-size:small;text-align:right;"><a href="http://www.flickr.com/photos/selflesh">photo by selflesh</a></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://code.flickr.com/blog/2009/05/06/the-absence-and-the-anchor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Only Question Left Is</title>
		<link>http://code.flickr.com/blog/2009/04/07/the-only-question-left-is/</link>
		<comments>http://code.flickr.com/blog/2009/04/07/the-only-question-left-is/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 17:21:58 +0000</pubDate>
		<dc:creator>aaron</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[clustr]]></category>
		<category><![CDATA[ec2]]></category>
		<category><![CDATA[geotags]]></category>
		<category><![CDATA[maps]]></category>
		<category><![CDATA[shapefiles]]></category>

		<guid isPermaLink="false">http://code.flickr.com/blog/?p=802</guid>
		<description><![CDATA[
            
photo by Shawn Allen

At the Emerging Technology conference this year Stamen Design&#8217;s Michal Migurski and Shawn Allen led an afternoon workshop called &#8220;Maps from Scratch: Online Maps from the Ground Up&#8221; where people made digital maps from, well&#8230; scratch.
If you&#8217;ve never heard of [...]]]></description>
			<content:encoded><![CDATA[<div style="margin-top:25px;margin-bottom:25px;">
            <a href="http://www.flickr.com/photos/shazbot/3282821808/"><img src="http://farm4.static.flickr.com/3504/3282821808_da359404ff.jpg" height="457" width="500" alt="" style="border:1px dotted #ccc; padding:10px;" /></a></p>
<p style="text-align:right;font-size:small;">photo by <a href="http://www.flickr.com/photos/shazbot/3282821808/in/set-72157614736071588/">Shawn Allen</a></p>
</p></div>
<p>At the <a href="http://en.oreilly.com/et2009/public/content/home">Emerging Technology</a> conference this year <a href="http://www.stamen.com/">Stamen Design&#8217;s</a> Michal Migurski and Shawn Allen led an afternoon workshop called &#8220;<a href="http://en.oreilly.com/et2009/public/schedule/detail/5555">Maps from Scratch: Online Maps from the Ground Up</a>&#8221; where people made digital maps from, well&#8230; scratch.</p>
<p>If you&#8217;ve never heard of Stamen they&#8217;ve been doing some of the most exciting work around the idea of &#8220;<a href="http://mike.teczno.com/notes/oakland-crime-maps/XI.html">custom cartography</a>&#8221; including: <a href="http://cabspotting.org/">Cabspotting</a>, <a href="http://oakland.crimespotting.org/">Oakland Crimespotting</a> and <a href="http://teczno.com/old-oakland/">Old Oakland Maps</a>, work for the <a href="http://www.tom-carden.co.uk/2009/02/12/new-maps-at-london2012com/">London Olympics</a>, and <a href="http://www.sensescape.com/2009/02/cloudmade/">designing custom map tiles for CloudMade</a>. (Stamen also built the recently launched <a href="http://www.flickr.com/explore/clock">Flickr Clock</a> :-)</p>
<p>All of this is interesting in its own right; proof that there is still a lot of room in which to imagine maps beyond so-called <a href="http://mappinghacks.com/2006/04/07/web-map-api-roundup/">red-dot fever</a>. All of this is extra interesting in light of Apple&#8217;s recent announcement to allow developers to define <a href="http://arstechnica.com/apple/news/2009/03/iphone-sdk-focus-maps-from-your-apps.ars">their own map tiles</a> in the next iPhone OS release. All of this super-duper interesting because it is work produced by a team of <i>less than 10 people</i>.</p>
<p>The <a href="http://www.osgeo.org/">tools</a>, and increasingly the <a href="http://magicalnihilism.wordpress.com/2009/04/03/data-as-seductive-material/">data</a>, to build <a href="http://blog.everyblock.com/2008/feb/18/maps/">the maps we want</a> are bubbling up and becoming easier and more accessible to more people every day. Easier, anyway.</p>
<blockquote style="font-family:sans-serif;border-top:1px solid #ccc;border-bottom:1px solid #ccc;padding:10px;padding-top:20px;margin-top:10px;margin-bottom:20px;">
<p>&#8220;One of the things that made this tutorial especially interesting for us was our use of Amazon&#8217;s EC2 service, the &#8220;Elastic Compute Cloud&#8221; that provides billed-by-the-hour virtual servers with speedy internet connections and a wide variety of operating system and configuration options. Each participant received a login to a freshly-made EC2 instance (a single server) with code and lesson data already in-place. We walked through the five stages of the tutorial with the group coding along and making their own maps, starting from incomplete initial files and progressing through added layers of complexity.</p>
<p>&#8220;Probably the biggest hassle with open source geospatial software is getting the full stack installed and set up, so we&#8217;ve gone ahead and made the AMI (Amazon Machine Image, a template for a virtual server) available publicly for anyone to use, <a href="http://www.mapsfromscratch.com">along with notes on the process we used to create it</a>.&#8221;</p>
<p style="text-align:right;">&#8212; <a href="http://mike.teczno.com/notes/maps-from-scratch.html">Michal Migurski</a></p>
</blockquote>
<p>The Maps From Scratch (MFS) AMI may not be a Leveraged Turn Key Synergistic <a href="http://www.catb.org/~esr/jargon/html/D/DWIM.html">Do-What-I-Mean</a> Solutions Platform but, really, anything that dulls the hassle and cost of setting up specialized software is <i>a great big step in the right direction</i>. I mention all of this because Clustr, the command-line application we use to <a href="http://code.flickr.com/blog/2008/10/30/the-shape-of-alpha/">derive shapefiles from geotagged photos</a>, has recently been added to the list of tools bundled with the MFS AMI.</p>
<p>Specifically: <b>ami-4d769124</b>.</p>
<p>We&#8217;re super excited about this because it means that Clustr is that much easier for people to use. We expressly chose to make Clustr an open-source project to share some of the tools we&#8217;ve developed with the community but it has also always had a relatively high barrier to entry. Building and configuring a Unix machine is often more that most people are interested in, let alone compiling big and complicated maths libraries from scratch. Clustr on EC2 is not a magic pony factory but hopefully it will make the application a little friendlier.</p>
<div  style="margin-top:25px;margin-bottom:25px;">
<a href="http://www.flickr.com/photos/straup/3295483210/" title="Shapes by straup, on Flickr"><img src="http://farm4.static.flickr.com/3564/3295483210_5631c5bfc5.jpg" width="500" height="375" alt="Shapes" style="border:1px dotted #ccc; padding:10px;" /></a>
       </div>
<p>Creating and configuring an EC2 account is too involved for this post but there are lots of good resources out there, starting with <a href="http://aws.amazon.com/ec2/">Amazon&#8217;s own documentation</a>. When I&#8217;m stuck I usually refer back to Paul Stamatiou&#8217;s <a href="http://paulstamatiou.com/2008/04/05/how-to-getting-started-with-amazon-ec2http://paulstamatiou.com/2008/04/05/how-to-getting-started-with-amazon-ec2">How To: Getting Started with Amazon EC2</a>.</p>
<p>Assuming that you familiar using Unix command line tools, let&#8217;s also assume that you have gotten all your ducks in a row and are ready to fire up the MFS AMI:</p>
<pre style="margin-bottom:20px;">
your-computer> ec2-run-instances <b style="color:#000;">ami-4d769124</b> -k example-keypair

your-computer> ec2-describe-instances
</pre>
<p>At which point, you&#8217;ll see something like this:</p>
<pre style="margin-bottom:20px;">
INSTANCE i-xxxxxxxx <b style="color:#000;">ami-4d769124</b> ec2-xxxxx.amazonaws.com blah blah blah
</pre>
<p><code>i-xxxxxxxx</code> is the unique identifier of your current EC2 session. You will need this to tell Amazon to shut down the server and stop billing you for its use.</p>
<p><code>ec2-xxxxx.amazonaws.com</code> is the address of your EC2 server on the Internets.</p>
<p>Once you have that information, you can start using Clustr. First, log in and create a new folder where you&#8217;ll save your shapefile:</p>
<pre style="margin-bottom:20px;">
your-computer> ssh -i example-rsa-key root@ec2-xxxxx.amazonaws.com

ec2-xxxxx.amazonaws.com> mkdir /root/clustr-test
</pre>
<p>The MFS AMI comes complete with a series of sample &#8220;points&#8221; files to render. We&#8217;ll start with the list of <a href="http://www.flickr.com/photos/revdancatt/3398050524/">all the geotagged photos uploaded to Flickr</a> on March 24:</p>
<pre style="margin-bottom:20px;">
ec2-xxxxx.amazonaws.com> /usr/bin/clustr -v -a 0.001 \
   <b style="color:#000;">/root/clustr/start/points-2009-03-24.txt</b> \
   /root/clustr-test/clustr-test.shp
</pre>
<p>By default Clustr generates a series of files named <code>clustr</code> (dot <code>shp</code>, dot <code>dbf</code> and dot <code>shx</code> because <a href="http://en.wikipedia.org/wiki/Shapefile">shapefiles</a> are funny that way) in the current working directory. You can specify an alternate name by passing a fully qualified path as the last argument to Clustr. When run in verbose mode (that&#8217;s the <code>-v</code> flag) you&#8217;ll see something like this:</p>
<pre style="margin-bottom:20px;">
Reading points from input.
Got 44410 points for tag '20090324'.
799 component(s) found for alpha value 0.001.
- 23 vertices, area: 86.7491, perimeter: 71.9647
- 32 vertices, area: 1171.51, perimeter: 41.3095
- 8 vertices, area: 18.5112, perimeter: 0.529504
- 12 vertices, area: 1484.81, perimeter: 10.8544
...
Writing 505 polygons to shapefile.</pre>
<p>Yay!</p>
<pre style="margin-bottom:20px;">
ec2-xxxxx.amazonaws.com> ls -la /root/clustr-test
total 172
drwxr-xr-x 2 root root  4096 2009-04-07 03:14 .
drwxr-xr-x 5 root root  4096 2009-04-07 02:22 ..
-rw-r--r-- 1 root root 52208 2009-04-07 03:14 clustr-test.dbf
-rw-r--r-- 1 root root 97388 2009-04-07 03:14 clustr-test.shp
-rw-r--r-- 1 root root  4140 2009-04-07 03:14 clustr-test.shx
</pre>
<p>Now copy the shapefiles back to your computer and terminate your EC2 instance (or you might be surprised when you get your next billing statement from Amazon).</p>
<pre style="margin-bottom:20px;">
ec2-xxxxx.amazonaws.com> scp -r /root/clustr-test \
   you@your-computer:/path/to/your/desktop/

ec2-xxxxx.amazonaws.com> exit

your-computer> ec2-terminate-instances i-xxxxxxxxx
</pre>
<p>I created this image (using the open source <a href="http://www.qgis.org/">QGIS</a> application) for all those points by running Clustr multiple times with alpha numbers ranging from 0.05 to <em>603</em>:</p>
<div style="margin-top:25px;margin-bottom:25px;">
            <a href="http://www.flickr.com/photos/straup/3393441637/" title="SHAPEZ (2009-03-24) by straup, on Flickr"><img src="http://farm4.static.flickr.com/3611/3393441637_9c2537345a.jpg" width="500" height="292" alt="SHAPEZ (2009-03-24)"  style="border:1px dotted #ccc; padding:10px;" /></a></p></div>
<p>Here&#8217;s another version rendered using the <a href="http://code.google.com/p/mapnik-utils/wiki/Nik2Img">nik2img</a> application and a custom style sheet, both included with the MFS distribution:</p>
<div style="margin-top:25px;margin-bottom:25px;">
          <a href="http://www.flickr.com/photos/straup/3419358867/" title="clustr by straup, on Flickr"><img src="http://farm4.static.flickr.com/3608/3419358867_a0a421c730.jpg" width="500" height="333" alt="clustr"  style="border:1px dotted #ccc; padding:10px;" /></a>
        </div>
<p>Here&#8217;s one of all the geotagged photos tagged &#8220;<a href="http://www.flickr.com/photos/tags/route66">route66</a>&#8221; (with alpha numbers ranging from 0.001 to 0.5):</p>
<div style="margin-top:25px;margin-bottom:25px;">
            <a href="http://www.flickr.com/photos/straup/3390234642/" title="tag=route66, alpha=(0.001 - 0.5) by straup, on Flickr"><img src="http://farm4.static.flickr.com/3658/3390234642_aa85616023.jpg" width="500" height="292" alt="tag=route66, alpha=(0.001 - 0.5)"  style="border:1px dotted #ccc; padding:10px;" /></a></p>
<p style="font-style:italic;font-size:small;text-align:right;">Apologies and big sloppy kisses to Stamen&#8217;s own <a href="http://stamen.com/projects/mappr">Mappr</a> (first released in 2005).</p>
</p></div>
<p>Or tagged &#8220;<a href="http://www.flickr.com/photos/tags/caltrain">caltrain</a>&#8220;, the commuter train that runs between San Francisco and San Jose:</p>
<div style="margin-top:25px;margin-bottom:25px;">
		<a href="http://www.flickr.com/photos/straup/3385980494/" title="tag=caltrain, alpha=0.001 by straup, on Flickr"><img src="http://farm4.static.flickr.com/3600/3385980494_260db12e99.jpg" width="500" height="314" alt="tag=caltrain, alpha=0.001" style="border:1px dotted #ccc; padding:10px;" /></a>
        </div>
<p>Meanwhile, Matt Biddulph at <a href="http://www.dopplr.com/">Dopplr</a> has been generating <a href="http://www.flickr.com/photos/mbiddulph/tags/clustr/">a series of visualizations</a> depicting the shape of where to eat, stay and explore for the cities in their <a href="http://blog.dopplr.com/2009/03/20/the-dopplr-new-york-release-rolling-out-the-social-atlas/">Places</a> database. This is what <a href="http://www.dopplr.com/place/gb/london"> London</a> looks like:</p>
<div style="margin-top:25px;margin-bottom:25px;">
          <a href="http://www.flickr.com/photos/mbiddulph/3421335356/"><img src="http://farm4.static.flickr.com/3306/3421335356_f4757613ce.jpg" height="279" width="500" style="border:1px dotted #ccc; padding:10px;" /></a>
	</div>
<p>Or: &#8220;<a href="http://www.flickr.com/photos/mbiddulph/3421922514/">London dopplr places, filtered to only places my social network has been to, clustrd</a>&#8220;.</p>
<p>One of the things I like the most about Clustr is that it will generate shape(file)s for any old list of geographic coordinates. Now that most of the hassle of setting up Clustr has been (mostly) removed, the only question left is: <i><a href="http://magicalnihilism.wordpress.com/2009/04/06/my-first-cloudmade-map-style-lynchian_mid/">What do you want to render?</a></i></p>
<blockquote style="font-family:sans-serif;border-top:1px solid #ccc;border-bottom:1px solid #ccc;padding:10px;padding-top:20px;margin-top:20px;margin-bottom:20px;">
<p>&#8220;They do not detail locations in space but histories of movement that constitute space.&#8221;</p>
<p style="text-align:right;">&#8212; <a href="http://cyberbadger.blogspot.com/2008/11/map-studies-manifesto-complete.html">Rob Kitchin, Chris Perkins</a></p>
</blockquote>
<p>If you&#8217;re like me you&#8217;re probably thinking something like &#8220;Wouldn&#8217;t it be nice if I could just POST a points file to a webservice running on the AMI and have it return a compressed shapefile?&#8221; It sure would so I wrote <a href="http://github.com/straup/ws-clustr/tree/master">a quick and dirty version</a> (not included in the MFS AMI; you&#8217;ll need to do that yourself) in PHP but if there are any Apache hackers in the house who want to make a zippy C version that would be even Moar Awesome &trade;.</p>
<p>If you don&#8217;t want to use the MFS AMI and would rather just install Clustr on your own machine instance, here are the steps I went through to get it work on a Debian 5.0 (Lenny) AMI; presumably the steps are basically the same for any Linux flavoured operating system:</p>
<pre style="margin-bottom:20px;">
$> apt-get update
$> apt-get install libcgal-dev
$> apt-get install libgdal1-dev
$&gt; apt-get install subversion

$&gt; svn co <a href="http://code.flickr.com/svn/trunk/clustr/">http://code.flickr.com/svn/trunk/clustr/</a>
$&gt; cd clustr
$&gt; make
$&gt; cp clustr /usr/bin/

$&gt; clustr -h

clustr 0.2 - construct polygons from tagged points
written by Schuyler Erle

(c) 2007-2008 Yahoo!, Inc.

Usage: clustr [-a &lt;n&gt;] [-p] [-v] &lt;input&gt; &lt;output&gt;
   -h, -?      this help message
   -v          be verbose (default: off)
   -a &lt;n&gt;      set alpha value (default: use "optimal" value)
   -p          output points to shapefile, instead of polygons

If &lt;input&gt; is missing or given as "-", stdin is used.
If &lt;output&gt; is missing, output is written to clustr.shp.
Input file should be formatted as: &lt;tag&gt; &lt;lon&gt; &lt;lat&gt;\n
Tags must not contain spaces.
        </pre>
<p>Just like that!</p>
<div style="margin-top:25px;margin-bottom:25px;">
            <a href="http://www.flickr.com/photos/timo/3397788209/"><img src="http://farm4.static.flickr.com/3608/3397788209_931d2d2acb.jpg" height="333" width="500" alt=""  style="border:1px dotted #ccc; padding:10px;" /></a></p>
<p style="font-size:small;text-align:right;">photo by <a href="http://www.flickr.com/photos/timo">Timo Arnall</a></p>
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://code.flickr.com/blog/2009/04/07/the-only-question-left-is/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
