digipinindia
Version:
JS/TS NPM Package to encode and decode lattitude/longitude pair to digipin and vice a versa.
28 lines • 1.1 kB
TypeScript
/**
* DIGIPIN Encoder and Decoder Library
* Developed by India Post, Department of Posts
* Released under an open-source license for public use
*
* This module contains two main functions:
* - getDigiPin(lat, lon): Encodes latitude & longitude into a 10-digit alphanumeric DIGIPIN
* - getLatLngFromDigiPin(digiPin): Decodes a DIGIPIN back into its central latitude & longitude
*/
/**
* Encodes latitude and longitude into a DIGIPIN
* @param {number} lat - Latitude (2.5 to 38.5)
* @param {number} lon - Longitude (63.5 to 99.5)
* @returns {string} 10-digit DIGIPIN with hyphens
* @throws {Error} If coordinates are out of bounds
*/
export declare function getDigiPin(lat: number, lon: number): string;
/**
* Decodes a DIGIPIN back to its central coordinates
* @param {string} digiPin - DIGIPIN string (with or without hyphens)
* @returns {Object} Object with latitude and longitude as numbers
* @throws {Error} If DIGIPIN is invalid
*/
export declare function getLatLngFromDigiPin(digiPin: string): {
latitude: number;
longitude: number;
};
//# sourceMappingURL=index.d.ts.map