GeoThai
Every province, district, subdistrict and postal code of Thailand, built from official sources, with packages for TypeScript and Python, boundary shapes, and SVG maps.
view .mdopen in claudeopen in chatgpt
GeoThai gives you the administrative areas of Thailand: 77 provinces, 928 districts and 7,436 subdistricts, with DOPA codes, Thai and English names, and postal codes. The data comes from the Department of Provincial Administration (DOPA, กรมการปกครอง), and independent sources check every postal code. The website has one page for each area, with a map.
The Packages
@geothai/core: Lookups, search and address matching for browsers, Node, Bun, Deno and edge runtimes, with no dependencies. Until 4.2, it wasgeothai.geothai: The same functions for Python 3.11 and later, with frozen dataclasses andLiteraltypes for every code.@geothai/maps: Maps of Thailand as SVG for any framework, with choropleth fills and a<geothai-map>element. Adapters exist for React, Vue and Svelte.
Usage
import { address, byPostalCode, match, province } from "@geothai/core";
province("84");
// { code: '84', name_th: 'สุราษฎร์ธานี', name_en: 'Surat Thani' }
byPostalCode("84280").map((s) => s.name_th);
// ['เกาะพะงัน', 'บ้านใต้']
match({ subdistrict: "ต.ตลาด", district: "อ.เมือง", province: "สุราษฎร์ธานี" })[0]?.subdistrict.code;
// '840101'
from geothai import match, province
province("84").name_en # 'Surat Thani'
match("ต.ตลาด", district="อ.เมือง", province="สุราษฎร์ธานี")[0].subdistrict.code # '840101'
import { provinces, render, toSvg } from "@geothai/maps";
const svg = toSvg(render(provinces, { fills: { 10: "#ffcf3f" } }));
The Repositories
- data: JSON and CSV files with a Frictionless
datapackage.json. Each release has a date tag, such asv2026.10.23. - boundaries: Province, district and subdistrict shapes on DOPA codes, as GeoJSON and TopoJSON, from OCHA COD-AB.
- npm-packages, python-library and maps: The packages. A new data release publishes a patch of
@geothai/coreandgeothaion its own. - website: The Astro site at geothai.fasu.dev.
Abolished areas list the areas that took their place, from Royal Gazette notices or by Thai name. The story of the rebuild is in Rebuilding GeoThai.
Stats
- The old
geothainpm package had more than 26,000 downloads in the past year. - All npm packages publish from CI with provenance.