<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

	<title>Comments on: Join some of the dots, throw the rest away</title>
	<link>http://ask.metafilter.com/65636/Join-some-of-the-dots-throw-the-rest-away/</link>
	<description>Comments on Ask MetaFilter post Join some of the dots, throw the rest away</description>
	<pubDate>Tue, 26 Jun 2007 08:58:35 -0800</pubDate>
	<lastBuildDate>Tue, 26 Jun 2007 08:58:35 -0800</lastBuildDate>
	<language>en-us</language>
	<docs>http://blogs.law.harvard.edu/tech/rss</docs>
	<ttl>60</ttl>

	<item>
		<title>Question: Join some of the dots, throw the rest away</title>
		<link>http://ask.metafilter.com/65636/Join-some-of-the-dots-throw-the-rest-away</link>	
		<description>Map geeks:  can I generate a polygon shapefile from the outline of a large collection of points?  There&apos;s more detail, of course. &lt;br /&gt;&lt;br /&gt; I&apos;m all Googled out, so this is my next stop.  Here&apos;s a slightly-genericised version of my need:&lt;br&gt;
&lt;br&gt;
I am able to generate, from a dataset which is quite old, several thousand points.  All of them are in the same area (say, a ZIP code).&lt;br&gt;
&lt;br&gt;
In order to test whether new data points - which are newer than that ageing dataset - are inside the same area, I&apos;d like to take what I have and create a shapefile.&lt;br&gt;
&lt;br&gt;
This shapefile would need to be a polygon which tracks the outermost points from the cluster I have very tightly, in order to avoid false positives when testing new points.  So a bounding box/circle/parallelogram won&apos;t do.&lt;br&gt;
&lt;br&gt;
Can this be done?   And more importantly, can it be done with an existing software package or component &lt;em&gt;which has an open license&lt;/em&gt;?</description>
		<guid isPermaLink="false">post:ask.metafilter.com,2007:site.65636</guid>
		<pubDate>Tue, 26 Jun 2007 08:46:19 -0800</pubDate>
		<dc:creator>genghis</dc:creator>
		
			<category>map</category>
		
			<category>mapping</category>
		
			<category>gis</category>
		
			<category>math</category>
		
			<category>graph</category>
		
			<category>problem</category>
		
			<category>shapefile</category>
		
	</item> <item>
		<title>By: Leon</title>
		<link>http://ask.metafilter.com/65636/Join-some-of-the-dots-throw-the-rest-away#986285</link>	
		<description>I think you&apos;re looking for a convex hull (the minimum convex polygon which encompasses all your points - think of your points as a bunch of nails in a board; the convex hull is the shape of an elastic band stretched over all of them).&lt;br&gt;
&lt;br&gt;
&lt;a href=&quot;http://www.qhull.org/&quot;&gt;This&lt;/a&gt; looks like a good place to start for code.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.65636-986285</guid>
		<pubDate>Tue, 26 Jun 2007 08:58:35 -0800</pubDate>
		<dc:creator>Leon</dc:creator>
	</item><item>
		<title>By: GuyZero</title>
		<link>http://ask.metafilter.com/65636/Join-some-of-the-dots-throw-the-rest-away#986296</link>	
		<description>Yeah, you need a convex hull. It&apos;s simple to do - qhull has code but it&apos;s certainly simple enough to code yourself. See various algorithms &lt;a href=&quot;http://softsurfer.com/Archive/algorithm_0109/algorithm_0109.htm&quot;&gt;here&lt;/a&gt;.&lt;br&gt;
&lt;br&gt;
After that, it&apos;s just hit testing in the polygon, which is also pretty simple. Coding it is simple and qhull can probably do it too.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.65636-986296</guid>
		<pubDate>Tue, 26 Jun 2007 09:07:03 -0800</pubDate>
		<dc:creator>GuyZero</dc:creator>
	</item><item>
		<title>By: devilsbrigade</title>
		<link>http://ask.metafilter.com/65636/Join-some-of-the-dots-throw-the-rest-away#986397</link>	
		<description>nthing convex hull. There&apos;s a great book called &quot;Computational Geometry in C&quot; that I used quite a bit. It has a good description of convex hull problem, along with some implementations of solvers in C, which seems like what you want. &lt;br&gt;
&lt;br&gt;
There&apos;s also &lt;a href=&quot;http://nature.berkeley.edu/~alyons/locoh/arcgis9/index.html&quot;&gt;this&lt;/a&gt; for ArcGIS, which I hope you&apos;re using or have access to (otherwise, GIS can be quite a PITA). Its under GPL (why not BSD, I have no clue).</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.65636-986397</guid>
		<pubDate>Tue, 26 Jun 2007 10:09:30 -0800</pubDate>
		<dc:creator>devilsbrigade</dc:creator>
	</item><item>
		<title>By: anaelith</title>
		<link>http://ask.metafilter.com/65636/Join-some-of-the-dots-throw-the-rest-away#986415</link>	
		<description>Wait, zip code areas aren&apos;t necessarily convex, are they? You probably want a &lt;i&gt;concave&lt;/i&gt; hull. (&lt;a href=&quot;http://ubicomp.algoritmi.uminho.pt/local/concavehull.html&quot;&gt;linky&lt;/a&gt;)</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.65636-986415</guid>
		<pubDate>Tue, 26 Jun 2007 10:25:03 -0800</pubDate>
		<dc:creator>anaelith</dc:creator>
	</item><item>
		<title>By: devilsbrigade</title>
		<link>http://ask.metafilter.com/65636/Join-some-of-the-dots-throw-the-rest-away#986420</link>	
		<description>Even better, ArcCatalog should have zip areas already in polygon format (and if it doesn&apos;t, states should have the data published). Why not just match it up? (I hope your point data is georeferenced).</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.65636-986420</guid>
		<pubDate>Tue, 26 Jun 2007 10:29:18 -0800</pubDate>
		<dc:creator>devilsbrigade</dc:creator>
	</item><item>
		<title>By: Xelf</title>
		<link>http://ask.metafilter.com/65636/Join-some-of-the-dots-throw-the-rest-away#986431</link>	
		<description>I do exactly this in Java, with &lt;a href=&quot;http://vividsolutions.com/jts/JTSHome.htm&quot;&gt;JTS&lt;/a&gt; and &lt;a href=&quot;http://geotools.codehaus.org/&quot;&gt;geotools&lt;/a&gt; with the shapefile reader. It&apos;s really straightforward, I&apos;ll toss some example code that won&apos;t compile but has all the relevant bits &lt;a href=&quot;http://quidquid.net/convex/&quot;&gt;here&lt;/a&gt;. And some .jars you might need, though I recommend downloading the official distributions. Oh, and to test whether a point is inside the hull, you&apos;d just do &lt;code&gt;if(bounds.contains(testpoint))&lt;/code&gt; That should get you started, good luck!</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.65636-986431</guid>
		<pubDate>Tue, 26 Jun 2007 10:45:58 -0800</pubDate>
		<dc:creator>Xelf</dc:creator>
	</item><item>
		<title>By: Xelf</title>
		<link>http://ask.metafilter.com/65636/Join-some-of-the-dots-throw-the-rest-away#986437</link>	
		<description>&lt;small&gt;PS. Feel free to email me with questions, address is in profile.&lt;/small&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.65636-986437</guid>
		<pubDate>Tue, 26 Jun 2007 10:49:40 -0800</pubDate>
		<dc:creator>Xelf</dc:creator>
	</item><item>
		<title>By: genghis</title>
		<link>http://ask.metafilter.com/65636/Join-some-of-the-dots-throw-the-rest-away#986468</link>	
		<description>Sorry, for clarification:  when I said &quot;a slightly-genericised version of my need&quot;, what that means in practice is that I&apos;m not dealing with ZIP codes at all.  I&apos;m trying to recreate electoral area boundaries in a different country.&lt;br&gt;
&lt;br&gt;
Unfortunately, therefore, these ZIP-specific comments aren&apos;t directly useful.&lt;br&gt;
&lt;br&gt;
Clearly convex hull is the thing.  The qhull pages, however, seem to deal exclusively in language which relates to 3D applications and/or degree-level maths.  A link to example usage with map points (mine are in WGS84 X&amp;amp;Y pairs like Google Maps) would be handy if someone can point me towards a link.&lt;br&gt;
&lt;br&gt;
&lt;small&gt;Xelf:  thanks, but this is a one-off task. Batch-processing with (eg) PHP, mysql and a shell script will be ugly, but it should get the job done without me having to learn enough Java to follow you :)&lt;/small&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.65636-986468</guid>
		<pubDate>Tue, 26 Jun 2007 11:19:37 -0800</pubDate>
		<dc:creator>genghis</dc:creator>
	</item><item>
		<title>By: jonesor</title>
		<link>http://ask.metafilter.com/65636/Join-some-of-the-dots-throw-the-rest-away#986470</link>	
		<description>You could do this fairly easily with the (free) statistical computing program &lt;a href=&quot;http://www.r-project.org/&quot;&gt;R&lt;/a&gt;. There&apos;s a bit of a learning curve but it might well be worth it as it is easy to automate data acquisition and output.&lt;br&gt;
&lt;br&gt;
There is a function called &quot;chull&quot; which will return the outer points in a collection of x,y coordinates. And another function called &quot;areapl&quot; which will return an area for this minimum area convex polygon (MCP).&lt;br&gt;
&lt;br&gt;
Given this information it would be a simple matter to check whether the addition of a new point falls outside the initial area (by checking whether the area of the polygon was changed).&lt;br&gt;
&lt;br&gt;
There are also some useful functions available to calculate x% MCP, (i.e. polygon&apos;s containing x$ of the points, in order to deal with outliers), or functions to calculate kernel area methods (used in animal home range analysis for example).</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.65636-986470</guid>
		<pubDate>Tue, 26 Jun 2007 11:20:04 -0800</pubDate>
		<dc:creator>jonesor</dc:creator>
	</item><item>
		<title>By: devilsbrigade</title>
		<link>http://ask.metafilter.com/65636/Join-some-of-the-dots-throw-the-rest-away#986497</link>	
		<description>The book I referenced covers it for a set of 2D points. I suggest you check it out.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.65636-986497</guid>
		<pubDate>Tue, 26 Jun 2007 11:46:57 -0800</pubDate>
		<dc:creator>devilsbrigade</dc:creator>
	</item><item>
		<title>By: genghis</title>
		<link>http://ask.metafilter.com/65636/Join-some-of-the-dots-throw-the-rest-away#986950</link>	
		<description>Wait a second...&lt;br&gt;
&lt;br&gt;
Guyzero&apos;s link contains a number of examples and they &lt;strong&gt;all&lt;/strong&gt; draw a larger bounding box than is strictly necessary.  For a mapping application, accuracy is far more important than lowest-number-of-sides.  &lt;br&gt;
&lt;br&gt;
A point set, for example, containing three of four corners on one square block is drawn as a triangle.  For my purposes, that&apos;s half a block which should not be &quot;inside the rubber band&quot;, not least because it might legitimately belong in an adjacent set instead and thus give a completely incorrect result for any address in that small area.&lt;br&gt;
&lt;br&gt;
If that&apos;s something you get with all convex hull calculations then we&apos;re on the wrong track.  Sticking with the analogies, it seems I don&apos;t want an elastic band, but shrinkwrapping.&lt;br&gt;
&lt;br&gt;
Any clues?</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.65636-986950</guid>
		<pubDate>Tue, 26 Jun 2007 20:18:35 -0800</pubDate>
		<dc:creator>genghis</dc:creator>
	</item><item>
		<title>By: anaelith</title>
		<link>http://ask.metafilter.com/65636/Join-some-of-the-dots-throw-the-rest-away#987006</link>	
		<description>See my previous link about convex vs. concave.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.65636-987006</guid>
		<pubDate>Tue, 26 Jun 2007 21:45:02 -0800</pubDate>
		<dc:creator>anaelith</dc:creator>
	</item><item>
		<title>By: genghis</title>
		<link>http://ask.metafilter.com/65636/Join-some-of-the-dots-throw-the-rest-away#987242</link>	
		<description>Point taken, but you&apos;ve posted a link which describes what it is, not a link to something which can do it.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.65636-987242</guid>
		<pubDate>Wed, 27 Jun 2007 07:15:04 -0800</pubDate>
		<dc:creator>genghis</dc:creator>
	</item><item>
		<title>By: GuyZero</title>
		<link>http://ask.metafilter.com/65636/Join-some-of-the-dots-throw-the-rest-away#987261</link>	
		<description>Concave hull isn&apos;t described in any books I&apos;ve ever read on geometric algorithms, though my knowledge is far from exhaustive. That one site does show some results, but there&apos;s no algorithm. &lt;br&gt;
&lt;br&gt;
I guess you could take all the points, generate a delaunay triangulation of them and then test each point to discard &quot;inner&quot; points. No, wait, that&apos;s the convex hull.&lt;br&gt;
&lt;br&gt;
Anyway, I guess it&apos;s time to hit the library and do some research. You that is, not me.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.65636-987261</guid>
		<pubDate>Wed, 27 Jun 2007 07:27:46 -0800</pubDate>
		<dc:creator>GuyZero</dc:creator>
	</item><item>
		<title>By: GuyZero</title>
		<link>http://ask.metafilter.com/65636/Join-some-of-the-dots-throw-the-rest-away#987272</link>	
		<description>You may want to email Joseph O&apos;Rourke, who has written some books on computational geometry. http://maven.smith.edu/~orourke/&lt;br&gt;
&lt;br&gt;
There are so few google and ACM library hits for &quot;concave hull&quot; or &quot;non-convex hull&quot; that I wonder if researchers call this something else.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.65636-987272</guid>
		<pubDate>Wed, 27 Jun 2007 07:36:46 -0800</pubDate>
		<dc:creator>GuyZero</dc:creator>
	</item><item>
		<title>By: anaelith</title>
		<link>http://ask.metafilter.com/65636/Join-some-of-the-dots-throw-the-rest-away#987892</link>	
		<description>From the bottom of that page:&lt;br&gt;
&lt;br&gt;
&lt;b&gt;An implementation of this algorithm is available online (see the Downloads section).&lt;/b&gt;&lt;br&gt;
&lt;br&gt;
And here&apos;s the downloads section: &lt;a href=&quot;http://ubicomp.algoritmi.uminho.pt/local/downloads.html&quot;&gt;linky&lt;/a&gt;. You should also be able to get the source, if you mail them, as is written on that page.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.65636-987892</guid>
		<pubDate>Wed, 27 Jun 2007 15:03:41 -0800</pubDate>
		<dc:creator>anaelith</dc:creator>
	</item><item>
		<title>By: devilsbrigade</title>
		<link>http://ask.metafilter.com/65636/Join-some-of-the-dots-throw-the-rest-away#988510</link>	
		<description>I think the reason you don&apos;t see &apos;concave&apos; hulls around very much is because there can be many concave hulls for a given set of points (to give a very simple example, think about 4 points, 3 in a triangle and one in the center - how would you draw a reliably reproducable concave hull of this?). That&apos;s not to say it doesn&apos;t exist, just that it may not be of as much interest because its so fuzzy.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.65636-988510</guid>
		<pubDate>Thu, 28 Jun 2007 04:25:22 -0800</pubDate>
		<dc:creator>devilsbrigade</dc:creator>
	</item>
	</channel>
</rss>
