Skip to content

v2.1.0 — fix reverse_lookup correctness bug, add max_km

Latest

Choose a tag to compare

@devzoy devzoy released this 19 Sep 16:35

Fixes a real correctness bug in `reverse_lookup`/`reverseLookup` reported by a user, plus a new optional parameter. Fully backward-compatible — safe to upgrade from any 2.x version.

Fixed

  • `reverse_lookup`/`reverseLookup` could return the wrong pincode (both Python and Node). The expanding nearest-neighbor search stopped at the first non-empty search box and returned the closest point within that box — but a genuinely closer point can sit just outside, near a corner. Verified against a brute-force haversine scan over all 19,416 centroids: Python was wrong on ~1.25–2% of queries near real centroids before the fix, 0/2000 after.
  • Monorepo root `package.json` version had drifted from `version.json`. Fixed, and it's now a managed 5th manifest so this can't recur.
  • README accuracy table incorrectly listed pincode `682555` as a cross-state example — it's actually single-state Lakshadweep. Replaced with `110025`, with a note that some "cross-state" pincodes are source-data mis-codings rather than genuine boundary cases.

Added

  • `reverse_lookup(lat, lon, max_km=None)` / `reverseLookup(lat, lon, maxKm)`: returns `None`/`null` instead of a misleadingly confident match once the nearest pincode exceeds that distance (e.g. for offshore coordinates).

Full details in CHANGELOG.md, including two documented known gaps for a future release.

🤖 Generated with Claude Code