//radius of the earth, per metre Private Const DoubleEarth_radius =6378137; /// <summary> ///calculates the distance from the two-point position, returns the distance of two points, per meter///This formula is available to Google with an error of less than 0.2 meters/// </summary> /// <param name= "LAT1" >1th Latitude</param> /// <param name= "Lng1" >1th Longitude</param> /// <param name= "LAT2" >2nd Latitude</param> /// <param name= "Lng2" >2nd Longitude</param> /// <returns></returns> Public Static DoubleGetdistance (DoubleLAT1,DoubleLng1,DoubleLAT2,Doublelng2) { DoubleRADLAT1 =Rad (LAT1); DoubleRadLng1 =Rad (LNG1); DoubleRADLAT2 =Rad (LAT2); DoubleRadLng2 =Rad (LNG2); DoubleA = RADLAT1-RadLat2; Doubleb = radLng1-radLng2; Doubleresult =2* Math.asin (Math.sqrt (Math.pow (Math.sin (A/2),2) + Math.Cos (RADLAT1) * MATH.COS (RADLAT2) * MATH.POW (Math.sin (b/2),2))) *Earth_radius; returnresult; } /// <summary> ///longitude and latitude converted into radians/// </summary> /// <param name= "D" ></param> /// <returns></returns> Private Static DoubleRad (Doubled) {return(Double) d * Math.PI/180d; }
"Go" C # calculates two coordinate point distance