Skip to content

GeoThai/python-library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

21 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

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.

About

An python package that allows to access detailed geographic data on Thailand, including provinces, districts, and subdistricts. ๐ŸŒŸ

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Contributors