Import of UK postcodes and UPRNs (England & Wales)
UK postcodes and UPRNs (England & Wales) is an import from the Office for National Statistics UPRN Directory (ONSUD) and OS Open UPRN datasets which is of type (data type) covering (England and Wales in United Kingdom). The import is currently (as of 2025-10-22) at the planning stage.
Goals
The aim of this import process is to increase the number of UK postcodes recorded in OSM quickly and accurately. Very large numbers of UPRNs have been added to OSM in the last year, but I am not aware of any previously documented or discussed import process.
On 21st October 2025, Robert Whittaker's OSM Postcode Stats for Great Britain, reported that of 1,695,520 geographic postcode units in the UK, only 510,994 (30.1%) are currently mapped.
The import will add UK postcodes (addr:postcode=*, or postal_code=* for buildings which are not addressable in a meaningful sense) and Unique Property Reference Numbers (ref:GB:uprn=*) to buildings and other addressable features within England and Wales, UK.
For the purposes of this import, an "addressable feature" is a polygon with one of the following tags: building=*, amenity=hospital, amenity=place_of_worship, amenity=school, amenity=pub, leisure=sports_centre, shop=*, tourism=hotel. This is not intended to be a complete list of features which might reasonable be expected to have a postal address, juust a subset of those which may be the sole occupier of their plot of land and potential candidates for matching.
Postcodes and UPRNs will only be added to features which meet the following criteria:
- The feature intersects a Land Registry INSPIRE polygon and it is well aligned (at least 95% of the feature is within the INSPIRE polygon
- There is only one UPRN which intersects the feature. If there are multiple UPRNs, there is no way compatible with OSM's licence to determine which belongs to the whole feature and which to units or flats within.
Import changesets are limited to a single postcode sector. For UPRN imports, there is also a limit of 128 per changeset, to allow for visual checking of the alignment of potential matches.
An earlier attempt to do something similar in 2013, ONS Postcode Import was not deemed suitable for import as "The planned import could have assigned incorrect postcodes if buildings were not mapped correctly or on mixed use buildings (e.g. residential over commercial)." This preceded the release of both the Land Registry INSPIRE polygons and OS Open UPRN (2022), which are used here to prevent this issue arising.
Schedule
Proposed to be an ongoing project.
Imports will rotate between my local area (East London), newly mapped buildings in South-East England, whichever postcode sector currently has the lowest proportion of mapped geographical postcode units, and postcode sectors with the highest numbers of potential matches.
Import Data
Background
Data source sites:
https://www.gov.uk/guidance/inspire-index-polygons-spatial-data
Data license: OGLv3 https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/
Type of license (if applicable): https://spdx.org/licenses/OGL-UK-3.0.html
Link to permission (if required): N/A
OSM attribution (if required): https://wiki.openstreetmap.org/wiki/Contributors#Land_Registry_INSPIRE_Index_Polygons
ODbL Compliance verified: yes
https://www.ordnancesurvey.co.uk/products/os-open-uprn
Data license: OGLv3 https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/
Type of license (if applicable): https://spdx.org/licenses/OGL-UK-3.0.html
Link to permission (if required): N/A
OSM attribution (if required): https://wiki.openstreetmap.org/wiki/Contributors#Ordnance_Survey_OpenData
ODbL Compliance verified: yes
https://www.ons.gov.uk/methodology/geography/geographicalproducts/nationalstatisticsaddressproducts
Data license: OGLv3 https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/
Type of license (if applicable): https://spdx.org/licenses/OGL-UK-3.0.html
Link to permission (if required): N/A
OSM attribution (if required): https://wiki.openstreetmap.org/wiki/Contributors#Office_for_National_Statistics
ODbL Compliance verified: yes
Import Type
This will be a recurring import, as new buildings are always being added to OSM and larger buildings outlines split (e.g. terraces, semi-detached houses).
Data will be uploaded using JOSM.
Data Preparation
Data Reduction & Simplification
No reduction or simplification required. No additional geometries will be created and two tags will are documented and in use will be added.
Tagging Plans
Two tags will be imported from the source data.
| Source dataset | Source field | OSM tag |
|---|---|---|
| OS Open UPRN | UPRN | ref:GB:uprn=*
|
| ONS UPRN Directory | PCDS | addr:postcode=* OR postal_code=*
|
In addition to the imported tags, source:addr:postcode=ONSUD;OS Open UPRN or source:postal_code=ONSUD;OS Open UPRN will be added when a postcode is added.
Changeset Tags
Changesets adding UPRNs only
| Key | Value |
|---|---|
| comment | ($location) Import of UPRNs using Index polygons spatial data (INSPIRE) YYYY-MM, OS Open UPRN YYYY-MM |
| import | yes |
| source | OS Open UPRN;Land Registry INSPIRE Index Polygons |
| source:url | https://www.ordnancesurvey.co.uk/products/os-open-uprn https://www.gov.uk/guidance/inspire-index-polygons-spatial-data |
| source:date | (whichever is oldest of the source datasets) |
| import:page | link to this wiki page |
| source:license | https://spdx.org/licenses/OGL-UK-3.0.html |
Changesets adding postcodes only
| Key | Value |
|---|---|
| comment | ($location) Import of UK postcodes using OS Open UPRN YYYY-MM and ONS UPRN Directory YYYY-MM |
| import | yes |
| source | ONS UPRN Directory (ONSUD);OS Open UPRN |
| source:url | https://www.ons.gov.uk/methodology/geography/geographicalproducts/nationalstatisticsaddressproducts https://www.ordnancesurvey.co.uk/products/os-open-uprn |
| source:date | (whichever is oldest of the source datasets) |
| import:page | link to this wiki page |
| source:license | https://spdx.org/licenses/OGL-UK-3.0.html |
Changesets adding UPRNs and postcodes (initial stages of the project only)
| Key | Value |
|---|---|
| comment | Import of UK postcodes and UPRNs using Index polygons spatial data (INSPIRE) YYYY-MM, OS Open UPRN YYYY-MM, ONS UPRN Directory YYYY-MM |
| import | yes |
| source | ONS UPRN Directory (ONSUD);OS Open UPRN;Land Registry INSPIRE Index Polygons |
| source:url | https://www.ons.gov.uk/methodology/geography/geographicalproducts/nationalstatisticsaddressproducts https://www.ordnancesurvey.co.uk/products/os-open-uprn https://www.gov.uk/guidance/inspire-index-polygons-spatial-data |
| source:date | (whichever is oldest of the 3 source datasets) |
| import:page | link to this wiki page |
| source:license | https://spdx.org/licenses/OGL-UK-3.0.html |
Data Transformation
| Source dataset | Source field | Source data type | Transformation | OSM tag |
|---|---|---|---|---|
| OS Open UPRN | UPRN | integer | convert to string | ref:GB:uprn=*
|
| ONS UPRN Directory | PCDS | string (padded to 8 characters) | trim whitespace | addr:postcode=* OR postal_code=*
|
Data Merge Workflow
Team Approach
Initially solo, but all scripts will be made available via Github at a later date if desired by the UK mapping community.
References
List all factors that will be evaluated in the import.
Workflow
Imports will be made using the OSM user account rskedgell import
Identifying potential matches
- Download an OSM data extract from Geofabrik.
- Import the extract into a PostGIS database. The Osm2pgsql file import creates two tables, one containing (multi) polygon geometries of addressable features and another containing point geometries of addressable nodes.
- Filter the Land Registry INSPIRE polygons to exclude (1) all those which contain addressable nodes, to avoid potential address duplication and (2) all those which contain more than one UPRN.
- Find buildings and other addressable features which are well aligned. The filtered Land Registry Index polygons spatial data (INSPIRE) are used to find buildings and other addressable features the areas of which are at least 95% within an INSPIRE polygon. Buildings which are generally non-addressable outbuildings like garages, sheds, greenhouses, etc. are excluded. Only buildings where there is a Land Registry record a a freehold property will be found, which excludes a lot of social housing and new builds.
- Remove duplicates, as an INSPIRE polygon which contains multiple buildings may be a site like a school where the address tags might be better placed on the enclosing amenity=school polygon (or a number of top level tags).
- Find the building polygons which contain only one UPRN from OS Open UPRN, where the UPRN is also within the matched INSPIRE polygon. This excludes buildings subdivided into flats, as they will have multiple UPRNs and there is no appropriately licensed data source to determine which UPRN applies to which part of the property.
- Link the UPRN to the postcode from the ONS UPRN Directory (ONSUD), storing this in a database table.
Preparing data to import
- Download a small extract of current OSM data (using JOSM or Overpass Turbo).
- Use a Python script to compare with OSM extract with the database table of potential matches and add
addr:postcode=*andref:GB:uprn=*tags where these are absent. No existing values will be changed or overwritten. Features which have been a newer version to that in the database table will not be changed. For UPRNs, it will also stop processing after processing 128 addressable features per changeset, in order to allow visual checking of potential matches. - Check that the data for upload is correctly aligned and has postcodes near to their centroid, using the OSMUKCadastralParcels and Postcodecentroids layers. Check for any terraces which are otherwise correctly aligned, but incorrectly positioned by a whole building and exclude those from the upload.
- Upload the file using JOSM.
Revert plans
No geometry changes will be made during the conflation process, so reversion using (e.g.) the JOSM reverter plugin should be straightforward.
The source tags source:addr:postcode=ONSUD;OS Open UPRN and source:postal_code=ONSUD;OS Open UPRN could also be used to identify objects if reversion is required.
From 2025-11-17 onwards, UPRNs and postcodes are imported in separate changesets, in order to minimise potential data loss should any reversion or redaction be required in the future.
Post-import manual edits
- Once the postcode is known,
addr:city=*(andaddr:suburb=*if applicable) can be added. Obviously this can be done for most addresses by just looking at one of the available map layers, but it’s helpful near the boundary between post towns. - If there’s more than one instance of a postcode,
addr:street=*can be determined with reasonable confidence. Again, this can usually be done by simply looking at the map, but it helps work out to which street corner houses belong.
Conflation
Downloaded OSM XML files to be processed using a Python script, applying the changeset size policy above, then loaded into JOSM for checking and upload.
Sample Data
Sample data for two import batches, in Forest Gate E7 and Kington HR5, prepared 2025-10-28 are available at https://drive.google.com/drive/folders/1LoI17iuwFWGUssvd_Hzy5zGUhUMvBehe?usp=sharing
QA
In addition to steps detailed above, QA will include checks using tools provided by Robert Whittaker, including:
- UK Postcode Location Offsets
- Postcode sector maps at OSM Postcode Stats for Great Britain
- https://osm.mathmos.net/addresses/uprn/
See also
The post to the community forum was sent on 2025-10-22 and can be found here