Skip to content

JSON files for Thailand's geography data, including provinces, districts, subdistricts, and postal codes, adhering to best practices for optimal performance, ease of maintenance, and comprehensibility.

License

Notifications You must be signed in to change notification settings

eventpop/thailand-geography-json

 
 

Repository files navigation

Thailand Geography JSON

Thailand Geography JSON

A user-friendly collection of well-structured JSON files containing geographical data of Thailand, including provinces, districts, subdistricts, and postal codes.

License: MIT version Help Wanted


Contents

Important Files Overview

Discover the main JSON files with geographical data in the src/ directory:

  • geography.json - All-in-one data for provinces, districts, and subdistricts, including postal codes.
  • provinces.json - The 77 Thai provinces with their codes and names in English and Thai.
  • districts.json - The 928 Thai districts with codes, names in English and Thai, and related province codes.
  • subdistricts.json - The 7,436 Thai subdistricts with codes, names in English and Thai, and corresponding district and province codes.

Installation

This project doesn't require any specific installation steps, as it consists of static JSON files. To use the data in your project, simply download the JSON files or clone the repository using the following command:

git clone https://github.com/thailand-geography-data/thailand-geography-json.git

Usage

You can directly import the JSON files into your project and use the data as needed. Below are some examples of how to import and use the JSON data in different programming languages:

JavaScript

import geography from "./src/geography.json";
import provinces from "./src/provinces.json";
import districts from "./src/districts.json";
import subdistricts from "./src/subdistricts.json";

// Utilize the geography data as needed, for example:
// - Display data in a table
// - Render data on a map
// - Perform data analysis and visualization

Python

import json

with open('./src/geography.json', 'r') as f:
    geography = json.load(f)

with open('./src/provinces.json', 'r') as f:
    provinces = json.load(f)

with open('./src/districts.json', 'r') as f:
    districts = json.load(f)

with open('./src/subdistricts.json', 'r') as f:
    subdistricts = json.load(f)

# Utilize the geography data as needed, for example:
# - Display data in a table
# - Render data on a map
# - Perform data analysis and visualization

JSON Keys

Get to know the keys used in the JSON files:

  • provinceCode - Province code (2-digit number).
  • provinceNameEn - Province name in English (string).
  • provinceNameTh - Province name in Thai (string).
  • districtCode - District code (4-digit number).
  • districtNameEn - District name in English (string).
  • districtNameTh - District name in Thai (string).
  • subdistrictCode - Subdistrict code (6-digit number).
  • subdistrictNameEn - Subdistrict name in English (string).
  • subdistrictNameTh - Subdistrict name in Thai (string).
  • postalCode - Postal code (5-digit number).

Sample Data

Check out sample data from each JSON file:

provinces.json

{
  "id": 1,
  "provinceCode": 10,
  "provinceNameEn": "Bangkok",
  "provinceNameTh": "กรุงเทพมหานคร"
}

districts.json

{
  "id": 1,
  "provinceCode": 10,
  "districtCode": 1001,
  "districtNameEn": "Phra Nakhon",
  "districtNameTh": "พระนคร",
  "postalCode": 10200
}

subdistricts.json

{
  "id": 1,
  "provinceCode": 10,
  "districtCode": 1001,
  "subdistrictCode": 100101,
  "subdistrictNameEn": "Phra Borom Maha Ratchawang",
  "subdistrictNameTh": "พระบรมมหาราชวัง",
  "postalCode": 10200
}

geography.json

{
  "id": 1,
  "provinceCode": 10,
  "provinceNameEn": "Bangkok",
  "provinceNameTh": "กรุงเทพมหานคร",
  "districtCode": 1001,
  "districtNameEn": "Phra Nakhon",
  "districtNameTh": "พระนคร",
  "subdistrictCode": 100101,
  "subdistrictNameEn": "Phra Borom Maha Ratchawang",
  "subdistrictNameTh": "พระบรมมหาราชวัง",
  "postalCode": 10200
}

How to Contribute

To learn how to contribute to the project, please read the CONTRIBUTING.md file.

License

Copyright (c) 2023-Present Joe Takara. This project is licensed under the MIT License. See the LICENSE file for details.

Changelog

For information on the changes made in each version, please refer to the CHANGELOG.md file.

About

JSON files for Thailand's geography data, including provinces, districts, subdistricts, and postal codes, adhering to best practices for optimal performance, ease of maintenance, and comprehensibility.

Resources

License

Stars

Watchers

Forks

Packages

No packages published