/// <Summary>
/// Distance between longitude and latitude
/// </Summary>
/// <Param name = "lng1"> Longitude, usually greater than 90 </Param>
/// <Param name = "LAT1"> Latitude, usually less than 90 </Param>
/// <Param name = "lng2"> </param>
/// <Param name = "LAT2"> </param>
/// <Param name = "gS"> The default value is WGS84. </Param>
/// <Returns> </returns>
Public Static Double Distanceoftwopoints ( Double Lng1, Double LAT1, Double Lng2, Double LAT2, gausssphere GS)
{
Double Radlat1 = rad (LAT1 );
Double Radlat2 = rad (LAT2 );
Double A = radlat1-radlat2;
Double B = rad (lng1)-rad (lng2 );
Double S = 2 * Math. asin (math. SQRT (math. Pow (math. Sin (/ 2 ), 2 ) + Math. Cos (radlat1) * Math. Cos (radlat2)
* Math. Pow (math. Sin (B/ 2 ), 2 )));
S = S * (GS = gausssphere. WGS84? 6378137.0 : (GS = gausssphere. xian80? 6378140.0 : 6378245.0 ));
S = math. Round (S * 10000 )/ 10000 ;
Return S;
}
Private Static DoubleRad (DoubleD)
{
ReturnD * Math. PI/180.0;
}
// Gausssphere is a custom Enumeration type
/// <Summary>
/// References used in Gaussian projection
/// </Summary>
Public Enum Gausssphere
{
Beijing54,
Xian80,
WGS84,
}