About Services Tools Blog Contact us

UK Postcode to Map Position

Checks UK postcodes on directory entries and fills in map positions so nearby search and maps work. Invalid and placeholder postcodes are flagged and not sent for lookup.

  • Mapping & Geospatial
  • Cross-sector
  • Pipeline
  • Productised
  • Local/private
  • 2025

The problem

Shop, school and venue maps were empty when the only location data was a postcode. Entries with a blank or zero map position never showed in a near-me search. And placeholder text in an address field should not be sent to a location service.

What it does

Each postcode is tidied and checked against the UK format. It is then looked up in a local table, with a fallback on the first half of the postcode, before any public lookup. Invalid and placeholder postcodes are flagged and not sent. The same fill covers shops, schools and venues, including a pass limited to entries changed in the last day.

Outcomes

  • Rows with only a postcode can be put on a map.
  • Bad codes are reviewed and not plotted in the wrong place.
  • Most lookups stay on a local table, so a batch does not depend on the network.
  • A daily pass can refresh just the rows that changed.

Simplified mockup

Interactive preview with sample data. Nothing is sent to a server.

Geocode directory rows

Directory extract
Click to load rows that have no coordinates
Resolve
Load the extract to start
Five rows
NamePostcodePatternResult
Northgate Outfitters
–
HT2 4LD Valid Queued
Fenlock Primary
–
FL8 1QX Valid Queued
Reedmouth Hall
–
RB9 Outward only Queued
Mill Court Climbing
–
SQ2 6HN Valid Queued
Calder Hollow Centre
Not sent
TBC Placeholder Queued
Pins
Filled pins are an exact local hit. The open ring is an outward-code fallback. TBC is not plotted.

Held back from lookup

Calder Hollow Centre For review

The address field says TBC. That is placeholder text, not a postcode, so it is not sent to the local table or to a public lookup.

High Street, Calder Hollow. The row stays unpinned until someone replaces TBC.

Reedmouth Hall Coarse

RB9 is only the outward part. The full code is not in the local table, so the first outward hit is used and marked coarse. A near-me search can still include it, with a wider radius.

51.88, 0.91

Rows touched since yesterday

06:10
Checked
48
Coordinates written
5
Flagged
1
Changed rows only
NamePostcodeResultSource
Lang quay storesKY2 8ZZExactLocal table
East quay schoolNE4 2ZZExactLocal table
College end clinicOX3 9ZZExactLocal table
Sound booksPL4 1ZZExactLocal table
Ness edge clubIV3CoarseOutward code
Wharf Lane hallTBCFor reviewNot sent

The other 42 rows already had coordinates and were left alone.

How it works

  1. Put the postcode in capitals, remove spaces and check it against the UK format.
  2. Flag placeholder and invalid postcodes and do not send them for lookup.
  3. Read an exact match from a local postcode table.
  4. Try the first half of the postcode if the full one is missing, and use the first hit as a rougher position.
  5. Use the public postcodes.io service only when the local table has no match, and keep a successful result for next time.
  6. Write latitude and longitude back to the directory entry.

Pipeline

flowchart LR
  Row[Directory row] --> Norm[Normalise postcode]
  Norm --> Local[Local postcode table]
  Local --> Hit{Match?}
  Hit -->|Yes| Coord[Latitude and longitude]
  Hit -->|No| Api[postcodes.io]
  Api --> Coord
  Norm --> Bad[Flag invalid codes]