Postal Codes Dataset for Thailand, TH

304
Updated:
Files:1
Size:59.7 kB
Rows:903
Formats:csv
License:CC-BY-4.0

Postal Codes Dataset for Thailand, TH 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 International license
20% off
$49.90$39.92
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-th/
https://datahub.io/logistics/postal-codes-th/_r/-/.licensing-notes.md
https://datahub.io/logistics/postal-codes-th/_r/-/.migration-notes.md
https://datahub.io/logistics/postal-codes-th/_r/-/ATTRIBUTION.txt
https://datahub.io/logistics/postal-codes-th/_r/-/README.md
https://datahub.io/logistics/postal-codes-th/_r/-/datapackage.yaml
Key Files

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

datapackage.yaml— metadata & schema
https://datahub.io/logistics/postal-codes-th/_r/-/datapackage.yaml
README.md— documentation
https://datahub.io/logistics/postal-codes-th/_r/-/README.md
Typical Usage
  1. 1. Fetch datapackage.yaml to inspect schema and resources
  2. 2. Download data resources listed in datapackage.yaml
  3. 3. Read README.md for full context

Data Files

postal-codes-th-sample


About this dataset

Thailand (TH) — internal licensing notes

Source research, 2026-08-27 — sellability + reproducibility audit

TH is the weakest dataset of the group and has the largest available upgrade. What is currently sold has 903 rows with no admin2 or admin3 tier at all; an MIT-licensed community source carries 7,452 sub-districts each with a postal code.

What is currently sold — GeoNames TH, and it is very thin

https://download.geonames.org/export/zip/TH.zip       # 14 KB, 903 rows

Licence CC-BY-4.0, verified against export/zip/readme.txt on 2026-08-27 — Thailand carries no per-country caveat. So it is legally sellable. The problem is content, not licence:

value
rows903
distinct postal codes771
admin_name2 / admin_name3empty in GeoNames — published as the literal string nan
accuracyblank on 301 of 903 rows
coordinatesone repeated point per province (every Bangkok row is 13.7333, 100.5)

th/th.csv on R2 contains 1,793 nan string literals — effectively two whole columns of them. Row count matches TH.zip exactly (903), confirming it is a straight re-export.

Thailand's real administrative structure is 77 provinces (จังหวัด) → 928 districts (อำเภอ) → ~7,450 sub-districts (ตำบล). The sold file reaches neither of the lower two tiers.

https://raw.githubusercontent.com/kongvut/thai-province-data/master/api/latest/sub_district.json
https://raw.githubusercontent.com/kongvut/thai-province-data/master/api/latest/district.json
https://raw.githubusercontent.com/kongvut/thai-province-data/master/api/latest/province.json

Licence MIT (confirmed via the GitHub API and the repo's LICENSE: "MIT License, Copyright (c) 2025 Kongvut Sangkla"). MIT permits commercial redistribution on the copyright/permission notice alone.

Verified by download on 2026-08-27 (sub_district.json, 2.3 MB):

value
sub-districts (tambon)7,452
rows carrying zip_code7,452 (100%)
distinct postal codes955
rows with lat/long7,124 (95.6%)
namesThai (name_th) and English (name_en) at every tier
hierarchygeographies → provinces → districts → sub-districts, joined by id

Repo health: 379 stars, last pushed 2026-05-25, records carry updated_at (sample row updated 2025-09-20), ships JSON Schema validation and CSV / JSON / SQL / XLSX / XML exports. fetch_tier: static — raw GitHub URLs.

This would take TH from 903 rows with two dead columns to ~7,450 rows with a full three-tier hierarchy, bilingual names, and real per-tambon coordinates.

Provenance gap — resolve before shipping. The repo's docs describe
data/raw/ as "ข้อมูลต้นทางจากหน่วยงาน" (source data from the agency)
but name no agency and state no upstream licence. MIT covers the
repository author's own contribution; it cannot grant rights the author
did not hold. This is exactly the shape of the HDX/GADM trap recorded in
datasets/al/.licensing-notes.md — a permissive container label over an
unverified component. The likely upstream is the Department of Provincial
Administration (DOPA) for the admin hierarchy and Thailand Post for the
codes; Thai copyright law excludes certain government announcements and
regulations from protection, which may well settle it, but that has not
been verified and must be before this source ships.

Other community candidates (checked, not preferred)

RepoLicenceNote
GeoThai/dataMITv2 is nested with postal codes; only 4 stars, much smaller reach than kongvut
logicspark/complete-thailand-addressMITThai + English with postal codes, but last pushed 2023-06-14 — stale
DevelopedbyWill/thailand-canonical-admin-namesNOASSERTIONClaims CC BY 4.0 in its description, but GitHub's licence detector returns NOASSERTION — the repo licence is not machine-identifiable. Names only (TIS-1099 + ISO 3166-2), no postal codes. Do not rely on the claimed licence without reading the actual file.

❌ Official Thai portals — blocked, unverified

Both national open-data catalogues refused automated access on 2026-08-27:

  • data.go.th → HTTP 403, Cloudflare ("your request has been blocked by our security systems", Ray ID logged).
  • gdcatalog.go.th → HTTP 403, Imperva/Incapsula block page.

Neither was assessed. Per CLAUDE.md this is a fetch_tier: stealth situation — a re-attempt should use StealthyFetcher, not more plain-GET variations. Until then, no claim can be made either way about what official Thai postal data is available or how it is licensed.

Thailand Post (thailandpost.co.th) offers a lookup form; no bulk download was found.

Defects in the currently-published file

  • 1,793 nan string literals — admin_name2 and admin_name3 are written as the text nan on essentially every row, from a pandas round-trip of GeoNames' empty columns. They should be empty strings.
  • accuracy written as float (4 → 4.0) and blank on 301 rows.
  • 903 rows but only 771 distinct postal codes; check duplicates against the (country_code, postal_code, place_name) primary key rule.
  • Coordinates are province-level points repeated across every row in the province — accuracy should say so rather than being blank.

Attribution is absent from the sold product. R2 carries only th/th.csv — no README.md, datapackage.json, ATTRIBUTION.txt or th.zip. The repo datapackage.yml lists sources: [{title: "Multiple sources"}] with no licenses[]. CC BY 4.0 attribution is a licence condition — live breach on a paid product.

datapackage.yml also sets is_premium: true with no premium_tier and no premium_source_key, and no zip exists in R2 for a key to point at. At 903 rows against a 100-row public sample, premium status here is especially hard to justify in its current state.

licence_status (proposed — needs human sign-off before shipping)

{
  "channel": "postal-codes-r2",
  "components": [
    {
      "field_group": "all fields (current build)",
      "source_url": "https://download.geonames.org/export/zip/TH.zip",
      "licence_id": "CC-BY-4.0",
      "collected_at": "2026-08-27",
      "decision": "compatible",
      "decided_by": "claude-opus-5 (source research)",
      "decided_at": "2026-08-27"
    },
    {
      "field_group": "PROPOSED admin2/admin3 tiers, tambon postal codes, coordinates",
      "source_url": "https://github.com/kongvut/thai-province-data",
      "licence_id": "MIT",
      "collected_at": "2026-08-27",
      "decision": "unresolved",
      "decided_by": null,
      "decided_at": null,
      "note": "MIT confirmed on the repository, but the upstream government agency behind data/raw/ is unnamed and its licence unverified. MIT cannot grant rights the author did not hold. Resolve the upstream before shipping."
    }
  ]
}

Per CLAUDE.md only decision: "compatible" may reach a shipped artifact, so the kongvut component blocks shipping until the upstream is identified. A GeoNames-only rebuild is shippable today and fixes the 1,793 nan literals, but it cannot add the missing admin tiers.

Proposed tier

B ($49) for a corrected GeoNames-only rebuild. A ($99) if the kongvut consolidation goes ahead and its provenance clears — that would be a genuine two-source build taking the dataset from 903 to ~7,450 rows with a full hierarchy. Do not price it as A while it is still 903 rows with two columns of nan.


Deeper research pass — 2026-08-27 (second pass)

Chasing the two questions the first pass left open: who is the unnamed upstream behind the MIT repo, and what do the blocked government portals hold.

Copyright Act B.E. 2537 (1994) §7 lists what is not a copyright work. Two limbs matter here:

  • §7(3) — "regulations, by-laws, notifications, orders, explanations and official correspondence of the Ministries, Departments or any other government or local units".
  • §7(1) — "facts having the character of mere information which is not a work in literary, scientific or artistic domain".
  • §7(5) extends the exclusion to collections of (1)–(4) made by government units.

Thailand's province / district / sub-district structure is established by DOPA notifications (ประกาศ กรมการปกครอง), which fall squarely under §7(3). The admin hierarchy and its TIS-1099 codes are therefore not copyright-protected in Thailand — this is a stronger position than most countries in this catalogue.

The postal codes themselves are a separate and weaker question. Thailand Post is บริษัท ไปรษณีย์ไทย จำกัด — a corporatized state-owned company since 2003, not a "Ministry, Department or government unit", so §7(3) does not plainly reach it. The better argument for the codes is §7(1) (mere facts), which is likely but not settled. Do not assert §7(3) over Thailand Post material.

2. kongvut/thai-province-data is maintained partly FROM WIKIPEDIA — decisive

The first pass flagged the unnamed upstream. It is now partly identified, and the answer is a problem:

  • CONTRIBUTING.md's own worked example for submitting a data change cites th.wikipedia.org in its ### Reference section.
  • Of the 21 most recent PRs, 4 carry source URLs: 3 cite Wikipedia, 1 cites DOPA and the Bank of Thailand.

Wikipedia is CC BY-SA. This project's own ESP precedent (CLAUDE.md, Admin Level Mapping Registry) states plainly that Wikipedia is not usable as an admin source where share-alike would encumber a resold derivative.

Fair counter-argument, recorded so it is not lost: what contributors actually copy from Wikipedia are individual facts — a district's English spelling, a new sub-district's code. Facts are not copyrightable, and Thai law says so explicitly in §7(1). So this is probably not a true CC BY-SA derivative work.

But the gate is "does a verified decision exist", not "does it feel low-risk" — the same rule that keeps Senegal's "scraped from a JS bundle" source clean and Maldives' identically-described one dirty. We cannot produce a clean provenance chain for kongvut, so it stays decision: "unresolved" and remains a hard block on shipping.

3. GeoThai/data is worse, not a fallback

Its README names its own source as "GeoThai [GitHub Repository]" — circular, with no upstream named at all. MIT asserted over entirely unknown provenance. Do not substitute it for kongvut.

4. The government portals are GEO-BLOCKED, not bot-blocked

Important correction to the first pass, which recorded these as Cloudflare/Incapsula bot walls and suggested StealthyFetcher. They are not:

  • data.go.th/ — 403 on the homepage, not just the API path.
  • gdcatalog.go.th/ — 403 on the homepage.
  • StealthyFetcher with solve_cloudflare=True reports "No Cloudflare challenge found" and still returns 403.

Egress for this machine is 178.91.253.x, Kazakhstan. This is a blanket IP block, and no fetcher tier or user-agent will move it. Assessing Thailand's official open-data catalogue requires a Thai-egress proxy or VPS, not a better scraper.

This is the single highest-value unblock for TH. DOPA's admin dataset published through data.go.th would be §7(3) public domain, would give the full 7,452-tambon hierarchy with official codes, and would remove the kongvut provenance problem entirely.

Revised recommendation

  1. Ship a GeoNames-only cleanup now — fixes the 1,793 nan literals and the float accuracy, stays 903 rows, tier B, licence unambiguous. This is available today and needs no decision from anyone.
  2. Do not ship kongvut until either DOPA's own data is obtained directly, or a human accepts the residual Wikipedia-provenance risk in writing.
  3. Get a Thai-egress route to data.go.th. That is what turns TH from a 903-row filler dataset into a real 7,450-row product on a clean public-domain footing.