Postal Codes Dataset for Spain, ES

419
0
Updated:
Files:1
Size:8.8 kB
Formats:csv
License:CC-BY-4.0

Postal Codes Dataset for Spain, ES including name of the city, town, or place, various administrative divisions and alternative city names.

Part of a Data Solution

  • Postal Codes Solution

    Every worldwide postal-code dataset in one bundle — the ultimate global reference for precise postal codes.

    Explore →

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 license
10% off
$49.90$44.91
one-time payment

API Access

Access dataset files directly from scripts, code, or AI agents.

Browse dataset files
Dataset Files

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.

/logistics/postal-codes-es/
https://datahub.io/logistics/postal-codes-es/_r/-/.licensing-notes.md
https://datahub.io/logistics/postal-codes-es/_r/-/README.md
https://datahub.io/logistics/postal-codes-es/_r/-/datapackage.yml
Key Files

Start with these files — they give you everything you need to understand and access the dataset.

datapackage.ymlmetadata & schema
https://datahub.io/logistics/postal-codes-es/_r/-/datapackage.yml
README.mddocumentation
https://datahub.io/logistics/postal-codes-es/_r/-/README.md
Typical Usage
  1. 1. Fetch datapackage.yml to inspect schema and resources
  2. 2. Download data resources listed in datapackage.yml
  3. 3. Read README.md for full context

Data Files

Postal Codes Data Resource for Spain, ES


About this dataset

Spain (ES) — internal licensing notes

Not mentioned in datahub-next#941 — no known licensing flag on this country. Sources: IGN/CNIG CartoCiudad INSPIRE WFS (CC BY 4.0 — postal codes, coordinates), INE municipality register (official Spanish government admin reference), GeoNames ES (CC BY 4.0, cross-check only). Deliberately NOT Correos (their paywall covers the CP polygon cartography) and NOT Wikipedia (CC BY-SA share-alike would encumber a resold derivative).

Session finding, 2026-08-19

Fixed es/scripts/ from hardcoded other-repo paths to self-contained. Committed two static reference files that aren't re-derivable by any fetch step: muni_corrections.csv (7 manually-verified municipality corrections, each with an evidence string from a CartoCiudad geocoder query) and the buyer-facing README template. resolve_po_box_codes.py bootstraps from the currently-published es.csv on R2 (a within-repo dependency, not external) purely as a discovery list of which PO-box-style codes exist — none of that file's own data is trusted, every code is independently re-resolved (its admin_name3 is literally the string "nan" and its coordinates are demonstrably wrong for these rows).

Verified end-to-end from a fresh fetch: 8,132 municipalities / 52 provinces / 19 communities (exact match to documented counts), 288/288 PO-box codes resolved, 14,538/14,538 final rows, 100% admin coverage, 100% coordinate fill. Sorted diff against live R2: 296 lines, entirely the known alternative_city_name gap on 148 PO-box rows (independent geocoder resolution difference, not a bug).

Real ordering gotcha documented for future runs: build_dataset.py must run twice — once before resolve_po_box_codes.py (to produce the baseline it diffs against) and once after (to fold in the resolved codes + coordinates). Getting this wrong silently produces an empty PO-box table — happened once during this same session's work.

No further licensing review — this was a code-reproducibility audit.

CLOSED — 2026-08-24 (datahub-next#941 §4)

Live datapackage.json carried a sources array — forbidden by this project's standing directive (source attribution belongs in ATTRIBUTION.txt and the README, never in datapackage.json). Stripped from the live object and from package_delivery.py (which had been writing it on every rebuild). Added standalone es/ATTRIBUTION.txt (now in R2 and inside es.zip) carrying the CartoCiudad/INE/GeoNames attribution content that was previously only in the sources array — nothing lost, correctly relocated. package_delivery.py now writes and zips ATTRIBUTION.txt on every run. _meta/catalog.json's ES entry rebuilt to include it.