calculate distance between two latitude longitude points in google maps api
google.maps.geometry.spherical.computeDistanceBetween (latLngA, latLngB);
calculate distance between two latitude longitude points in google maps api
google.maps.geometry.spherical.computeDistanceBetween (latLngA, latLngB);
distance between two lat long points google maps api
google.maps.geometry.spherical.computeDistanceBetween (latLngA, latLngB);
calculate distance between two latitude longitude points in google maps api
var rad = function(x) {
return x * Math.PI / 180;
};
var getDistance = function(p1, p2) {
var R = 6378137; // Earth’s mean radius in meter
var dLat = rad(p2.lat() - p1.lat());
var dLong = rad(p2.lng() - p1.lng());
var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
Math.cos(rad(p1.lat())) * Math.cos(rad(p2.lat())) *
Math.sin(dLong / 2) * Math.sin(dLong / 2);
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
var d = R * c;
return d; // returns the distance in meter
};
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us