Skip to content
DEADSERPENTPublic

About

The Library implementation of India's National Addressing Grid (DIGIPIN). High-performance, zero-dependency, and privacy-first geocoding library.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

91 Commits

Folders and files

Repository files navigation

๐Ÿ‡ฎ๐Ÿ‡ณ DIGIPIN

Official open-source implementations of India's national geocoding standard

License Python JavaScript DOI

Transform coordinates into precise, hierarchical digital addresses โ€” no API required. From country-level to doorstep accuracy in milliseconds.

Documentation โ€ข Contributing โ€ข Changelog


What is DIGIPIN?

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.


๐Ÿš€ Implementations

๐Ÿ Python

Package: digipinpy Location: /python PyPI: pypi.org/project/digipinpy

pip install digipinpy

Features:

  • โšก ~50,000 encodes/second
  • ๐Ÿ“ฆ Zero dependencies (pure Python)
  • ๐Ÿ”Œ Native Pandas, Django, FastAPI, Flask integrations
  • ๐Ÿ“Š CLI for batch CSV/Excel processing
  • ๐Ÿ—บ๏ธ Interactive map visualization

โ†’ Python Documentation


๐ŸŸจ JavaScript / TypeScript

Package: digipinjs-lib Location: /javascript NPM: npmjs.com/package/digipinjs-lib

npm install digipinjs-lib

Features:

  • ๐ŸŽฏ Zero dependencies
  • ๐Ÿ“˜ Full TypeScript definitions
  • ๐ŸŒ Node.js & Browser compatible
  • โšก < 5KB gzipped
  • โš›๏ธ React, Vue, Angular ready

โ†’ JavaScript Documentation


๐Ÿ“– Documentation

๐Ÿ“š General Resources

๐Ÿ”Œ Integration Guides


๐ŸŽฏ Quick Example

Python

from digipin import encode, decode

# Encode coordinates to DIGIPIN
code = encode(28.622788, 77.213033)  # '39J49LL8T4'

# Decode back to coordinates
lat, lon = decode('39J49LL8T4')

JavaScript

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');

๐Ÿ—บ๏ธ Precision Levels

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

๐ŸŒŸ Key Features

๐ŸŽฏ Core Capabilities

  • Encode/Decode coordinates
  • Variable precision (10 levels)
  • Neighbor discovery
  • Radius search (disk/ring)
  • Hierarchical operations
  • Bounding box calculations

โšก Performance

  • Zero API dependencies
  • Offline operation
  • Sub-millisecond encoding
  • Optimized algorithms
  • Small bundle sizes
  • Cross-platform

๐Ÿ“ฆ Repository Structure

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

๐Ÿค Contributing

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 help

Or manually:

# For Python development
cd python
pip install -e ".[dev]"
pytest tests/ -v

# For JavaScript development
cd javascript
npm install
npm test

See CONTRIBUTING.md for detailed guidelines.


๐Ÿ“Š Project Status

  • โœ… 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

๐Ÿ“œ License

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.


๐Ÿ‘ฅ Maintainers

SAMARTHA H V โ€ข MR SHIVAKUMAR

๐Ÿ“ง [email protected] โ€ข [email protected]


๐Ÿ”— Links


Government of India โ€ข Department of Posts โ€ข National Addressing Initiative

About

The Library implementation of India's National Addressing Grid (DIGIPIN). High-performance, zero-dependency, and privacy-first geocoding library.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages