Concave Hull. Its one of those things when you’re tinkering with geeky stuff that sometimes something niggles at you – you know its probably quite easy but you can’t quite put your finger on how to achieve something the way you want it.

And then one day it finally becomes obvious, your hand makes contact with your forehead and you can move on. This is one of those moments.

Convex Hull – the GIS version of stretching a rubber band over pins in a map is easy – most GIS tools have a menu item to do that somewhere.

That’s great if you don’t have any inlets and concave edges to your outline – if you do you need a Concave Hull.

Concave Hull – a GIS version of vacuum wrapping a set of points plotted on a map.

Sounds easy. Easy to do with a pencil and paper – its just dot-to-dot with the outer-most points – but not so obvious using mapping software, or at least for me anyway.

BUT I’ve finally figured it out (with the help of some very good web resources).

I use a combination of Qgis and PostGIS – brilliant open-source GIS tools. Assuming you have these and can install pgRouting as well then Concave Hulls are very easy indeed!

Sorry – big assumption but they are all available for Windows, Macs and Linux and fairly easy to install. I use Linux, so installing the UbuntuGIS repository will give all these, and on Windows try OSGeo4W for an installer for it all.

So lets assume you have a geo-database of points and you want to create a polygon that tightly follows the outer-most points. The pgRouting additions include a “points_as_polygons” database function which does exactly this.

So within your database you might type :

SELECT id, the_geom FROM points_as_polygon($$ SELECT gid AS id, ST_X(the_geom) AS x, ST_Y(the_geom) AS y FROM os_addressbase WHERE postcode = $x$OX28 5FE$x$ $$)

This gives you a rather meaningless string of numbers, in this case a coded outline for the addresses with a single postcode but entering this using Fast SQL in QGis will turn the meaningless code into a polygon on your map:

Concave Hull

I’m pleased!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>