Postal code service area check
Check whether a postal code falls inside a boundary — a school catchment, a service area, a delivery zone — without asking anyone for their street address.
How it works
Rather than geocoding an address and testing one point, this tests every address carrying the postal code against the boundary. Three outcomes:
| Result | Meaning | What to do |
|---|---|---|
| All inside | Every address under the code is in the area | Answer with confidence, no address needed |
| All outside | None are | Answer with confidence |
| Split | The code straddles the boundary | Ask for the street address, only now |
Most postal codes fall entirely within one catchment, so most enquiries resolve on six characters. The ones that split are exactly the ones where guessing would have been wrong.
Why this matters for public-facing forms
A “which school does my child attend” form that asks for a full home address collects personal information it usually does not need. The same form asking for a postal code answers correctly most of the time, and asks for more only when it genuinely cannot.
Less data collected, fewer privacy obligations, and a shorter form.
Doing this offline
SELECT
count(*) AS addresses,
count(*) FILTER (WHERE ST_Within(a.geom, s.geom)) AS inside
FROM addresses a
JOIN service_areas s ON s.id = :area_id
WHERE a.postal_code = :postal_code; Precompute it once and the lookup is a single indexed read. Working with postal codes has the materialized view.