distance-calculator-openrouteservice

1.0.5 • Public • Published

Abhinav Singh

🌍 distance-calculator-openrouteservice

A lightweight Node.js package to calculate the distance and travel duration between two real-world places using the free OpenRouteService API.

✅ Supports travel by car, bike, walking, hiking, and even wheelchair routes!


🚀 Features

  • 🌐 Calculates distance between two places by name
  • ⏱️ Returns estimated travel duration in minutes
  • 📦 Supports multiple travel modes
  • 💬 Returns detailed output in JSON format
  • 🆓 Uses free API from OpenRouteService

📦 Installation

npm install distance-calculator-openrouteservice










// test.js
import getDistance from 'distance-calculator-openrouteservice';

const run = async () => {
  const result = await getDistance("New Delhi", "Mumbai", "driving-car");
  console.log(result);
};

run();



##Sample output
{
  "distance_km": 1400.32,
  "duration_minutes": 1077,
  "mode": "driving-car",
  "from": "New Delhi",
  "to": "Mumbai"
}




✅ Available Travel Modes
Mode	Description
driving-car	🚗 Car on normal roads (default)
driving-hgv	🚚 Heavy goods vehicle (truck, lorry)
cycling-regular	🚲 Regular cycling
cycling-road	🚴 Road cycling
cycling-mountain	🚵 Mountain biking
cycling-electric	⚡ E-bike cycling
foot-walking	🚶 Walking
foot-hiking	🥾 Hiking/trail walking
wheelchair	♿ Wheelchair-optimized route

Package Sidebar

Install

npm i distance-calculator-openrouteservice

Weekly Downloads

5

Version

1.0.5

License

MIT

Unpacked Size

22.9 kB

Total Files

13

Last publish

Collaborators

  • abhinav_4801