Official open-source implementations of India's national geocoding standard
Transform coordinates into precise, hierarchical digital addresses โ no API required. From country-level to doorstep accuracy in milliseconds.
Documentation โข Contributing โข Changelog
DIGIPIN (Digital Postal Index Number) is India's national geocoding system developed by the Department of Posts, Ministry of Communications, Government of India. It divides the entire country into a hierarchical grid, assigning a unique code to every ~4m ร 4m location.
This repository contains official reference implementations in Python and JavaScript, both achieving 100% specification compliance with zero dependencies.
Package: digipinpy
Location: /python
PyPI: pypi.org/project/digipinpy
pip install digipinpyFeatures:
- โก ~50,000 encodes/second
- ๐ฆ Zero dependencies (pure Python)
- ๐ Native Pandas, Django, FastAPI, Flask integrations
- ๐ CLI for batch CSV/Excel processing
- ๐บ๏ธ Interactive map visualization
Package: digipinjs-lib
Location: /javascript
NPM: npmjs.com/package/digipinjs-lib
npm install digipinjs-libFeatures:
- ๐ฏ Zero dependencies
- ๐ Full TypeScript definitions
- ๐ Node.js & Browser compatible
- โก < 5KB gzipped
- โ๏ธ React, Vue, Angular ready
- Technical Specification - Official DIGIPIN spec
- Getting Started - Quick start guide
- Use Cases - Real-world applications
- Geospatial Polyfill - Polygon conversion
- Pandas Integration - DataFrame operations
- Django Integration - ORM field with validation
- FastAPI Integration - REST API microservices
- Flask Integration - Flask + SQLAlchemy
from digipin import encode, decode
# Encode coordinates to DIGIPIN
code = encode(28.622788, 77.213033) # '39J49LL8T4'
# Decode back to coordinates
lat, lon = decode('39J49LL8T4')import { encode, decode } from 'digipinjs-lib';
// Encode coordinates to DIGIPIN
const code = encode(28.622788, 77.213033); // '39J49LL8T4'
// Decode back to coordinates
const { lat, lon } = decode('39J49LL8T4');| Level | Cell Size | Use Case |
|---|---|---|
| 1-2 | ~1000-250 km | Country/State analytics |
| 3-5 | ~63-4 km | Regional/Urban zones |
| 6-8 | ~1km-60m | Delivery zones/Store locator |
| 9-10 | ~15-4m | Building/Last-mile delivery |
|
๐ฏ Core Capabilities
|
โก Performance
|
digipin/
โโโ python/ # Python implementation (digipinpy)
โ โโโ src/ # Source code
โ โโโ tests/ # Test suite (178+ tests)
โ โโโ examples/ # Usage examples
โ โโโ benchmarks/ # Performance tests
โ โโโ README.md # Python docs
โ
โโโ javascript/ # JavaScript implementation (digipinjs-lib)
โ โโโ digipin.js # Main library
โ โโโ test.js # Test suite (60+ tests)
โ โโโ example.js # Usage examples
โ โโโ README.md # JavaScript docs
โ
โโโ tests/data/ # ๐ Shared test vectors (35+ test cases)
โ โโโ test_vectors.json # Single source of truth
โ โโโ README.md # Test vector documentation
โ
โโโ docs/ # Shared documentation
โโโ images/ # Assets and diagrams
โโโ .github/workflows/ # CI/CD workflows (Python + JavaScript)
โโโ Makefile # ๐ Unified development commands
โโโ README.md # This file
We welcome contributions to both Python and JavaScript implementations!
Quick setup using Makefile:
# Clone the repository
git clone https://github.com/DEADSERPENT/digipin.git
cd digipin
# Install all dependencies
make install
# Run all tests
make test
# Run linters
make lint
# See all available commands
make helpOr manually:
# For Python development
cd python
pip install -e ".[dev]"
pytest tests/ -v
# For JavaScript development
cd javascript
npm install
npm testSee CONTRIBUTING.md for detailed guidelines.
- โ Production Ready - Both implementations stable
- โ 100% Spec Compliant - Official DoP specification
- โ Comprehensive Tests - 178+ tests for Python, 60+ for JavaScript
- โ Type Safe - Full type hints (Python) and TypeScript definitions (JS)
- โ Multi-Platform - Windows, macOS, Linux, Browser
MIT License โ Free for commercial and personal use.
Based on the official DIGIPIN specification published by the Department of Posts, Ministry of Communications, Government of India (March 2025).
See LICENSE file for details.
SAMARTHA H V โข MR SHIVAKUMAR
๐ง [email protected] โข [email protected]
- ๐ Python (PyPI): pypi.org/project/digipinpy
- ๐จ JavaScript (NPM): npmjs.com/package/digipinjs-lib
- ๐ Documentation: docs/
- ๐ Issue Tracker: GitHub Issues
- ๐ฌ Discussions: GitHub Discussions
Government of India โข Department of Posts โข National Addressing Initiative