[Talk-GB] Postcodes to Shapefile

Jerry Clough - OSM sk53_osm at yahoo.co.uk
Mon Apr 26 15:13:33 BST 2010

GRASS seems to have some kind of Voronoi algorithm, but I find its interface very non-intuitive, so have not found it to try it out. This may be worth pursuing as an alternative route.

As an aside: I notice that virtually all postcode boundaries are obviously created in this way. For instance the Philips Street Atlas shows totally implausible boundaries along the River Trent in S. Notts. Given that postcode boundaries are ultimately determined by logistically sensible walks for postmen, in this case it's pretty safe to assume that the boundary is actually the river. What this means is that by applying a bit of local knowledge and the existing points it is possible to create better delineating zones in OSM than appear in current mapping. Whether this is a good thing to do, or not, I leave for others to decide.

From: Kev js1982 <osm at kevswindells.eu>
To: OSM - Talk GB <talk-gb at openstreetmap.org>
Sent: Mon, 26 April, 2010 12:24:26
Subject: Re: [Talk-GB] Postcodes to Shapefile

On Mon, Apr 26, 2010 at 12:00 PM, Kev js1982 <osm at kevswindells.eu> wrote:

>I am currently trying to create a series of shapefiles from postcodes (using OS Open Geo Data) using the code from "Random Junk" (http://random.dev.openstreetmap.org/postcodes/#) running on Ubuntu 9.10 but I can't get it working.
>lots of blah blah about what I did...

Think i've sussed most of it...

I zapped my pyshapelib folder and downloaded both it and shapelib again

With the shapelib and pyshapelib tar gzs inside my osm folder I then 
issued the following commands

tar -xvzf shapelib-1.2.10.tar.gz
mv shapelib-1.2.10 shapelib
tar -xvzf pyshapelib-0.3.tar.gz
mv pyshapelib-0.3 shapelib/pyshapelib/
cd shapelib
cd pyshapelib
python setup.py build
sudo python setup.py install
cd ../../
# The next line is really important if you want python to think this folder has python scripts
touch shapelib/__init__.py
cp shapelib/pyshapelib/* shapelib/

This seamed to get over the original problem

Then you need to ensure you input file has no trailing lines

And now to work out why I'm getting

Traceback (most recent call last):
  File "makeShapeColoured.py", line 349, in <module>
    result = voronoi.computeVoronoiDiagram(pts)
  File "/home/kev/osm/voronoi.py", line 746, in computeVoronoiDiagram
  File "/home/kev/osm/voronoi.py", line 206, in voronoi
    edge = Edge.bisect(bot,newsite)
  File "/home/kev/osm/voronoi.py", line 404, in bisect
    newedge.a = dx/dy
ZeroDivisionError: float division 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/talk-gb/attachments/20100426/aa4df1b8/attachment-0001.html>

More information about the Talk-GB mailing list