[Talk-GB] Postcodes to Shapefile

Dave Stubbs osm.list at randomjunk.co.uk
Mon Apr 26 13:45:53 BST 2010

On Mon, Apr 26, 2010 at 1:24 PM, Kev js1982 <osm at kevswindells.eu> wrote:
> 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...
> 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
>     voronoi(siteList,context)
>   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

These are caused by more than one postcode for the same point --
you'll need to preprocess the input files to remove any duplicates
coordinates. There's quite a lot of apparent PO boxes and other odd
postcodes in the OS data which result in duplicate points.

Also note that it'll use about 6GBs of RAM to run for the complete OS
dataset of 1.6 million points.


More information about the Talk-GB mailing list