Skip to main content

bd-offline-geocoder

PyPI Python License: MIT

Offline Bangladesh reverse geocoder for Python.

GPS → Bangladesh address parts: house, road, area/village, union/ward, thana/upazila, district, division, postal code, city.

No API key. No network. Same data as npm and Flutter.

Keywords: Bangladesh reverse geocoder, offline geocoding, upazila, thana, ward, Dhaka street, GIS Python.

from bd_offline_geocoder import BdOfflineGeocoder

geocoder = BdOfflineGeocoder.from_included_data()
result = geocoder.reverse(latitude=23.74015, longitude=90.38286)
print(result.formatted)
# House 3, Road 3, Dhanmondi, Ward No-49, Dhanmondi Thana, Dhaka 1209, Bangladesh
print(result.to_dict())
# {
#   "house_number": "3",
#   "road_number": "3",
#   "road_name": "",
#   "area_village": "Dhanmondi",
#   "union_ward": "Ward No-49",
#   "thana_upazila": "Dhanmondi Thana",
#   "district": "Dhaka",
#   "division": "Dhaka",
#   "postal_code": "1209",
#   "city": "Dhaka"
# }

Install

pip install bd-offline-geocoder

Python 3.9+. Zero runtime dependencies.

from_included_data() parses bundled GeoJSON once and caches the instance. Reuse it in Celery workers, FastAPI lifespan, or Gunicorn preload.

Published wheel is large (~admin polygons + Dhaka streets) because the feature is offline.

Usage

result = geocoder.reverse(latitude=23.74015, longitude=90.38286)
result.house_number   # 3
result.road_number    # 3
result.road_name      # None unless OSM has a named street
result.area_village   # Dhanmondi
result.union_ward     # Ward No-49
result.thana_upazila  # Dhanmondi Thana
result.district       # Dhaka
result.division       # Dhaka
result.postal_code    # 1209
result.city           # Dhaka
result.formatted
result.to_dict()

Outside Bangladesh: found is False and formatted is
This geocoder only supports locations inside Bangladesh.

Invalid / NaN coordinates raise ValueError.

Custom layers

from bd_offline_geocoder import BdOfflineGeocoder, BoundaryLayer, LayerType

layer = BoundaryLayer.from_file(
    "my_localities.geojson",
    id="localities",
    type=LayerType.LOCALITY,
    name_property_candidates=("name", "NAME"),
)
geocoder = BdOfflineGeocoder([layer])

Limits

  • Nationwide: administrative polygons only (ADM4 is simplified).
  • Roads / house numbers: central Dhaka OSM only; house numbers are sparse.
  • Not a Google Maps replacement for every rooftop.

Links

Source https://github.com/TasfiqulGhani/bd-offline-geocoder
Architecture https://github.com/TasfiqulGhani/bd-offline-geocoder/blob/main/docs/ARCHITECTURE.md
Flutter https://pub.dev/packages/bd_offline_geocoder
npm https://www.npmjs.com/package/bd-offline-geocoder

Author: Tasfiqul Ghani. MIT code; see notices for HDX / OSM.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bd_offline_geocoder-0.1.1.tar.gz (29.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bd_offline_geocoder-0.1.1-py3-none-any.whl (29.9 MB view details)

Uploaded Python 3

File details

Details for the file bd_offline_geocoder-0.1.1.tar.gz.

File metadata

  • Download URL: bd_offline_geocoder-0.1.1.tar.gz
  • Upload date:
  • Size: 29.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for bd_offline_geocoder-0.1.1.tar.gz
Algorithm Hash digest
SHA256 06ed6ee94f751d3e79fd4ea25ac54f496087ac2c1f5f2240e66ae7f490edd597
MD5 bfc7816c10d57c700b01d837cb318fae
BLAKE2b-256 ac63dda0f800959c4d6c7e0dd4eee3cd828da98190289f12ce48cb02cb9c146a

See more details on using hashes here.

Provenance

The following attestation bundles were made for bd_offline_geocoder-0.1.1.tar.gz:

Publisher: publish-pypi.yml on TasfiqulGhani/bd-offline-geocoder

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bd_offline_geocoder-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for bd_offline_geocoder-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1ae73ec5b13725f6239e7eddc47d8e8edb3eabee3c43e0d551030826706f3baa
MD5 8989a3969adf00f64f2ad5c24145533b
BLAKE2b-256 9cb1d6a5c520594f8f35e00a4cfaac16798f6ce888fb958a8200c2a93b4c86db

See more details on using hashes here.

Provenance

The following attestation bundles were made for bd_offline_geocoder-0.1.1-py3-none-any.whl:

Publisher: publish-pypi.yml on TasfiqulGhani/bd-offline-geocoder

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page