[Talk-GB] Postcodes to Shapefile
Chris Hill
osm at raggedred.net
Mon Apr 26 13:24:26 BST 2010
Kev js1982 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.
>
> What I have done so far is to create a folder called /home/kev/osm
>
> In this folder is "makeShapeColoured.py"
>
> Prompted by
> http://www.mail-archive.com/talk@openstreetmap.org/msg20932.html I
> have downloaded the pyshapelib from
> http://ftp.intevation.de/users/bh/pyshapelib/pyshapelib-0.3.tar.gz
> (the URL appears to have changed when compared with the mail archive
> post), which has been extracted into the same folder and then renamed
> shapelib (i.e. there exists a file called
> /home/kev/osm/shapelib/shapelib.py ).
>
> If I then run
>
> $ python makeShapeColoured.py
>
> I get the following message
>
> Traceback (most recent call last):
> File "makeShapeColoured.py", line 34, in <module>
> import shapelib.shapelib as shp, shapelib.dbflib as dbf
> ImportError: No module named shapelib.shapelib
>
> I'm guessing this is because the "python binding" needs installing -
> but which binding? Google seams to bring back results about the
> subversion, gdal and not just a generic python bindings - has anyone
> any ideas what needs to be done here?
>
> Install is a standard (English/GB) installation of Ubuntu running
> inside Virtual Box which has had the following command run
> sudo aptitude install openssh-server python python-mapnik mapnik-utils
> libmapnik-dev python-dev
> and all the respective dependencies installed.
>
>
> Hopefully converting it to running on the OS projection will be as
> simple as changing the project line!
I have been working on the OS boundary files for counties etc and the
coastline files. They all have a .prj which is incorrect. If you
re-project the shpfiles using the OS supplied .prj using, for example,
GDAL routines you will get polygons or lines which are substantially
inaccurate. Jerry Clough supplied me a corrected .prj file:
PROJCS["British National Grid (ORD SURV GB)", GEOGCS["unnamed",
DATUM["D_OSGB_1936", SPHEROID["Airy - 1848",6377563,299.319997677743],
TOWGS84[446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894]],
PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]],
PROJECTION["Transverse_Mercator"], PARAMETER["latitude_of_origin",49],
PARAMETER["central_meridian",-2],
PARAMETER["scale_factor",0.9996012717],
PARAMETER["false_easting",400000], PARAMETER["false_northing",-100000],
UNIT["METER",1]]
Replace the .prj file with the data above.
Cheers, Chris
More information about the Talk-GB
mailing list