I was just stuck in a weird calculation.
I am trying to find the distance in latitude and longitude using this formula mentioned on this site.
http://www.movable-type.co.uk/scripts/latlong.html
anything is there when I do it with a calculator, but when I started doing it programmatically, the result is a difference.
here is my piece of code
lat = Convert.ToDouble( (s3[a]));
longt =Convert.ToDouble( (s4[a]));
Avg_lat = pc._Latitude - lat;
Avg_longt = pc._Longitude - longt;
a_hold =( Math.Sin(Avg_lat / 2) * Math.Sin(Avg_lat / 2) )+ (Math.Cos(pc._Latitude) * Math.Cos(lat)) * (Math.Sin(Avg_longt / 2) * Math.Sin(Avg_longt / 2));
c_hold = 2 * Math.Atan2(Math.Sqrt(a_hold), Math.Sqrt(1 - a_hold));
distance = 6371 * c_hold;
the problem is the mathematical function here calculates things in radians, I want this to the power. therefore, I just found a formula for converting radium to degrees, but this formula incorrectly converts the calculations.
I am just confused what to do bcoz, there is no other way to convert radians to degrees.
Any suggestion or IDea would be possible. Quick Play Search
thank