5

I'm looking for the best workflow for mapping postcodes and calculated territories, but being relatively new to mapping I'm struggling on a few details and also the best practices for displaying these maps via a browser.

I have access to the Code-Point Open postcode data from Ordnance Survey and my intention is to generate layers based on this data based on a series of dissolving aggregations (Postcode Sector into Group1 into Group2 into Group3) etc.

I think I need to aggregate this data in each level using Voronoi regions - what I don't understand is whether I need to generate polygons or can draw these polygons in a live manner?

I have access to Windows (WAMP) and Red Hat 6 (LAMP+PostGres+PostGis) - where can I find out more about generating voronoi and the advantages/disadvantages of pre-rendered polygons?

On a side note, our regions change quarterly and so for all but the lowest level this data will need recalibrating 4 times a year - we would probably regroup postcode sectors at the same time (as Code-Point is also updated quarterly and well, we might as well update everything).

  • Welcome to GIS-SE! I'm going to add a tag for Postgis because it sounds like that is the only GIS component in your stack at present, and also one for voronoi, so that will help put your question in front of the appropriate experts. – PolyGeo May 13 '13 at 10:55
3

OK, so I moved away from generating this polygon data directly in PostGIS and used qGis instead as it was better for my learning curve to see this happen visually, and the voronoi polygons contained far less errors and overlapping regions over the same sample than the various postgis algorithms I tested - here are the steps I took:

  1. Added a PostGIS layer for my point data, including sector attributes.
  2. Created Voronoi polygons in new layer based on the point data (Vector > Geometry Tools > Voronoi Polygons)
  3. Dissolved Voronoi layer into sectors layer based on attribute (Vector > Geoprocessing Tools > Dissolve)
  4. Created new outline layer as a mask to trim sectors that disappear to sea and use it as a clip mask to tidy sectors layer.
  5. Imported final shapefile into PostGIS direct from qGIS.
  • 1
    Did you run that on the full postcode set in one hit (all 1.7m)? I'm trying to create sector and district level shape files – mapping dom Apr 18 '17 at 9:09
3

We've recently released some open source software - Open Door Logistics Studio - which lets you perform free territory mapping and free territory design, targeted for the UK. We've also generated, using voronoi etc, postcode areas, districts and sector boundaries for the UK for use in our software - also free. You should be able to just use this directly for your workflow. See http://www.opendoorlogistics.com for details or watch the territory design video at https://www.youtube.com/watch?v=cyIcVwHf524.

0

Faster Voronoi Diagrams in PostGIS

In python (Python 2.x)

# Voronoi diagram calculator/ Delaunay triangulator
# Translated to Python by Bill Simons
# September, 2005
#
# Additional changes by Carson Farmer added November 2010
# 
# Converted to pl/pythong function by Darrell Fuhriman, April 2012
# based on code from: 
# https://svn.osgeo.org/qgis/trunk/qgis/python/plugins/fTools/tools/voronoi.py
#
# Calculate Delaunay triangulation or the Voronoi polygons for a set of 
# 2D input points.

Full SQL https://dl.dropbox.com/u/316947/voronoip3.sql

http://geogeek.garnix.org/2012/04/faster-voronoi-diagrams-in-postgis.html

  • That site says the code produces artifacts. Are you sure it's okay? – Jakub Kania May 13 '13 at 15:23
  • Thanks for the tip - I'd already picked up this blog post and bookmarked it but I'd noticed the artifacts (cheers @jakub-kania) bit so thought I'd ask here first. – kieran_delaney May 14 '13 at 9:55
  • I have tested this with Windows 7 x64, PostgreSQL 9.2 x64, PostGIS 2.0.1 x64, Python 3.2 x64 and ran the sql script which successfully loaded the Vornoi function and then run against codept open and it returns no values. In some of the comments at the bottom of that blog post below do say the Python 3 version still has some problems. If anyone gets this to work I would be interested to know how – tjmgis May 14 '13 at 13:23
  • 1
    @tjmgis I've actually been using the following vorovoi generator (which is PL/R not python) - ammending to work with postgis2 seems to work well. punkish.org/Voronoi-Diagrams-In-PostGIS – kieran_delaney May 14 '13 at 14:00
  • @kieran_delaney just got R and PL/R setup and just kicked off the query. Quick question tho - should I do a simple SELECT * FROM r_voronoi('codept_open','geom','gid'); or is best to create a new table? – tjmgis May 14 '13 at 15:15
0

If you are using QGis there is a good and detailed (with illustrations) solution to this here which i've tested and would recomend

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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