#region get the distance between two points (latitude and longitude representation)
<summary>
Get the distance between two points (latitude and longitude representation)
</summary>
<param name= "P1lat" > 1th latitude Value </param>
<param name= "P1LNG" > 1th longitude Value </param>
<param name= "P2lat" > 2nd latitude Value </param>
<param name= "P2LNG" > 2nd longitude Value </param>
<returns></returns>
public static double Getdistance (double P1lat, double p1lng, double P2lat, double p2lng)
{
Double Dlat1inrad = P1lat * (math.pi/180);
Double Dlong1inrad = p1lng * (math.pi/180);
Double Dlat2inrad = P2lat * (math.pi/180);
Double Dlong2inrad = p2lng * (math.pi/180);
Double dlongitude = Dlong2inrad-dlong1inrad;
Double dlatitude = Dlat2inrad-dlat1inrad;
Double A = Math.pow (Math.sin (DLATITUDE/2), 2) + Math.Cos (dlat1inrad) * MATH.COS (Dlat2inrad) * MATH.POW (Math.sin (DLongitu DE/2), 2);
Double c = 2 * MATH.ATAN2 (MATH.SQRT (a), math.sqrt (1-a));
Double ddistance = earthradiuskm * C;
return ddistance;
}
<summary>
Radius of the Earth
</summary>
public static Double earthradiuskm = 6378.137; WGS-84
#endregion
C # Gets the distance between two points (latitude and longitude representation)