Processing OS Codepoint with polygons

Following on from an earlier post updating OS Codepoint data , this post will now look at how to process OS Codepoint with polygons. This dataset provides a polygon for each postcode, including vertical streets (represented by squares) which is where a building has more than one postcode.

1) From the data provided by OS all the shapefiles (for each postcode sector) need to be merged into one. This can be achieved using QGIS ‘Merge to one’ tool under the vector toolbar or by writing a simple python script in arcmap utilising the merge tool.

2) We are going to create two extra fields in the attribute table ‘PCOutcode’ and ‘PCSector’ – this will provide us with additional symbology options with GIS. For ‘PCOutcode’, use =RTrim(Left(Postcode,4)) to capture the first part of each postcode, and for ‘PCSector’ use =RTrim(Left(Postcode,5)) where Postcode is the postcode field and RTrim removes any trailing spaces.

Continue reading

Advertisements

Geocoding

A common task within GIS is geocoding; the process of plotting postcodes within a GIS using an address locator. Cleaning the data for this process requires several steps. The format requires postcodes to be a length of 7 characters. This is easily achieved using the following formula in Excel:

=IF(LEN(A2) = 6,REPLACE(A2,3,1,MID(A2,3,1)&” “),IF(LEN(A2)=7,A2,IF(LEN(A2)=8,SUBSTITUTE(A2,” “,””))))

This works for postcodes of lengths 6,7 and 8. Other lengths can be added but it is rare you would encounter these. Save this as a csv file, ensuring the column has a header.

Continue reading

Processing OS Codepoint Data

Working in a professional GIS environment,you will undoubtedly be dealing with Ordnance Survey data – whether open or private. One of the most useful of these is OS codepoint which provides a precise geographical location for 1.6 million postcodes within Great Britain.

This is the basis for geocoding, one of the most commonly completed tasks in GIS. This posts describes the method for creating an address locator ready for geocoding.

1. Firstly, load the data from the CD and delete (or use to a create a new address locator) the bt.csv file which represents Northern Ireland.

2. Then merge the csv’s together using the command line (make sure you are in the directory where the files are stored).

copy *.csv insert_new_file.csv

Continue reading