Skip to main content

GeoThai Python Library

PyPI - Version PyPI Downloads

Welcome to the GeoThai Python Library! This library provides a simple and efficient way to access detailed geographic data for Thailand, including provinces, districts, and subdistricts.

🌏 Overview

This Python library allows you to:

  • Retrieve information about provinces, districts, and subdistricts in Thailand.
  • Filter geographic data based on specific criteria.
  • Integrate geographic data into your Python applications with ease.

🚀 Installation

You can install the GeoThai Python Library via pip:

pip install geothai

📚 Usage

Importing the Library

from geothai import (
    get_all_provinces,
    get_province_by_code,
    get_provinces_by_criterion,
    Province
)

Retrieving All Provinces

provinces = get_all_provinces()
print(provinces)

Getting a Province by ID

province = get_province_by_code(10)  # Replace 10 with the desired province_id
print(province)

Filtering Provinces by Criteria

criteria: Province = {"name_th": "กรุงเทพมหานคร"}
matching_provinces = get_provinces_by_criterion(criteria)
print(matching_provinces)

Similarly, You Can Access Districts, Subdistricts and Postal Codes

districts = get_all_districts()
subdistricts = get_all_subdistricts()
postal_codes = get_all_postal_codes()

📂 Project Structure

The project is structured as follows:

  • geothai/data/: Contains the data files for provinces, districts, and subdistricts.
  • geothai/services/: Contains the main services for accessing province, district, and subdistrict data.
  • geothai/types/: Includes type definitions for provinces, districts, subdistricts, and postal codes.
  • geothai/utils/: Includes utility functions like criteria matching for filtering data.

🛠 Development

To contribute to the development of this library:

  1. Clone the repository:
git clone https://github.com/GeoThai/python-library.git
  1. Install the required dependencies:
pip install -r requirements.txt
  1. Run the tests:
pytest

🤝 Contributing

We welcome contributions to enhance the functionality of this library. Please check the CONTRIBUTING.md for guidelines on how to contribute.

📄 License

This project is licensed under the MIT License. See the LICENSE file for details.

🙋‍♂️ Contact

If you have any questions, issues, or suggestions, feel free to reach out at geothai@fasu.dev.

Metadata

Release files for geothai 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for geothai 2.0.1
File Size Uploaded
geothai-2.0.1.tar.gz 35.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for geothai 2.0.1
File Interpreter ABI Platform
geothai-2.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 71.5 kB

Release files / geothai-2.0.1.tar.gz

Download URL geothai-2.0.1.tar.gz
Size 35.7 kB
Tags Source
SHA-256 checksum
How to use checksums
346bca83c17be7010f429cb6265d0c1e38a497b314124dde1710d078e4f1cd2e
BLAKE2b-256 checksum
How to use checksums
0a69ad7b22689d1258e52ef739e9981e31ffa8cdb7b5487750cd1c9329f42445
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 28, 2026.

Transparency log

Release files / geothai-2.0.1-py3-none-any.whl

Download URL geothai-2.0.1-py3-none-any.whl
Size 35.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dd35cb513c044121cebfe3e8d67b9782db3624d43ebc3dc5845b25f9714c6bee
BLAKE2b-256 checksum
How to use checksums
1dec5ca63e10c6668149ad212f6fca6ea2628d44aeb934f0cacff9ff2906a9af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 28, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.0.1 This release

2 release files

2.0.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page