OS CodePoint Data Geography Load Update

Following on from my previous post on loading the Ordnance Survey Code-Point data for GB post codes to SQL Server and converting to the GEOGRAPHY data type, I’ve made a few tweaks to the importer app that is up on GitHub:

  1. The schema of the SQL Server table generated has changed - postcodes are now split into 2 distinct columns: OutwardCode and InwardCode
  2. The importer now calculates a basic average for each postcode district (e.g. AB12, aka the OutwardCode) and sector (e.g. AB12 3). This provides a central geographical position for each district/sector allowing less granular usage.

I’ve also started paving the way for it to be able to import other Ordnance Survey datasets such as boundary data in the future if and when I get time. It turns out the boundary data is a lot less straight forward. For example, loading the shape data supplied as-is does not work for all boundaries as some data items form invalid GEOGRAPHY instances when attempting to load into SQL Server. Correcting those items is possible via various means, but is not top of my priority list at the moment.


See also