Chapter 7: Postcode (Code-Point)#
Welcome back! In our last few chapters, we've explored detailed ways to identify and represent locations and physical structures: from address points (UPRNs) and specific geographic features (TOIDs), to whole building outlines (Building Features) and even parts of buildings (Building Parts), all potentially grouped into larger Site Features. We saw how the Linked Identifiers Dataset helps bridge the gap between UPRNs and TOIDs.
These detailed identifiers are essential for connecting to precise information about properties and structures. But sometimes, you need a simpler, broader way to reference a location, especially in the early stages of a project or when dealing with data that isn't linked at the individual property or building level.
Imagine you just know the postcode for a potential project site or an area of interest. Or maybe you have a dataset of statistics (like demographics or health data) that is summarised by postcode areas. How can you quickly find the location of these areas and potentially link them to your BIM work or other geographic data?
This is where the concept of Postcode (Code-Point) becomes useful.
What is Postcode (Code-Point)?#
Think of Code-Point Open (the name of the dataset from Ordnance Survey) as a simple list that gives you the approximate geographical center for every postcode unit in Great Britain.
A postcode (like "SW1A 0AA" for Buckingham Palace or "EH1 1AA" for Edinburgh) covers a small area, typically grouping together about 15 nearby addresses. Code-Point doesn't give you the boundary of the postcode area or the location of every single address within it (that's what OS Open UPRN or AddressBase is for). Instead, it gives you a single point location (a coordinate pair like Easting/Northing or Latitude/Longitude) that represents the middle or centroid of that postcode area.
As the Code-Point Open Overview explains, it's about locating postcode units, which are "alphanumeric abbreviations for addresses," each identifying a small group of properties.
Why is Postcode (Code-Point) Important for BIM (in a simple way)?#
While not providing the highly detailed, feature-level data of TOIDs or UPRNs, Code-Point offers valuable functionality, especially for initial analysis and linking to broader data:
- Quick Geocoding: If you only have a list of postcodes (e.g., for customer locations, incident sites, or potential development areas), Code-Point lets you quickly place them on a map. This is often called "geocoding".
- Initial Site Location: For very early-stage planning, knowing the approximate location of a site based on its postcode is a fast way to get started before you have precise address or building data.
- Linking to Postcode-Based Data: Many external datasets (statistics, demographics, health records) are published with postcodes as the primary location reference. Code-Point provides the geographic link to these datasets, allowing you to visualise postcode-level data geographically and potentially relate it back to areas containing your BIM projects.
- Broad Spatial Filtering: You can easily filter other datasets (like UPRNs or even Building Features) to find everything located within or near a postcode area identified using Code-Point.
It acts as a straightforward layer for getting coordinates from postcodes and for linking data summarised at the postcode level. As the OS Project File Summary TableOnly mentions, Code-Point Open is "Ready-to-use" and supports "Level 1 β Location indexing" and "Level 0 (Geocoding only)" BIM maturity, indicating its role for simple location tasks.
Key Information in Postcode (Code-Point)#
The Code-Point dataset is relatively simple. Based on the OS Open Code-Point bSDD Data Dictionary and Code-Point Open Overview, the key pieces of information for each entry are:
- Postcode (
postcode
): The actual postcode string (e.g., "AB1 0AA"). This is the identifier! - Geometry: The point location, often provided as:
- Easting (
easting
) and Northing (northing
): Coordinates in the British National Grid system (EPSG:27700). - Grid Reference (
grid_reference
): A textual representation of the grid location. - (Latitude/Longitude can be derived from Easting/Northing).
- Easting (
- Positional Quality Indicator (PQI): A code indicating how accurate the provided coordinate is for the postcode area.
- Other Codes: Includes links to administrative areas like
local_authority
orcountry_code
(England, Scotland, Wales). This allows linking postcodes to administrative boundaries, a concept we'll explore further in a later chapter.
The core function is linking the postcode
string to its easting
and northing
(or geometry
).
How Do You "Use" Postcode (Code-Point)?#
The primary use case is straightforward: lookup a postcode to get its coordinates.
- Start with a Postcode: You have the postcode you're interested in.
- Look up the location: You query the Code-Point dataset using the postcode string.
- Retrieve the coordinates: The dataset returns the location associated with that postcode.
- Example Input: The postcode "EH1 1AA".
- Process: Load the Code-Point data. Find the entry where the
postcode
column is "EH1 1AA". - Example Output: The Easting and Northing coordinates for the centroid of postcode EH1 1AA.
You can then use these coordinates to display the point on a map, find other geographic features near that point, or link it to other data.
The Data Structure#
Code-Point data is often provided in a simple tabular format like CSV. Each row represents one postcode unit and its associated information.
Conceptually, based on the OS Open Code-Point bSDD Data Dictionary, it looks like this:
Property Name | Description | Data Type | Example Value |
---|---|---|---|
postcode |
Full unit postcode | String | SW1A 0AA |
easting |
British National Grid Easting | Integer | 529662 |
northing |
British National Grid Northing | Integer | 179896 |
local_authority |
Local authority name | String | Westminster |
... (other attributes) | ... | ... | ... |
Each row links a postcode
to a specific point location (easting
, northing
) and some other basic administrative/quality information.
Behind the Scenes: Getting Postcode Coordinates#
Here's a simple workflow showing how you look up coordinates using a postcode:
sequenceDiagram
participant YourSystem as Your BIM/GIS System
participant CodePointData as Code-Point Data (CSV)
YourSystem->>YourSystem: I have a postcode string (e.g., EH1 1AA).
YourSystem->>CodePointData: Look up the postcode EH1 1AA in the data.
CodePointData-->>YourSystem: Find the row where 'postcode' matches EH1 1AA.
CodePointData->>YourSystem: Return the Easting and Northing coordinates (and other attributes) for that row.
YourSystem->>YourSystem: I now have the location for postcode EH1 1AA.
This diagram shows how the CodePointData
dataset acts as a simple lookup table where you use the postcode as the key to find the associated location coordinates.
Now, let's look at a simple conceptual Python example using the pandas
library to read the data and find coordinates for a specific postcode. Assume you've downloaded the Code-Point Open data and have the main CSV file, perhaps named CodePointOpen.csv
.
First, loading the data:
# This is example conceptual Python code
import pandas as pd
# Load the Code-Point Open data from a CSV file
# In reality, this file is large, you might load strategically
print("Loading Code-Point Open data...")
codepoint_df = pd.read_csv('CodePointOpen.csv', header=None) # Often no header row
print("Data loaded.")
# Code-Point Open CSV columns are fixed. Based on documentation:
# 0: Postcode, 2: Easting, 3: Northing
# Let's name the relevant columns for clarity
codepoint_df = codepoint_df[[0, 2, 3]]
codepoint_df.columns = ['postcode', 'easting', 'northing']
# Display the first few rows
print("\nFirst 5 rows of the data:")
print(codepoint_df.head())
This code loads the data (specifying header=None
as many raw OS CSVs lack headers), selects the key columns for postcode and coordinates, names them for clarity, and shows the first few entries.
Now, let's find the coordinates for a specific postcode:
# Suppose you have this postcode
my_postcode = 'SW1A 0AA'
# Look up this postcode in the dataframe
# Ensure the postcode format matches the data (e.g., spaces included)
postcode_location = codepoint_df[codepoint_df['postcode'] == my_postcode]
# Print the result
print(f"\nLocation for postcode {my_postcode}:")
print(postcode_location)
The output of this code would show the row from the codepoint_df
DataFrame where the postcode
column matches "SW1A 0AA". This row contains the Easting and Northing coordinates for that postcode's centroid.
For example, the output might look like this:
Location for postcode SW1A 0AA:
postcode easting northing
123 SW1A 0AA 529662 179896
You've successfully used the postcode to retrieve its approximate geographic location from the Code-Point data. These coordinates can then be used in a GIS or spatial tool, or to relate this postcode area to other geographic datasets.
Postcode vs. UPRN vs. TOID#
It's important to remember the difference in precision and purpose:
- UPRN: Unique ID for an addressable location (a property, an entrance). High precision. Good for linking property-specific data.
- TOID: Unique ID for a geographic feature (a building footprint, a road line). High precision, linked to geometry. Good for linking feature-specific data.
- Postcode (Code-Point): Represents the approximate centroid of a postcode area. Lower precision (one point for ~15 addresses). Good for quick lookups, geocoding, and linking to data aggregated by postcode.
Code-Point is simpler and less granular than UPRNs or TOIDs, but it's readily available, easy to use for basic location lookups, and essential for working with data that is structured around postcodes.
Conclusion#
The Postcode (Code-Point) dataset provides a straightforward way to find the approximate geographic location (centroid) for any postcode unit in Great Britain. While not as precise as UPRNs for individual properties or TOIDs for specific building features, it's invaluable for quick geocoding, initial site referencing, and linking your location-based work to the vast amount of external data that is summarised and published using postcodes. It's a simple but effective tool for broader spatial analysis and linking.
Now that we've looked at referencing locations by individual properties (UPRNs), buildings (TOIDs), parts, sites, and postcode areas, let's explore another common way areas are defined for administrative and analytical purposes.
In the next chapter, we will look at Chapter 8: Administrative Boundaries (Wards), which provide official political and administrative areas.
Next Chapter: Administrative Boundaries (Wards)
Generated by AI Codebase Knowledge Builder