GeoJSON or SHP shapefile - Boundary / Outline shapes of Bangladesh Divisions (বিভাগ), Districts / Zila / Jela (জেলা), Upazila / Upojela (উপজেলা), Unions / Thanas (থানা)
Shapefiles in SHP format: [humdata.org] (Original Source)
Shapefiles in GeoJSON format: [Google Drive] (Converted)
Note:
- adm = Administration Regions
- adm0 = Entire Bangladesh
- adm1 = 8 Divisions
- adm2 = 64 Districts/Zilas
- adm3 = 492 Upazilas
- adm4 = 5160 Thanas/Unions
GeoJSON files:
bangladesh_geojson_adm0_whole_bangladesh_outline.json
bangladesh_geojson_adm1_8_divisions_bibhags.json
bangladesh_geojson_adm2_64_districts_zillas.json
bangladesh_geojson_adm3_492_upozila.json
bangladesh_geojson_adm4_5160_unions_thanas.json
bangladesh_geojson_admALL_2_entire_bd_division_district_unions.json
bangladesh_geojson_admALL_entire_bd_division_district_unions.json
Inside small
folder (smaller file size):
small_bangladesh_geojson_adm0_whole_bangladesh_outline.json
small_bangladesh_geojson_adm1_8_divisions_bibhags.json
small_bangladesh_geojson_adm2_64_districts_zillas.json
small_bangladesh_geojson_adm3_492_upozila.json
small_bangladesh_geojson_adm4_5160_unions_thanas.json
Source of converter function: medium.com
Link to OGR: link
# Python >= 3.7
import ogr
import json
def shp2json(shp_path):
"""
Convert SHP files to GeoJSON with OGR.
Outputs JSON file to same directory as the SHP files.
Input:
- shp_path (str):
e.g. "D:/somewhere/bangladesh.shp"
"""
driver = ogr.GetDriverByName('ESRI Shapefile')
data_source = driver.Open(shp_path, 0)
fc = {
'type': 'FeatureCollection',
'features': []
}
lyr = data_source.GetLayer(0)
for feature in lyr:
fc['features'].append(feature.ExportToJson(as_object=True))
output_name = shp_path.split(".")[0] + ".json"
with open(output_name, 'w') as f:
json.dump(fc, f)
print("GeoJSON file created: {}".format(output_name))
You can also do it with libraries like geopandas.