A public FastAPI-powered API for retrieving geographic administrative data of Cambodia, including provinces, districts, communes, and villages.
📍 Powered by official data from the General Department of Digital Economy
Base URL:
Interactive Docs:
- ✅ Get all provinces in Cambodia
- ✅ Drill down from province → district → commune → village
- ✅ Khmer and English names
- ✅ Fast and lightweight (CSV-based, cached in memory)
Retrieve geographic information based on optional filters.
| Name | Type | Description |
|---|---|---|
| province | string |
(optional) Province code |
| district | string |
(optional) District code |
| commune | string |
(optional) Commune code |
1. Get all provinces:
GET /v1/locations
2. Get all districts in a province:
GET /v1/locations?province=12
3. Get all communes in a district:
GET /v1/locations?province=12&district=1210
4. Get all villages in a commune:
GET /v1/locations?province=12&district=1210&commune=121001
- All data is sourced from: https://data.mef.gov.kh
Specifically:
CambodiaProvinceList2023.csvCambodiaDistrictList2023.csvCambodiaCommuneList2023.csvCambodiaVillagesList2023.csv
- Author: bsthen
- Version:
1.0.6 - License: MIT
- Contact: via GitHub
- Python 3.8+
- FastAPI
- pandas
- uvicorn
git clone https://github.com/bsthen/CambodiaGeoAPI.git
cd CambodiaGeoAPI
# (optional) create virtual environment
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
uvicorn main:app --reload
Feel free to:
- ⭐ Star the repo
- 🐛 Report issues
- 🤝 Submit pull requests