@divyadarshan/from-to
v1.1.0
Published
from-to is a powerful and user-friendly npm package designed to calculate the distance between two sets of geographic coordinates. Whether you're building a location-based application, a mapping tool, or simply need to determine the distance between two p
Downloads
3
Maintainers
Readme
from-to
Example
Import
const FromTo = require('@divyadarshan/from-to')
// or
import FromTo from '@divyadarshan/from-to'
Distance in Kilometers / Miles
const a = { latitude: 37.8136, longitude: 144.9631 }
const b = { latitude: 33.8650, longitude: 151.2094 }
console.log(FromTo.distanceInKilometers(a, b)) // 713.70 (in kilometers)
console.log(FromTo.distanceInMiles(a, b)) // 713.70 (in miles)
Time - time to cover the distance
const distance = 713.70 // in kilometers
const speed = 60; // per hour speed
console.log(FromTo.time(distance,speed)) // 713.7 (in minutes)