Skip to content

digipin is an npm package that allows you to convert between latitude/longitude coordinates and Digital Postal Index Numbers (DIGIPINs). This system is part of an initiative by the Department of Posts in India to create a standardized, geo-coded addressing system.

License

Notifications You must be signed in to change notification settings

ronitjadhav/digipin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

digipin

digipin is an npm package that allows you to convert between latitude/longitude coordinates and Digital Postal Index Numbers (DIGIPINs). This system is part of an initiative by the Department of Posts in India to create a standardized, geo-coded addressing system. For more details, please visit the India Post DIGIPIN.

Features

  • Convert latitude and longitude to DIGIPIN
  • Convert DIGIPIN to latitude and longitude

Installation

To install the package, use npm or yarn:

npm install digipin

Usage

Importing the Functions

You can import the functions either as named imports or as a default import.

Named Imports

import { getDIGIPINFromLatLon, getLatLonFromDIGIPIN } from 'digipin';

const digipin = getDIGIPINFromLatLon(12.34, 56.78);
console.log(digipin); // Outputs the corresponding DIGIPIN

const coordinates = getLatLonFromDIGIPIN('G4J-9K4-7L');
console.log(coordinates); // Outputs the corresponding latitude and longitude

Default Import

import digipin from 'digipin';

const digipinCode = digipin.getDIGIPINFromLatLon(12.34, 56.78);
console.log(digipinCode); // Outputs the corresponding DIGIPIN

const coordinates = digipin.getLatLonFromDIGIPIN('G4J-9K4-7L');
console.log(coordinates); // Outputs the corresponding latitude and longitude

const bounds = getBoundsFromDIGIPIN('F3M-P6T-FCJK');
console.log(bounds); // Get bounding box for a DIGIPIN, Returns { minLat, maxLat, minLon, maxLon }

Contributing

Contributions are welcome! Please fork the repository and submit a pull request with your changes. For major changes, please open an issue to discuss what you would like to change.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

digipin is an npm package that allows you to convert between latitude/longitude coordinates and Digital Postal Index Numbers (DIGIPINs). This system is part of an initiative by the Department of Posts in India to create a standardized, geo-coded addressing system.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published