Part of a Data Solution
- Explore →
Postal Codes Solution
Every worldwide postal-code dataset in one bundle — the ultimate global reference for precise postal codes.
Premium
You're viewing a free sample
Get the complete dataset — all rows and files — delivered instantly after checkout, with lifetime access to the latest version.
- Secure checkout via Stripe
- Instant download after payment
- Lifetime access to the latest version
- Creative Commons Attribution 4.0 (LINZ, Stats NZ) license
API Access
Access dataset files directly from scripts, code, or AI agents.
Browse dataset files
API Access
Access dataset files directly from scripts, code, or AI agents.
Each file has a stable URL (r-link) that you can use directly in scripts, apps, or AI agents. These URLs are permanent and safe to hardcode.
Start with these files — they give you everything you need to understand and access the dataset.
- 1. Fetch datapackage.yaml to inspect schema and resources
- 2. Download data resources listed in datapackage.yaml
- 3. Read README.md for full context
Data Files
postal-codes-nz-sample
| Field | Type | Description | Constraints | Title |
|---|---|---|---|---|
| country_code | string | ISO 3166-1 country code — always NZ | { "pattern": "^NZ$", "required": true } | Country Code |
| postal_code | string | Four-digit New Zealand postcode (leading zeros significant) | { "pattern": "^\\d{4}$", "required": true } | Postal Code |
| place_name | string | Representative locality / suburb | Place Name | |
| admin_name1 | string | Region (one of the 16 NZ regions) | Administrative Name 1 | |
| admin_code1 | string | ISO 3166-2:NZ region code | Administrative Code 1 | |
| admin_name2 | string | Territorial authority — official Stats NZ 2025 name | Administrative Name 2 | |
| admin_code2 | string | Stats NZ Territorial Authority 2025 code (3-digit) | Administrative Code 2 | |
| admin_name3 | string | Reserved — not populated for New Zealand | Administrative Name 3 | |
| admin_code3 | string | Reserved — not populated for New Zealand | Administrative Code 3 | |
| latitude | number | Latitude (WGS84, decimal degrees) — LINZ centroid where available | Latitude | |
| longitude | number | Longitude (WGS84, decimal degrees) — LINZ centroid where available | Longitude | |
| accuracy | string | Reserved — not populated for New Zealand | Accuracy | |
| alternative_city_name | string | Pipe-separated additional localities sharing the postcode | Alternative City Name |
Download
Download sample CSVAbout
- Last updated
- 9 October 2026
- Total rows
- 100
- Format
- CSV
- File size
- 8.22 kB
- Sources
- LINZ NZ Addresses (Toitū Te Whenua Land Information New Zealand)
- LINZ NZ Addresses, LINZ's public ArcGIS Online feature service (read by the producer)
- Stats NZ Territorial Authority 2025
- Stats NZ Territorial Authority 2025, public ArcGIS feature service (read by the producer)
- New Zealand postcodes (community, public domain)
About this dataset
New Zealand (NZ): migration notes
Internal record of the P5 migration from the old scripts to the producer: the discrepancies found, their causes, and who decided what. This is a dated record, so the numbers are as of the migration and not kept current. It is not shipped in the zip.
- Issue: pc-28e.7.40 (closed 2026-10-03)
- Commits:
e5cef74(producer; worktree65ca3d0) and84bc512(centroid fix; worktree2a16487), both landed unchanged, batch 5 - Parity verdict:
unexplained(unclassified coordinate cells); accepted by the user as LINZ drift plus the centroid fix - Producer:
custom, refresh disabled
Sources
| Input | URL | Notes |
|---|---|---|
| Community postcodes (Matthew Proctor, public domain) | https://raw.githubusercontent.com/matthewproctor/australianpostcodes/master/newzealand_postcodes.csv | Same URL as the old parse_nz.py. Unchanged upstream since 2022-01 |
| Stats NZ Territorial Authority 2025 | https://services2.arcgis.com/vKb0s8tBIA3bdocZ/arcgis/rest/services/Territorial_Authority_2025/FeatureServer/0 | Public ArcGIS service; same URL as the old fetch_nz_reference.py |
| LINZ NZ Addresses (LDS layer 123113) | https://services.arcgis.com/xdsHIIxuCWByZiCB/arcgis/rest/services/LINZ_NZ_Addresses/FeatureServer/0 | Endpoint switch. LINZ's own ArcGIS Online service (owner administrator_LINZ, CC-BY 4.0, linked to data.linz.govt.nz/layer/123113), no key. ~2.43M points (last edited 2026-09-28), paged in OBJECTID windows and reduced to per-(locality, TA) sums, checked against the layer's own count |
- The old pipeline read LINZ through the LDS WFS, which needs a
LINZ_KEY. No key exists in.envor.env.prod, and a keyless request returns 401. - The old monthly build didn't fetch LINZ at all: it used a frozen locality reference (
nz_linz_reference.csv, plusstatsnz_ta_codes.csv) staged in R2 atnz/linz/, of unknown date. The producer recomputes the reference from today's addresses on every run. - The descriptor
sourceskeep the LDS and Stats NZ datafinder pages and add the two ArcGIS services the producer reads.
Parity against the live zip (2026-10-03)
Live reference: nz/consolidated/latest/nz.zip. Rows: 1,722 live and 1,722 fresh, none only on one side. Every column except latitude and longitude matches live exactly, row order included (postcodes, place names, regions, ISO codes, TA names and codes, alternate names).
First run (65ca3d0): 893 rows changed, 1,689 cells (latitude 833, longitude 856): coordinate_precision ×112, unclassified ×1,577.
Landed (2a16487, after the centroid fix): 938 rows changed, 1,785 cells (latitude 883, longitude 902): coordinate_precision ×92, unclassified ×1,693. The fix changed 185 rows compared with the first run, coordinates only.
| Distance from live | First run | Landed |
|---|---|---|
| ≤1.5e-6° (rounding) | 52 | 43 |
| ≤1e-4° | 617 | 582 |
| ≤1e-2° | 205 | 242 |
| >1e-2° | 19 | 71 |
Causes:
- Small moves (most rows): LINZ address edits since the frozen reference. E.g. 0114 Hikurangi −35.593753 → −35.593777. Not traced cell by cell: the old reference sits in R2 outside our own zip, which the agent wasn't allowed to read.
- Same-name localities blended (old build and first run). The old reference averaged every same-name locality nationwide. Examples: 2159 Otara in live carries Southland's Otara point (−46.626667, 168.887758) with TA Auckland, which the agent couldn't reproduce from one reference; the first run gave the mean of Auckland, Ōpōtiki and Southland (−37.096046, 174.930438); landed gives Auckland's Ōtara (−36.961775, 174.879237). 1042 Hillsborough and 0140/0149 Riverside were blends in live too; landed gives Auckland's and Whangarei's. 3886/3988 Owhiro now equal live (Ōtorohanga's Ōwhiro).
- Locality renames (macrons) and new homonyms change which rows get a LINZ centroid vs community coordinates: 0472 Pakaraka, 4273 Argyll East (−39.8672, 176.5055 → −39.837184, 176.550778) and 4542 Wanganui East now get a LINZ centroid; 2025 Manukau and 3015 Fairy Springs fall back to community coordinates. Agent's reading; not traced against the old reference.
- The fix moves some rows further from live, because live had the same blending: rows more than 0.01° from live rose from 19 to 71, e.g. 0145 Kensington, 9082 Aramoana, 4614 Normanby, Oakura.
Decisions
| Decision | By | Basis |
|---|---|---|
| Read LINZ NZ Addresses from LINZ's ArcGIS Online service instead of the keyed LDS WFS | User, 2026-10-03 (session d33e1b7e): "Approve + fix Ōtara (Recommended)" | Same layer, same publisher, same licence; a source-endpoint switch, so it went to the user |
| Accept the coordinate changes as LINZ upstream drift | Same answer | The question said 893 rows recompute; everything else matches live |
| Centroid = mean of the dominant TA's points only (no blending same-name localities; points with no TA excluded) | User, same answer (the "fix Ōtara" option); implemented by the agent | The agent kept the old join (dominant TA per normalised locality, region-gated) because keying by (locality, region) would have changed some rows' TA |
| Land with 938 changed rows, 71 of them >0.01° from live | Orchestrator, under the user's approval | The fix's net effect (19 → 71 rows) was reported to the user after landing, not asked beforehand |
| Remove "1,722 postcodes", "zero duplicates" and "Rows: 1,722" from README | Agent, per the README counts rule |
Transforms carried over
Folded from parse_nz.py → fetch_nz_reference.py → enrich_nz.py → integrity_checker.py (all deleted with the scripts README):
- One row per postcode: the first community row wins (place_name, region, TA, lat/long); the other distinct localities for that postcode go to
alternative_city_name, pipe-separated, in source order. admin_code1→ ISO 3166-2:NZ via a region-name crosswalk (both "Manawatu-Wanganui"/"-Whanganui" and "Hawke's"/"Hawkes Bay" spellings).- LINZ reference: points grouped by normalised
suburb_locality(accents stripped, lowercased, non-alphanumerics dropped); dominant TA per locality; centroid rounded to 6 dp; points outside lat −48..−33 / lon 165..179 (e.g. the Chathams) ignored. The TA's region is the community file's dominant region for it. - Region-gated join: Stats NZ TA 2025 name, 3-digit code and LINZ centroid only when the locality's TA region equals the row's region; otherwise the community TA name is standardised to its Stats NZ name and code and community coordinates stay (e.g. Auckland's vs Hurunui's "Balmoral").
admin_name3,admin_code3andaccuracystay empty.- Old checks are now
ProducerErrors: 4-digit postcode, known region, all 16 regions present, uniquepostal_code, coordinates inside NZ, every row has a TA code. No row-count assert.
Open questions
- The README Fields table still has a "Fill" column with percentages; left for the end-of-epic sweep (pc-hfz).
- Resolved (user, 2026-10-05, pc-28e.7.59): the centroid fix's drift (19 → 71 rows >0.01° from live) is accepted.
- Resolved (user, 2026-10-05, pc-28e.7.59): add an
ATTRIBUTION.txtfor LINZ and Stats NZ (CC BY 4.0). Tracked as pc-28e.15.
Provenance
Reconstructed 2026-10-05 from the agent transcript d33e1b7e-5027-498a-a97f-ba914ee2524e/subagents/agent-ab984f25be9928a2e.jsonl (both hand-backs), the orchestrator session d33e1b7e-… (question, user answer, relayed fix instruction, landing), the two commit messages, the bd close reason and docs/parity/p5.md.