0

I have a dataset (OS CodePoint Open) which contains a latitude and longitude for every postcode in the UK, but no shapefile information on the postcode itself. (I know I can buy a the shapefiles from OS, but would prefer not to).

So essentially I have a point-cloud. Is there an alogorithm (or, ideally some Python code) which would allow me to generate polygons for each of the points? I'm sure there must be, but not knowing what search terms to use is leaving me a bit stumped. I know they wouldn't be as accurate as the real shapefile data from OS, but for the purposes of choropleths they would be fine.

2
  • 1
    What you have is not a 'point cloud' it's just a bunch of points. And you will not be able to reproduce postcode boundaries from points.
    – Alex Leith
    Commented Mar 5, 2017 at 20:58
  • How are you going to reconstruct the boundaries from the point data? Are there attributes with the point data that contain polygon boundaries?
    – Aaron
    Commented Mar 5, 2017 at 21:41

2 Answers 2

4

What I need are Voronoi diagrams, and there is a function in the scipy library to generate them.

2
  • 2
    Keep in mind that you have "arbitrary" polygons that do not resemble real "on the ground" postcode boundaries.
    – til_b
    Commented Mar 5, 2017 at 20:52
  • 1
    @til_b Thanks for the steer. But in this case I (suspect I) just need an approximation of the PostCode boundaries in order to produce cholopleth maps of various information which is keyed by postcode (in this case broadband availability).
    – TimGJ
    Commented Mar 6, 2017 at 7:33
2

If your point data is in a .csv file, you can simply import that into QGIS - using the delimited text wizard. From that layer you create the voronoi diagram from the Vector menu. But, as @til_b says, that will only generate random polygons, not polygons that represent the geography of the actual postcodes. I needed a set of postcode data for a project at work where, initially I used the geography of the postcode to create thematic maps. I discovered that I could make better maps with point data for each town. Perhaps you also don't need the polygons?

1
  • I'm intedinng (if possible) to produce a choropleth of the UK showing broadband coverage. The broadband data I have is on a postcode basis. So (AFAIK) the Polygons don't need to be exact.
    – TimGJ
    Commented Mar 6, 2017 at 7:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.