nuhil/bangladesh-geocode
소개
Division, District, Upazila, Union 단계를 모두 매핑한 데이터셋으로, SQL, CSV, JSON, XML, PHP 형식을 제공합니다.
데이터 및 분석측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalBangladesh GeoCode
Division, District, Upazila, Union, City Corporation and Post Office / Postcode level, fully mapped database of Bangladesh. Import the files into your DB and join them to get the geo information you need.
The data is generated by a small, reproducible pipeline (pipeline/). It combines official Bangladesh Bureau of Statistics (BBS) geocodes with the original hand-collected data of this repository, so every record keeps its Bangla name and website and also gains an official code and coordinates.
Administrative hierarchy
Division (8)
└── District (64)
├── Upazila (495)
│ └── Union (4,540)
├── City Corporation (12) e.g. Dhaka North, Dhaka South, Chattogram, Gazipur …
└── Post office / postcode (1,349) linked to an upazila OR a city corporation
For example, Dhaka district has 5 upazilas (Savar, Dhamrai, Keraniganj, Nawabganj, Dohar), each with its unions. The urban area belongs to the Dhaka North and Dhaka South City Corporations, and their post offices (Dhaka GPO 1000, Gulshan Model Town 1212, Mirpur 1216 …) are linked with postcodes.city_corporation_id.
Tables and columns
The CSV files have no header row. Their columns are in the order listed below. The columns that existed before are unchanged and in the same position, and new columns are appended at the end, so existing integrations keep working. bbs_code, lat and lon may be empty when a record could not be matched to an official source.
| Table | Columns |
|---|---|
divisions |
id, name, bn_name, url, bbs_code, lat, lon |
districts |
id, division_id, name, bn_name, lat, lon, url, bbs_code |
upazilas |
id, district_id, name, bn_name, url, bbs_code, lat, lon |
unions |
id, upazilla_id, name, bn_name, url, bbs_code, lat, lon |
city_corporations (new) |
id, division_id, district_id, name, bn_name, url, bbs_code, lat, lon |
postcodes (new) |
id, division_id, district_id, upazila_id, city_corporation_id, thana, post_office, postcode, lat, lon, link_method |
bbs_code: the official BBS geocode / UN P-code (for exampleBD3026for Dhaka district andBD30262500for Dhaka North City Corporation). Use it to join with census, humanitarian or GIS data.districts.lat/lon: the District Commissioner's (DC) office (3 m accuracy). For other tables,lat/lonis the BBS reference point or centroid.postcodes.thana: the postal thana as published by the Post Office. It is not always an administrative unit.postcodes.link_method: how the post office was attached to an upazila or city corporation.thana_name: the postal thana is an upazila.metro_thana: the postal thana is a metropolitan thana inside a city corporation.coordinates: the post office location falls inside the unit.district: linked to the district only.manual: added by hand.
- IDs are stable. Existing IDs never change, and new records get new IDs (tracked in
pipeline/state/id_registry.csv).
Available formats
Each table has its own folder (for example unions/) containing:
- SQL (MySQL)
- CSV
- JSON
- PHP array
- XML
database/bd_geo_code.sql contains all tables in a single file, with foreign keys.
GeoJSON district boundaries are available in geojson/districts.geojson.
Data sources
| Source | Used for | Licence |
|---|---|---|
| Bangladesh Bureau of Statistics (BBS) geocodes, published as the Bangladesh Subnational Administrative Boundaries (COD-AB) dataset by UN OCHA on the Humanitarian Data Exchange | Official names, BBS codes, coordinates and boundaries for divisions, districts, upazilas and the 12 city corporations; union reference points | CC BY-IGO |
GeoNames postal code dump for Bangladesh (BD.zip), compiled from the Bangladesh Post Office postcode list |
Post offices and postcodes | CC BY 4.0 |
| Original collection of this repository (2019), from bangladesh.gov.bd (the national portal), wikipedia.org and maps.google.com | Bangla names, official *.gov.bd website addresses, DC office coordinates, the union list |
as this repository |
City corporation websites (*.gov.bd), checked by hand |
City corporation Bangla names and URLs (pipeline/manual/city_corporations.csv) |
public information |
The exact download URLs, retrieval dates, dataset versions and checksums of the last update are recorded in pipeline/sources/manifest.json.
Name spelling: English names of divisions, districts and upazilas follow the official BBS spelling, for example Chattogram, Barishal, Cox's Bazar, Bogura Sadar, and Indurkani (formerly Zianagar). The full list of matches is in pipeline/reports/. Union names keep the spelling used by each union parishad's own website.
How the data is updated
pipeline/
├── fetch_sources.py download the sources → normalised snapshots in pipeline/sources/
├── build.py legacy + snapshots + manual edits → every published file
├── legacy/ the original dataset (fallback layer, never overwritten)
├── sources/ committed snapshots of the upstream data + manifest.json
├── manual/ hand-curated corrections (the ONLY place to edit data by hand)
├── state/ stable id registry
└── reports/ build report, unmatched and low-confidence records to review
pip install -r pipeline/requirements.txt # only needed for fetching
python pipeline/fetch_sources.py # refresh the upstream snapshots
python pipeline/build.py # regenerate all CSV/JSON/SQL/PHP/XML files
A GitHub Action (.github/workflows/data.yml) does two jobs:
- Every month, it refreshes the sources and opens a pull request when something changed.
- On every pull request, it checks that the published files match what the pipeline produces.
Fallbacks
Each layer falls back to the one below it, so a broken or unreachable source never removes data:
- A fresh download from HDX / GeoNames.
- The last downloaded copy (
pipeline/.cache/). If neither is available, the committed snapshot inpipeline/sources/is kept. - The original data (
pipeline/legacy/):- A record that cannot be matched to an official source is still published with its original values.
- Bangla names, websites and DC-office coordinates always come from here.
- If no snapshots exist at all, the build produces exactly the original dataset.
Contributing corrections
Please do not edit the generated files (divisions/, districts/, upazilas/, unions/, city_corporations/, postcodes/, database/) by hand. They are overwritten by every build, and CI rejects hand edits. Instead, edit one of the CSV files in pipeline/manual/:
| File | Use it to |
|---|---|
overrides.csv |
Correct one field of any record (table,key,field,value,note). key is a bbs_code or id:<id>. For example, set a Bangla name or a new website. |
aliases.csv |
Pin a legacy upazila or union to its BBS code when the automatic name matching is wrong or missing (table,legacy_id,bbs_pcode,note). |
additions.csv |
Add an upazila or union that is in no source (table,parent_key,name,bn_name,url,lat,lon,note). parent_key is the parent's id or bbs_code. |
postcode_additions.csv |
Add a post office (district_id,upazila_id,city_corporation_id,thana,post_office,postcode,lat,lon). |
city_corporations.csv |
Set the Bangla names and websites of city corporations. |
Then run python pipeline/build.py and open a pull request with both the manual file and the regenerated output. Records that need a human eye are listed in pipeline/reports/:
low_confidence_matches.csvunmatched_legacy_unions.csvbbs_only_unions.csvpostcodes_district_only.csv
Please create a pull request to add, update, or delete any records!
Upcoming columns
- Area
- Population
- City corporation wards
Now Accepting
Contact
Feel free to find and contact me at Nuhil.net
관련 프로젝트 살펴보기
불러오는 중…