var childs = <?= Json_encode ($childs, Json_unescaped_unicode)?>;
var latlng = new Google.maps.LatLng (Value.google_lnglat.lat, VALUE.GOOGLE_LNGLAT.LNG); Value.google_lnglat.lat, value.google_lnglat.lng current position latitude and longitude
function Getflatterndistance (LAT1, lng1) {
var Julichangdu = new Array ();
Childs && $.each (Childs, function (idx, dest) {//contents of all remaining points
var lat2 = dest[' Google_lnglat '][1];
var lng2 = dest[' Google_lnglat '][0]
var f = Getrad ((number (LAT1) + number (LAT2))/2);
var g = Getrad ((number (LAT1)-Number (LAT2))/2);
var L = Getrad ((number (LNG1)-Number (LNG2))/2);
var sg = Math.sin (g);
var sl = Math.sin (l);
var sf = Math.sin (f);
var s, c, W, R, D, H1, H2;
var a = Earth_radius;
var fl = 1/298.257;
SG = SG * SG;
SL = SL * SL;
SF = SF * SF;
s = sg * (1-SL) + (1-SF) * SL;
c = (1-SG) * (1-SL) + SF * SL;
W = Math.atan (math.sqrt (s/c));
R = math.sqrt (S * c)/w;
D = 2 * w * A;
H1 = (3 * r-1)/2/c;
H2 = (3 * r + 1)/2/s;
julichangdu[dest[' DestID '] = d * (1 + FL * (H1 * SF * (1-SG)-h2 * (1-SF) * sg));
});
var d = 0;
var di = 0;
Console.log (Julichangdu)
For (var p in Julichangdu) {
Console.log (DI)
Console.log (d)
if (di = = 0) {
DI = julichangdu[p];
d = p;
} else {
if (di > Julichangdu[p]) {
DI = julichangdu[p];
d = p;
}
}
}
return D;
}
Google Maps calculates the closest distance between the current position and the remaining multiple points via JS