/var/www/qr4y.gr/server/delivery
Edit: /var/www/qr4y.gr/server/delivery/func.js (537B)
global.GetDistance = function (latitude1, longtitude1, latitude2, longtitude2) {
let R = 6371 // km (change this constant to get miles)
let dLat = ((latitude2 - latitude1) * Math.PI) / 180
let dLon = ((longtitude2 - longtitude1) * Math.PI) / 180
let a =
Math.sin(dLat / 2) * Math.sin(dLat / 2) +
Math.cos((latitude1 * Math.PI) / 180) *
Math.cos((latitude2 * Math.PI) / 180) *
Math.sin(dLon / 2) *
Math.sin(dLon / 2)
let c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))
return parseFloat((R * c * 1000).toFixed(3))
}