[Talk-GB] Postcodes to Shapefile

SK53 on OSM SK53_osm at yahoo.co.uk
Fri Mar 18 23:54:47 GMT 2011


On 18/03/2011 22:56, Kev js1982 wrote:
> Resurrecting an old thread I know but with the NSPD Open data also 
> being available allowing Northern Ireland to be generated and having 
> access to an otherwise idle 64bit server I've taken the opportunity to 
> revisit this, and have successfully created the shapefiles (it only 
> took the server 12 days to generate the blighters - it managed to 
> generate Z16 tiles for the whole of Europe and Z18 for the British 
> Isles in just 36 hours - meh!) but now have one more obstacle to 
> overcome...
>
> The Veroni thingy obviously generates the tiles so they butt up 
> against one another which works perfectly here in the landlocked East 
> Midlands, but goes somewhat wrong in coastal areas (Fig 1).
>
> My thought here is that the "World Boundaries" shape file can be used 
> to trim the coastal boundaries to be locked to land so that the map 
> looks "nice" (i.e. postcodes don't end up in the sea save for a little 
> overlap on beaches) - Indeed if you add the World Boundaries file to 
> Quantum GIS and use the "Clip Tool" you end up with what visually 
> looks correct ( Fig. 3) but if you then hide the World Boundaries file 
> the problem becomes obvious (Fig 2.)
>
> What I want to know, is it possible to trim the postcode shapes so 
> that nothing outside another set of shapes (i.e. the British Isles 
> landmass) is included, but instead of leaving gaps the postcode shapes 
> (e.g. FY3 1) are adjusted so that the line runs along the coast line?  
> i.e. I would be left with something visually the same as Fig. 3 but 
> with the coastlines part of the NNXX-X shapefile layer, and more 
> specifically the correct polygon (e.g. the FY3 1 polygon).
>
> Kev
>
>
> Fig 1 - Postcode areas in south west Lancashire and the north Wales 
> coast (green = NNXX-X shapefile, blackline and dotted area uses the 
> worldboundaries file)
> http://kjs.me.uk/3rdparty/osm/SouthWestLancs-NNXX-X.png
>
> Fig 2 - After using Quantum GIS's "Clip" tool - 
> http://kjs.me.uk/3rdparty/osm/SouthWestLancs-NNXX-X_trimmed.png
>
> Fig 3 - After adding the "World Boundaries" back on. - 
> SouthWestLancs-NNXX-X_trimmed_withwb.png
>
> /Open Street Map data licenced under the Creative Commons 
> Attribution-Share Alike 2.0 license 
> <http://creativecommons.org/licenses/by-sa/2.0/> by the OpenStreetMap 
> <http://openstreetmap.org/>/ project and its contributors. /Maps 
> contain Ordnance Survey OpenData 
> <http://www.ordnancesurvey.co.uk/oswebsite/opendata/> © Crown 
> copyright and database right 2010./ /Postcode data in Great Britain is 
> provided by Code-Point Open which contains Royal Mail data © Royal 
> Mail copyright and database right 2010./ /Postcode data in Northern 
> Ireland is from the NSPD Open 
> <http://www.ons.gov.uk/about-statistics/geography/products/geog-products-postcode/nspd/> 
> which contains National Statistics data © Crown copyright and database 
> right 2010. /
>
> On Fri, Apr 30, 2010 at 12:30, Kev js1982 <osm at kevswindells.eu 
> <mailto:osm at kevswindells.eu>> wrote:
>
>     Hi Dave,
>
>     Thanks for providing the shapefiles for download - they did the
>     job nicely.
>
>     One thing I have noticed (which also afflicts
>     random.dev.openstreetmap.org
>     <http://random.dev.openstreetmap.org>) is that a few postcode
>     area/districts are missing - namely
>
>     FY2 - (North Shore) Blackpool, Lancs
>     PE11 - Spalding, Lincs
>     PL17 - Callington, Cornwall
>
>     Using the code point download (which I got via the MySociety
>     mirror) shows that these postcodes do exist.
>
>     Also one of the AB ones (12 or 21 IIRC) for some reason includes
>     parts of Éire, Spain, Portugal and atlantic; while HS includes
>     Reykjavik
>
>     Just thought you'd like to know there is a possible error with the
>     conversion process.
>
>     Nice work though - been after a postcode map for a while, and to
>     go from an A5 diagram to full "google maps" goodness in one swoop
>     is awesome!
>
>     Regards
>
>     Kev Swindells.
>
>
>     On Mon, Apr 26, 2010 at 5:29 PM, Dave Stubbs
>     <dave at randomjunk.co.uk <mailto:dave at randomjunk.co.uk>> wrote:
>
>         On Mon, Apr 26, 2010 at 5:15 PM, Kev js1982
>         <osm at kevswindells.eu <mailto:osm at kevswindells.eu>> wrote:
>         > On Mon, Apr 26, 2010 at 5:00 PM, Kev js1982
>         <osm at kevswindells.eu <mailto:osm at kevswindells.eu>> wrote:
>         >>
>         >> Thanks for that Dave - really useful.
>         >>
>         >> One question though - which prj string/file do I need for
>         these?
>         >>
>         >
>         > Answering my own question - looks to be Google Mercator.
>         >
>         > http://spatialreference.org/ref/sr-org/6627/
>         >
>         > Kev Swindells
>         >
>         >
>
>         Actually, for some obscure historical reason it's projected into
>         "+proj=merc" which is srs 3395.
>
>         Close to 900913, but not quite the same -- my mapnik stylesheet is
>         then set to reproject to google mercator for the tile generation.
>
>         Dave
>
>
>
>
> _______________________________________________
> Talk-GB mailing list
> Talk-GB at openstreetmap.org
> http://lists.openstreetmap.org/listinfo/talk-gb
You ought to be able to do this with Intersect first which will divide 
your FY3 1 polygon into two along the coastline & then clip the result 
to only get the ones inside the coastline. At least if I understand the 
problem correctly.

I've never got the packaged Voronoi working so have only played with 
Delauney triangulation doing the same process.

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


More information about the Talk-GB mailing list