Code Monkey home page Code Monkey logo

thailand-geography-json's Introduction

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

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

districts.json

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

subdistricts.json

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

geography.json

{
  "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.

thailand-geography-json's People

Contributors

joetakara avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.