Baan is a Ruby library that provides geodata for administrative regions in Lao PDR, including provinces and districts. The name "Baan" (ບ້ານ) means "village" in Lao, reflecting the project's aim to support geographic and community-based applications.
Add this line to your Gemfile:
gem "baan"Then run:
bundle installOr install it manually:
gem install baanThe data is stored in YAML format under the lib/data/ directory:
Each record includes:
Provinces
code: 3166-2:LA codename_lo: Lao namename_en: Romanized namedistricts: List of districts
Districts
code: Administrative codeparent_division: Parent provincename_lo: Lao namename_en: Romanized name
# Get all provinces
Baan::Province.all
=>
{"LA-VT" =>
#<data Baan::Province
code="LA-VT",
name_en="Vientiane Prefecture",
name_lo="ວຽງຈັນ",
subdivisions=
[#<data Baan::District code="0101", name_en="Chanthabuly", name_lo="ຈັນທະບູລີ", subdivisions=[], parent_division=#<data Baan::Province:...>>,],
parent_division=nil>,
# ...other provinces
}
# Get a province by its code
Baan::Province["LA-VT"]
=>
#<data Baan::Province
code="LA-VT",
name_en="Vientiane Prefecture",
name_lo="ວຽງຈັນ",
subdivisions=
[#<data Baan::District code="0101", name_en="Chanthabuly", name_lo="ຈັນທະບູລີ", subdivisions=[], parent_division=#<data Baan::Province:...>>,],
parent_division=nil>
# Get all districts
Baan::District.all
=>
{"0101" =>
#<data Baan::District
code="0101",
name_en="Chanthabuly",
name_lo="ຈັນທະບູລີ",
subdivisions=[],
parent_division=#<data Baan::Province:...>>,
# ...other districts
}
# Get a district by its code
Baan::District["0101"]
=>
#<data Baan::District
code="0101",
name_en="Chanthabuly",
name_lo="ຈັນທະບູລີ",
subdivisions=[],
parent_division=#<data Baan::Province:...>>- Mapping and visualization of Lao administrative areas
- Disaster response and early warning systems
- Localized apps and services for Laos
- Statistical and demographic analysis
This library is available as open source under the MIT License.
We welcome contributions, especially:
- Updated or corrected geodata
- Additional administrative levels (e.g. villages)
- Support for other output formats (e.g. JSON, CSV)
To contribute:
- Fork the repository
- Make your changes
- Submit a pull request