1.0.2 • Published 6 months ago

pincode-distance-mapping v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
6 months ago

pincode-distance-mapping

A simple Node.js package to calculate the distance (in km) between two pincodes using the Nominatim OpenStreetMap API. This package is ideal for React, Angular, Node.js, and other JavaScript-based projects.

Features

✅ Fetches latitude & longitude from a pincode
✅ Uses the Haversine formula to calculate distances
✅ Works with any JavaScript/Node.js project
✅ Lightweight and easy to use

Installation

You can install this package using NPM:

  npm install pincode-distance-mapping

Usage/Examples

1. Import the package

In Node.js
const { getDistance, getCoordinates } = require('pincode-distance-mapping');

In ES Modules:
import { getDistance, getCoordinates } from 'pincode-distance-mapping';

2. Get Distance Between Two Pincodes

(async () => {
  const distance = await getDistance("110001", "400001"); // Example: Delhi to Mumbai
  console.log("Distance:", distance);
})();

getDistance(Source Pincode, Destination Pincode);

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago