Skip to main content

indian-pincode-geo

Post offices, coordinates, nearby search, and reverse lookup for Indian pincodes — offline, no runtime network calls.

PyPI License: MIT

Companion package to indian-pincode (core), pinned to the exact same version. Install via the core package's geo extra:

pip install "indian-pincode[geo]"

Importing indian_pincode_geo also patches indian_pincode so its top-level functions (indian_pincode.lookup(...), etc.) work — you don't need to juggle two import statements.

Usage

import indian_pincode_geo as geo

# Post offices for a pincode
offices = geo.lookup("110001")
offices[0]["office_name"]                        # "New Delhi GPO"
offices[0]["office_type"]                         # "HO"
offices[0]["geo_quality"]                         # "original"

# Nearby search
nearby = geo.find_nearby(28.6304, 77.2177, radius_km=2)
nearby[0]["office_name"]                          # "Connaught Place SO"
nearby[0]["distance_km"]                          # 0.306

# Reverse geocode to nearest pincode
geo.reverse_lookup(28.6304, 77.2177)              # {"pincode": "110001", "distance_km": 0.872}

# Centroid of a pincode
geo.get_centroid("110001")                        # {"latitude": 28.62273, "longitude": 77.21954}

API reference

Function Returns
lookup(pin) list of post offices for that pincode
find_nearby(lat, lon, radius_km=5, limit=20, include_suspect=False) offices within radius, sorted by distance, each with distance_km
reverse_lookup(lat, lon) nearest pincode centroid: {pincode, distance_km}
get_centroid(pin) {latitude, longitude} for the pincode, or None

Plus the entire core API (validate, get_details, list_districts, etc.), available directly from indian_pincode once this package is imported.

Result keys are snake_case: pincode, office_name, office_type, delivery_status, district, state, state_source, latitude, longitude, geo_quality (plus distance_km on find_nearby/reverse_lookup results). Every result carries geo_quality ("original", "swapped", or "suspect") and state_source. find_nearby and reverse_lookup exclude "suspect" coordinates by default — pass include_suspect=True to include them anyway. See Data quality for what that means and how common it is.

Requirements

Python >=3.10.

Data quality

India Post's coordinates are approximate, and occasionally wrong at the source — lat/lon swapped, or simply implausible. The build pipeline validates every coordinate against India's bounding box, auto-corrects detected lat/lon swaps, and flags points that fall far from their pincode's coordinate cluster as geo_quality == "suspect".

  • ~6.5% of offices (10,686) are flagged suspect and excluded from find_nearby/ reverse_lookup by default.
  • ~8.4% of offices have no usable coordinates at all after cleaning (latitude/ longitude are None).
  • Full methodology and per-build stats: data/REPORT.md.

If your use case needs every point regardless of confidence (e.g. you're doing your own outlier analysis), pass include_suspect=True — don't assume the default is "all data."

Data freshness

DATA_VERSION is the India Post snapshot date this build was compiled from (currently 2025.10.03). Releases are content-gated: you get new data when India Post actually revises the source, not on a fixed monthly schedule.

License

  • Code: MIT.
  • Data: derived from India Post / data.gov.in under the Government Open Data License – India (GODL-India), which requires attribution — see DATA_LICENSE.md.

Metadata

Release files for indian-pincode-geo 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for indian-pincode-geo 2.0.1
File Size Uploaded
indian_pincode_geo-2.0.1.tar.gz 4.1 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for indian-pincode-geo 2.0.1
File Interpreter ABI Platform
indian_pincode_geo-2.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.1 MB

Release files / indian_pincode_geo-2.0.1.tar.gz

Download URL indian_pincode_geo-2.0.1.tar.gz
Size 4.1 MB
Tags Source
SHA-256 checksum
How to use checksums
76bb81af4c746983ce0bde0594978498057e7d951e131927b9c28f59865d2523
BLAKE2b-256 checksum
How to use checksums
2b3874257b69afb2824a1ba21afb596a3d8deea30d7ecece71e83684f270ce74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release files / indian_pincode_geo-2.0.1-py3-none-any.whl

Download URL indian_pincode_geo-2.0.1-py3-none-any.whl
Size 4.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
ff37c027dcb2174a4769472cb22b7d1de11da08044a7447f2e57a35326aef5cc
BLAKE2b-256 checksum
How to use checksums
a97ff04b2548e45ef8ecd81567e4fceaa1ff75aff11fe34afed59793975e58a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release history Release notifications | RSS feed

2.1.0

2 release files

This release

2.0.1 This release

2 release files

2.0.0

2 release 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